资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:70k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{BEEECC20-4D5F-4F8B-BFDC-5D9B6FBDE09D}#1.0#0"; "vsflex8.ocx"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Begin VB.Form JS_FrmInventory
- Caption = "月末盘存录入"
- ClientHeight = 6555
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 8880
- Icon = "成本计算_数据盘存.frx":0000
- LinkTopic = "Form1"
- MDIChild = -1 'True
- ScaleHeight = 6555
- ScaleWidth = 8880
- Begin VB.ComboBox ydcombo
- Height = 300
- Left = 7470
- TabIndex = 16
- Top = 150
- Visible = 0 'False
- Width = 1275
- End
- Begin VB.CommandButton Yd_Help
- Height = 299
- Left = 6810
- Picture = "成本计算_数据盘存.frx":1042
- Style = 1 'Graphical
- TabIndex = 15
- Top = 150
- Visible = 0 'False
- Width = 300
- End
- Begin VB.CommandButton Ydcommand
- Height = 299
- Left = 7200
- Picture = "成本计算_数据盘存.frx":13CC
- Style = 1 'Graphical
- TabIndex = 14
- Top = 150
- Visible = 0 'False
- Width = 300
- End
- Begin VB.TextBox Ydtext
- BackColor = &H00C0FFFF&
- BorderStyle = 0 'None
- Height = 338
- Left = 6510
- MultiLine = -1 'True
- TabIndex = 13
- Top = 210
- Visible = 0 'False
- Width = 1179
- End
- Begin VB.PictureBox Pic_Title
- AutoRedraw = -1 'True
- BackColor = &H00FFFFFF&
- Height = 1065
- Left = 20
- Picture = "成本计算_数据盘存.frx":1756
- ScaleHeight = 1005
- ScaleWidth = 11850
- TabIndex = 4
- Top = 600
- Width = 11915
- Begin VB.ComboBox Combo_KJQJ
- Height = 300
- Left = 1830
- Style = 2 'Dropdown List
- TabIndex = 5
- Top = 690
- Width = 2025
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackColor = &H80000018&
- BackStyle = 0 'Transparent
- Caption = "月末盘存录入"
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Index = 7
- Left = 360
- TabIndex = 12
- Top = 240
- Width = 1530
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "当前记录"
- Height = 180
- Index = 5
- Left = 9795
- TabIndex = 11
- Top = 210
- Width = 720
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "行)"
- Height = 180
- Index = 4
- Left = 11220
- TabIndex = 10
- Top = 210
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "(第"
- Height = 180
- Index = 3
- Left = 10605
- TabIndex = 9
- Top = 210
- Width = 270
- End
- Begin VB.Label Lab_Row
- Alignment = 2 'Center
- Appearance = 0 'Flat
- AutoSize = -1 'True
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- ForeColor = &H00FF0000&
- Height = 180
- Left = 11070
- TabIndex = 8
- Top = 210
- Width = 90
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "会计期间:"
- Height = 180
- Left = 960
- TabIndex = 7
- Top = 750
- Width = 810
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 195
- Left = 4830
- TabIndex = 6
- Top = 1320
- Visible = 0 'False
- Width = 345
- End
- End
- Begin MSComctlLib.ImageList ImageList2
- Left = 1260
- Top = 690
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 8
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1E696
- Key = "stb"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1EAEA
- Key = "xttb"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1EF42
- Key = "qx"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1F3A2
- Key = "kplr"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1F7F6
- Key = "kpgl"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1FC56
- Key = "tcxt"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":1FF72
- Key = "szk"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":203CA
- Key = "gnqx"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.TreeView Tree_List
- Height = 6285
- Left = 15
- TabIndex = 0
- Top = 1710
- Width = 3345
- _ExtentX = 5900
- _ExtentY = 11086
- _Version = 393217
- Indentation = 661
- LabelEdit = 1
- LineStyle = 1
- Style = 7
- ImageList = "ImageList2"
- Appearance = 1
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- End
- Begin MSComctlLib.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 8880
- _ExtentX = 15663
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "Imagelist1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 10
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- ImageKey = "sz"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- ImageKey = "dy"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- ImageKey = "yl"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "编辑"
- Key = "xg"
- ImageKey = "xg"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存"
- Key = "bc"
- ImageKey = "bc"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "放弃"
- Key = "fq"
- ImageKey = "fq"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 540
- Left = 10200
- TabIndex = 2
- Top = 0
- Width = 1665
- _ExtentX = 2937
- _ExtentY = 953
- ButtonWidth = 1455
- ButtonHeight = 953
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "Imagelist1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 2
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存格式"
- Key = "bcgs"
- ImageKey = "bcgs"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "默认列宽"
- Key = "hfmrgs"
- ImageKey = "mrlk"
- EndProperty
- EndProperty
- End
- Begin MSComctlLib.ImageList Imagelist1
- Left = 5400
- Top = 0
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 30
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":20822
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":20BBC
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":20F56
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":212F0
- Key = "xz"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2168A
- Key = "xg"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":21A24
- Key = "sc"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":21DBE
- Key = "zh"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":22158
- Key = "sh"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":224F2
- Key = "bc"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2288C
- Key = "fq"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":22C26
- Key = "check"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":22FC0
- Key = "qs"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2335A
- Key = "fullcheck"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":236F4
- Key = "qq"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":23A8E
- Key = "first"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":23E28
- Key = "prev"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":241C2
- Key = "next"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2455C
- Key = "last"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":248F6
- Key = "bz"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":24C90
- Key = "tc"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2502A
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":253C4
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2575E
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":25AF8
- Key = "hz"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":25E92
- Key = "dw"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":2622C
- Key = "zx"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":265C6
- Key = "mx"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":26960
- Key = "hf"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":26CFA
- Key = "cx"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "成本计算_数据盘存.frx":27094
- Key = "sx"
- EndProperty
- EndProperty
- End
- End
- Begin VSFlex8Ctl.VSFlexGrid CzxsGrid
- Height = 6270
- Left = 3390
- TabIndex = 3
- Top = 1710
- Width = 8555
- _cx = 5080
- _cy = 5080
- Appearance = 1
- BorderStyle = 1
- Enabled = -1 'True
- BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
- Name = "宋体"
- Size = 9
- Charset = 134
- Weight = 400
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- MousePointer = 0
- BackColor = -2147483643
- ForeColor = -2147483640
- BackColorFixed = -2147483633
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483634
- BackColorBkg = 8421504
- BackColorAlternate= -2147483643
- GridColor = -2147483633
- GridColorFixed = -2147483632
- TreeColor = -2147483632
- FloodColor = 192
- SheetBorder = -2147483642
- FocusRect = 1
- HighLight = 1
- AllowSelection = -1 'True
- AllowBigSelection= -1 'True
- AllowUserResizing= 0
- SelectionMode = 0
- GridLines = 1
- GridLinesFixed = 2
- GridLineWidth = 1
- Rows = 5000
- Cols = 10
- FixedRows = 1
- FixedCols = 0
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- AutoSearchDelay = 2
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0
- ShowComboButton = 1
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- DataMember = ""
- ComboSearch = 3
- AutoSizeMouse = -1 'True
- FrozenRows = 0
- FrozenCols = 0
- AllowUserFreezing= 0
- BackColorFrozen = 0
- ForeColorFrozen = 0
- WallPaperAlignment= 9
- AccessibleName = ""
- AccessibleDescription= ""
- AccessibleValue = ""
- AccessibleRole = 24
- End
- End
- Attribute VB_Name = "JS_FrmInventory"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '*******************************************************
- '* 模 块 名 称 :数据盘存
- '* 功 能 描 述 :数据盘存
- '* 程序员姓名 :xjl
- '* 最后修改人 :xjl
- '* 最后修改时间:2002/1/22
- '* 备 注:
- '*******************************************************
- Dim RecDigest As New ADODB.Recordset '常用摘要表
- Dim jdzygs As Integer '控件焦点转移个数
- Dim Lrzt As Integer '录入状态标志(0-非录入状态 1-增加 2-修改)
- Dim ShowBillLock As Boolean '是否显示
- Dim PrivateYear As Integer '年
- Dim PrivateMm As Integer '月
- Dim TreeNots_Code As String
- Dim Str_RightEdit As String '编辑权限索引
- Dim RecTemp As New ADODB.Recordset
- Dim Cxnrrec As New ADODB.Recordset '显示查询内容动态集
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- Dim ReportTitle As String '报表主标题
- Dim Tsxx As String '系统提示信息
- Dim Pmbcsjhs As Long '屏幕网格保持数据行数(大于等于1)
- Dim Fzxwghs As Integer '辅助项网格行数(包括合计行)
- Dim Sfxshjwg As Boolean '是否显示合计网格
- Dim Qslz As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd As Double '网格数据行高度
- Dim GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Sfblbzkd As Boolean '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
- Dim Dqlrwgh As Long '当前录入数据网格行
- Dim Dqlrwgl As Long '当前录入数据网格列
- Dim Dqlkwgh As Long '刚刚离开网格行(不一定为录入行)
- Dim Dqlkwgl As Long '刚刚离开网格列
- Dim Dqtoprow As Long '当前录入状态时最上端可视行
- Dim Dqleftcol As Long '当前录入状态时最左端可视列
- Dim Zdlrqnr As String '字段录入修改前内容(用来判断内容是否修改)
- Dim Wbkbhlock As Boolean '文本框改变值锁
- Dim Changelock As Boolean '网格行列改变控制锁(用来区别用户改变.程序改变)
- Dim Gdtlock As Boolean '滚动条滚动控制(用来区别用户改变.程序改变)
- Dim Yxxpdlock As Boolean '字段有效性判断锁(内容不修改不需进行字段有效性判断)
- Dim Hyxxpdlock As Boolean '行有效性判断锁(字段内容不修改不需进行行有效性判断)
- Dim Valilock As Boolean '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
- Dim Shsfts As Boolean '删除记录行是否提示
- Dim Szzls As Integer '网格信息数组最大下标值(网格列数-1)
- Private Sub Combo_KJQJ_Click() '会计科目
- PrivateYear = Mid(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 1, 4)
- PrivateMm = Right(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 2)
- Lab_OperStatus.Caption = "1"
- If ShowBillLock = False Then
- Exit Sub
- End If
- '显示数据
- Call ShowCostInventory
- End Sub
- Private Sub CzxsGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long)
- Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
- End Sub
- Private Sub CzxsGrid_EnterCell()
- With CzxsGrid
- If .Row >= .FixedRows Then
- Lab_Row = Trim(Str(.Row - .FixedRows + 1))
- End If
- End With
- End Sub
- Private Sub CzxsGrid_GotFocus()
- '网格得到焦点,如果当前选择行为非数据行
- '则调整当前焦点至有效数据行
- With CzxsGrid
- If .Row < .FixedRows And .Rows > .FixedRows Then
- Changelock = True
- .Select .FixedRows, .Col
- Changelock = False
- End If
- If .Col < Qslz Then '
- Changelock = True
- .Select .Row, Qslz
- Changelock = False
- End If
- End With
- End Sub
- Private Sub CzxsGrid_KeyDown(KeyCode As Integer, Shift As Integer)
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then
- Exit Sub
- End If
- Select Case KeyCode
- Case vbKeyF2 '按F2键参照
- Call xswbk
- Call Lrzdbz
- End Select
- End Sub
- Private Sub CzxsGrid_KeyPress(KeyAscii As Integer)
- '当某种条件成立时禁止文本框激活使单据处于录入状态
- If Not Fun_AllowInput Then
- Exit Sub
- End If
- With CzxsGrid
- '屏 蔽 回 车 键
- If KeyAscii = vbKeyReturn Then
- KeyAscii = 0
- Rowjsq = .Row
- Coljsq = .Col + 1
- If Coljsq > .Cols - 1 Then
- If Rowjsq < .Rows - 1 Then
- Rowjsq = Rowjsq + 1
- End If
- Coljsq = Qslz
- End If
- Do While Rowjsq <= .Rows - 1
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq + 1
- If Coljsq > .Cols - 1 Then
- Rowjsq = Rowjsq + 1
- Coljsq = Qslz
- End If
- Else
- Exit Do
- End If
- Loop
- If Rowjsq <= .Rows - 1 Then
- .Select Rowjsq, Coljsq
- End If
- Exit Sub
- End If
- '接受用户录入
- Select Case KeyAscii
- Case 0 To 32 '用户输入KeyAscii为0-32的键 如空格
- '显示录入载体
- Call xswbk
- Case Else
- '防止非编辑字段SendKeys()出现死循环
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
- Exit Sub
- End If
- '如果此字段为列表框录入则调入相应列表框
- If GridBoolean(.Col, 3) Then
- '列表框录入
- Call xswbk
- Else
- Ydtext.Text = ""
- '录入限制
- Call InputFieldLimit(Ydtext, GridInt(CzxsGrid.Col, 1), KeyAscii)
- If KeyAscii = 0 Then
- Exit Sub
- End If
- Call xswbk
- Ydtext.Text = ""
- Valilock = True
- SendKeys Chr(KeyAscii), True
- DoEvents
- Valilock = False
- End If
- End Select
- End With
- End Sub
- Private Sub CzxsGrid_LeaveCell()
- If Changelock Then
- Exit Sub
- End If
- '记录刚刚离开网格单元的行列值
- Dqlkwgh = CzxsGrid.Row
- Dqlkwgl = CzxsGrid.Col
- '判断是否需要录入数据回写
- If Not (Ydtext.Visible Or YdCombo.Visible) Then
- Exit Sub
- End If
- Call Lrsjhx
- End Sub
- Private Sub CzxsGrid_LostFocus()
- '网格内部原因:网格单元内需要录入信息过程中,(程序控制)本单元内的文本框或下拉列表框显露并获得焦点时引发该事件发生;
- '网格外部原因:网格之外的控件获得焦点造成网格失去焦点,比如网格外的文本框。
- '用以屏蔽调用其它窗体时发生网格失去焦点事件
- If Changelock Then
- Exit Sub
- End If
- '在每个单元输入均合法,但整行输入有可能不合法,在文本框不可编辑状态,这时网格外的某控件获得焦点时,网格失去焦点,必须人为引发RowColChange事件
- '故意引发网格RowcolChange事件
- With CzxsGrid
- If Not (Ydtext.Visible Or YdCombo.Visible) Then
- .Select 0, 0
- End If
- End With
- End Sub
- Private Sub CzxsGrid_RowColChange()
- Valilock = True '屏蔽文本框失去焦点进行有效性判断
- With CzxsGrid
- If Changelock Then
- Exit Sub
- End If
- If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
- Exit Sub
- End If
- If .Row <> Dqlkwgh Then '若刚刚进入行《》刚刚离开行,进行行有效性判断
- If Not Sjhzyxxpd(Dqlkwgh) Then
- Exit Sub
- End If
- End If
- End With
- Call fhyxh '返回有效行
- Call Xldql
- End Sub
- Private Sub CzxsGrid_AfterScroll(ByVal OldTopRow As Long, ByVal OldLeftCol As Long, ByVal NewTopRow As Long, ByVal NewLeftCol As Long)
- If Gdtlock Then
- Exit Sub
- End If
- With CzxsGrid
- If Ydtext.Visible Or YdCombo.Visible Then
- Gdtlock = True
- .TopRow = Dqtoprow
- .LeftCol = Dqleftcol
- Gdtlock = False
- Exit Sub
- End If
- End With
- End Sub
- '控 制 焦 点 转 移
- Private Sub Form_KeyPress(KeyAscii As Integer)
- jdzygs = 3
- Select Case KeyAscii
- Case vbKeyReturn
- If Kjjdzy(jdzygs) Then
- KeyAscii = 0
- End If
- Case 39 '屏蔽"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load()
- '初始化各种锁值
- Changelock = False '网格行列改变控制锁
- Gdtlock = False '滚动条滚动控制
- Yxxpdlock = True '字段有效性判断锁
- Hyxxpdlock = True '行有效性判断锁
- Wbkbhlock = False '文本框内容改变锁
- ShowBillLock = False '是否显示查询数据控制
- PrivateYear = Xtyear '会计年度
- PrivateMm = Xtmm '会计期间
- '定义可变部分变量
- ReportTitle = "月末数据盘存"
- '调入打印页面设置窗体
- XtReportCode = "Cb_Inventory"
- Load Dyymctbl
- '树结构
- Call cshtree
- '调入网格
- GridCode = "Cb_Inventory"
- Call BzWgcsh(CzxsGrid, GridCode, GridInf(), GridBoolean(), GridInt(), GridStr())
- Qslz = GridInf(1)
- Sjhgd = GridInf(2)
- Pmbcsjhs = GridInf(3)
- Fzxwghs = GridInf(4)
- Sfblbzkd = GridInf(5)
- Shsfts = GridInf(6)
- Sfxshjwg = GridInf(7)
- Szzls = CzxsGrid.Cols - 1
- Call Sub_FillPeriod(Combo_KJQJ, PrivateYear, PrivateMm) '会计期间
- TreeNots_Code = "" '显示记录
- Call ShowCostInventory
- Lab_OperStatus.Caption = "1"
- '判断是否有数据
- SqlStr = "Select count(*) From Cb_CostStructure Where CheckFlag='1'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If RecTemp.Fields(0) <= 0 Then
- Call Sub_OperStatus("10")
- Else
- ShowBillLock = True
- End If
- '权限编号
- Str_RightEdit = "CB_Inventory_Edit"
- End Sub
- Private Sub Sub_Query(Code As String, Index As Integer) '查询内容填充网格
- Dim SqlStr As String
- Dim jsqte As Long
- '禁止网格刷新动作,为加快网格显示速度(Fixed)
- CzxsGrid.Redraw = False
- '查询连接串
- If Index = 0 Then
- SqlStr = "Select A.ItemCode,C.ItemName,C.UnitName,C.PlanUnitPrice,B.InvQuantity,B.InvValue,A.Objectcode,A.CenterCode,D.CenterName From " _
- & "Cb_CostStructure A " _
- & "Left Outer Join Cb_Inventory B On " _
- & "A.ObjectCode=B.Objectcode And A.ItemCode=B.ItemCode And B.Year='" + CStr(PrivateYear) + "' and B.Period='" + CStr(PrivateMm) + "' " _
- & "Left Outer Join (Select A.ItemCode,A.ItemName,A.PlanUnitPrice,B.UnitName From Cb_CostItem A " _
- & "Left Outer Join Gy_UnitSet B On A.MeasureUnit=B.UnitCode ) C On A.ItemCode=C.ItemCode " _
- & "Left Outer Join Cb_CostCenter D On A.CenterCode=D.CenterCode " _
- & "Where A.ObjectCode='" & Code & "' And A.CheckFlag='1'"
- Else
- SqlStr = "Select A.ItemCode,B.ItemName,B.UnitName,A.PlanUnitCost as PlanUnitPrice,A.InvQuantity,A.InvValue,A.ObjectCode,A.CenterCode,C.CenterName From Cb_Inventory A " _
- & "Left Outer Join (Select ItemCode,ItemName,UnitName From Cb_CostItem A " _
- & "Left Outer Join Gy_UnitSet B On A.MeasureUnit=B.UnitCode) B On A.ItemCode=B.ItemCode " _
- & "Left Outer Join Cb_CostCenter C On A.CenterCode=C.CenterCode " _
- & "Where A.ObjectCode='" & Code & "' And A.Year='" + CStr(PrivateYear) + "' And A.Period='" + CStr(PrivateMm) + "'"
- End If
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- With Cxnrrec
- CzxsGrid.Rows = CzxsGrid.FixedRows
- If .EOF Then
- CzxsGrid.Redraw = True
- Exit Sub
- End If
- jsqte = CzxsGrid.FixedRows
- Do While Not .EOF
- CzxsGrid.AddItem ""
- '[>>显示
- CzxsGrid.TextMatrix(jsqte, 0) = "*" '行标识
- CzxsGrid.TextMatrix(jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("CenterName") & "") '成本中心
- CzxsGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("ItemCode") & "") '项目编码
- CzxsGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("ItemName") & "") '项目名称
- CzxsGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("UnitName") & "") '计量单位
- CzxsGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("PlanUnitPrice")) & "" '计划单价
- CzxsGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("InvQuantity") & "") '盘存数量
- CzxsGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("InvValue") & "") '盘存金额
- CzxsGrid.TextMatrix(jsqte, Sydz("008", GridStr(), Szzls)) = Trim(.Fields("CenterCode") & "") '中心编码
- CzxsGrid.TextMatrix(jsqte, Sydz("009", GridStr(), Szzls)) = Trim(.Fields("Objectcode") & "") '对象编码
- '<<]
- CzxsGrid.RowHeight(jsqte) = Sjhgd
- .MoveNext
- jsqte = jsqte + 1
- Loop
- End With
- '将网格刷新解禁(Fixed)
- CzxsGrid.Redraw = True
- End Sub
- Private Sub Form_Resize() '调整窗体
- On Error Resume Next
- With Tree_List
- .Width = Me.Width / 4 + Me.Width / 40
- .Height = Me.Height - .Top - 400
- End With
- With CzxsGrid
- .Left = Tree_List.Left + Tree_List.Width + 30
- .Width = Me.Width - (Me.Width / 4 + Me.Width / 40) - 170
- .Height = Me.Height - .Top - 400
- End With
- With Pic_Title
- .Width = Me.Width - 140
- End With
- GsToolbar.Left = Me.Width - GsToolbar.Width - 140
- Call Cxxswbk
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- Set Cxnrrec = Nothing
- Unload Dyymctbl
- End Sub
- Private Function Sub_SaveBill() As Boolean '保存数据
- Dim Recfind As New ADODB.Recordset '有效性判断动态集
- Dim Rowjsq As Long '网格行计数器
- Dim Coljsq As Long '网格列计数器
- Dim Int_RowCount As Integer '有效数据行计数器
- Dim Lrywlz As Long '录入有误列值
- '下面将对所有有效数据行进行有效性判断
- Int_RowCount = 0
- With CzxsGrid
- For Rowjsq = .FixedRows To .Rows - 1
- '带*号者为有效数据行
- If .TextMatrix(Rowjsq, 0) <> "*" Then
- Exit Function
- Else
- Int_RowCount = Int_RowCount + 1
- End If
- '2.[自定义判断(补丁)
- '首先进行为空判断(固定不变)
- For jsqte = Qslz To .Cols - 1
- If (GridInt(jsqte, 5) = 1 And Len(Trim(.TextMatrix(Rowjsq, jsqte))) = 0) Or (GridInt(jsqte, 5) = 2 And Val(Trim(.TextMatrix(Rowjsq, jsqte))) = 0) Then
- Tsxx = GridStr(jsqte, 2)
- Lrywlz = jsqte
- GoTo Lrcwcl
- Exit For
- End If
- Next jsqte
- Next
- If Int_RowCount = 0 Then
- Tsxx = "有效行数为零,不能存盘!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- End If
- End With '网格
- '如果以上有效性检查均顺利通过,则执行存盘动作
- On Error GoTo Swcwcl
- If TreeNots_Code = "" Then
- Exit Function
- End If
- '写数据
- Cw_DataEnvi.DataConnect.BeginTrans
- For Rowjsq = CzxsGrid.FixedRows To CzxsGrid.Rows - 1
- SqlStr = "Delete From Cb_Inventory Where CenterCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls))) & "' And ObjectCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls))) & "' And ItemCode='" & Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) & "' And Year=" & CStr(PrivateYear) & " And Period=" & CStr(PrivateMm) & ""
- Cw_DataEnvi.DataConnect.Execute (SqlStr)
- If RecDigest.State = 1 Then RecDigest.Close
- RecDigest.Open "Select * From Cb_Inventory Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
- If RecDigest.EOF Then
- If CzxsGrid.TextMatrix(Rowjsq, 0) <> "*" Then
- Exit Function
- End If
- With RecDigest
- .AddNew
- .Fields("ItemCode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) '项目编码
- .Fields("CenterCode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("008", GridStr(), Szzls))) '成本中心
- .Fields("Objectcode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls))) '对象编码
- .Fields("Year") = PrivateYear '会计年度
- .Fields("Period") = PrivateMm '会计期间
- .Fields("PlanUnitCost") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls))) '计划成本
- .Fields("InvQuantity") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))) '盘存数量
- .Fields("InvValue") = Val(CzxsGrid.TextMatrix(Rowjsq, Sydz("007", GridStr(), Szzls))) '盘存金额
- .Update
- End With
- End If
- Next
- Cw_DataEnvi.DataConnect.CommitTrans
- Tsxx = "存盘完毕! "
- Call Xtxxts(Tsxx, 0, 4)
- Sub_SaveBill = True
- Lab_OperStatus = "1"
- Call Sub_OperStatus("11")
- Exit Function
- Swcwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- If Err.Number = -2147217873 Then
- Tsxx = "不能有重复的对象!"
- Else
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- End If
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- Lrcwcl: '录入错误处理
- Cw_DataEnvi.DataConnect.RollbackTrans
- With CzxsGrid
- Call Xtxxts("(第 " + Trim(Str(Int_RowCount)) + " 条记录)-" + Tsxx, 0, 1)
- Changelock = True
- .Select Rowjsq, Lrywlz
- CzxsGrid.SetFocus
- Changelock = False
- Exit Function
- End With
- End Function
- '******************以下为基本处理程序(固定不变)************************'
- Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '支持热键操作
- If Shift = 2 Then
- Select Case UCase(Chr(KeyCode))
- Case "P" 'Ctrl+P 打印
- Call bbyl(False)
- End Select
- End If
- End Sub
- Private Sub SzToolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
- Select Case Button.Key
- Case "ymsz" '页面设置
- Dyymctbl.Show 1
- Case "yl" '预 览
- Call bbyl(True)
- Case "dy" '打 印
- Call bbyl(False)
- Case "xg" '编辑
- If CzxsGrid.Rows <= CzxsGrid.FixedRows Then
- Exit Sub
- End If
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- '设置状态
- Lab_OperStatus.Caption = "3"
- '设置工具条状态
- Call Sub_OperStatus("30")
- Case "bc" '保存
- If Fun_Drfrmyxxpd Then Call Sub_SaveBill
- Case "fq" '放弃
- Call Sub_AbandonBill
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- End Select
- End Sub
- Private Sub CzxsGrid_DblClick() '修改当前编码记录
- With CzxsGrid
- Call xswbk
- End With
- End Sub
- Private Sub Sub_OperStatus(Str_Status As String) '工具条依据不同状态所进行的变化
- With SzToolbar
- Select Case Str_Status
- Case "10" '浏览
- '工具条
- .Buttons("xg").Enabled = False '修改
- .Buttons("bc").Enabled = False
- .Buttons("fq").Enabled = False
- Case "11" '浏览
- '工具条
- .Buttons("xg").Enabled = True '修改
- .Buttons("bc").Enabled = False
- .Buttons("fq").Enabled = False
- Case "30" '修改
- '工具条
- .Buttons("xg").Enabled = False '修改
- .Buttons("bc").Enabled = True
- .Buttons("fq").Enabled = True
- End Select
- End With
- End Sub
- Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button) '表格格式设置(通用)
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(CzxsGrid, GridCode, GridStr())
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(CzxsGrid, GridCode, GridStr())
- End Select
- End Sub
- Private Sub bbyl(bbylte As Boolean) '报表打印预览
- Dim Bbzbt$, Bbxbt() As String, bbxbtzzxs() As Integer, Bbxbtgs As Integer
- Dim Bbbwh() As String, Bbbwhzzxs() As Integer, Bbbwhgs As Integer
- Bbxbtgs = 1 '报 表 小 标 题 行 数
- Bbbwhgs = 0 '报 表 表 尾 行 数
- ReDim Bbxbt(1 To Bbxbtgs)
- ReDim bbxbtzzxs(1 To Bbxbtgs)
- If Bbbwhgs <> 0 Then
- ReDim Bbbwh(1 To Bbbwhgs)
- ReDim Bbbwhzzxs(1 To Bbbwhgs)
- End If
- Bbzbt = ReportTitle
- Tree_List.SetFocus
- '判断是否有数据
- SqlStr = "Select count(*) From Cb_CostStructure Where CheckFlag='1'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If RecTemp.Fields(0) <= 0 Then
- Bbxbt(1) = Space(2) + "成本对象:"
- Else
- Tree_List.SetFocus
- If Tree_List.SelectedItem.Children = 0 Then
- Bbxbt(1) = Space(2) + Fun_FormatOutPut("成本对象:" + Tree_List.SelectedItem.Text, 42)
- Bbxbt(1) = Bbxbt(1) + Fun_FormatOutPut(Mid(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 1, 4) + "年" + Right(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 2) + "月", 35)
- Else
- Bbxbt(1) = Space(2) + "成本对象:"
- End If
- End If
- bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
- Call Scyxsjb(CzxsGrid) '生成报表数据
- Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
- If Not bbylte Then
- Unload DY_Tybbyldy
- End If
- End Sub
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub Tree_List_NodeClick(ByVal Node As MSComctlLib.Node)
- Dim code_row As Integer
- Dim ff As String
- On Error Resume Next
- With CzxsGrid
- code_row = .FindRow(Trim(Mid(Tree_List.SelectedItem.Key, 2)), , Sydz("001", GridStr(), Szzls))
- If code_row <> -1 Then
- .Select code_row, 0
- End If
- End With
- '隐藏文本框
- Call Ycwbk
- If Tree_List.SelectedItem.Children = 0 Then
- TreeNots_Code = Right(Mid(Trim(Tree_List.SelectedItem.Key), 2, Len(Trim(Tree_List.SelectedItem.Key)) - 1), 2)
- Call ShowCostInventory
- Else
- TreeNots_Code = ""
- Call ShowCostInventory
- Lab_Row = ""
- End If
- End Sub
- Private Sub TextShow(Index As Integer) '文本框得到焦点,显示相应信息
- '填写文本框得到焦点,进行相应信息处理程序
- End Sub
- Private Sub Lrsjhx() '文本框录入数据回写
- With CzxsGrid
- If YdCombo.Visible Then .Text = Trim(YdCombo.Text)
- If Ydtext.Visible Then .Text = Trim(Ydtext.Text)
- '(如果字段录入内容发生变化,则打开有效性判断锁)
- If Zdlrqnr <> Trim(.Text) Then
- Yxxpdlock = False
- Hyxxpdlock = False
- End If
- '如果字段录入内容不为空则写数据行有效性标志
- If Len(Trim(.Text)) <> 0 Then
- Call Xyxhbz(.Row)
- End If
- '隐藏文本框,帮助按钮,列表组合框
- Call Ycwbk
- End With
- End Sub
- Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean '录入数据行有效性判断,同时进行行处理
- Dim Lrywlz As Long
- With CzxsGrid
- '判断行是否为空和无效数据行清除
- If Yxxpdh > (.Rows - .FixedRows) Then Exit Function
- If .TextMatrix(Yxxpdh, 0) <> "*" Then
- Sjhzyxxpd = True
- Exit Function
- Else
- If pdhwk(Yxxpdh) And Yxxpdh + 1 <= .Rows - 1 Then
- If .TextMatrix(Yxxpdh + 1, 0) <> "*" Then
- Changelock = True
- .RemoveItem Yxxpdh
- If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
- .AddItem ""
- .RowHeight(.Rows - 1) = Sjhgd
- End If
- Changelock = False
- Sjhzyxxpd = True
- Exit Function
- End If
- End If
- End If
- '行没有发生变化则不进行有效性判断
- If Hyxxpdlock Then
- Sjhzyxxpd = True
- Exit Function
- End If
- '以下为自定义部分[
- '1.放置行有效性判断程序
- '首先进行为空判断(固定不变)
- For jsqte = Qslz To .Cols - 1
- If (GridInt(jsqte, 5) = 1 And Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0) Or (GridInt(jsqte, 5) = 2 And Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0) Then
- Tsxx = GridStr(jsqte, 2)
- Lrywlz = jsqte
- GoTo Lrcwcl
- Exit For
- End If
- Next jsqte
- End With
- Sjhzyxxpd = True
- Hyxxpdlock = True
- Exit Function
- Lrcwcl: '录入错误处理
- With CzxsGrid
- Call Xtxxts(Tsxx, 0, 1)
- Changelock = True
- .Select Yxxpdh, Lrywlz
- Changelock = False
- Call xswbk
- Sjhzyxxpd = False
- Exit Function
- End With
- End Function
- Private Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) '录入数据字段有效性判断,同时进行字段录入事后处理
- Dim Str_JudgeText As String '临时有效性判断字段内容
- Dim Coljsq As Long '临时列计数器
- With CzxsGrid
- '非录入状态有效性为合法
- If Yxxpdlock Or .Row < .FixedRows Then
- sjzdyxxpd = True
- Exit Function
- End If
- Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
- End With
- Select Case GridStr(Dqpdwgl, 1)
- '以下为自定义部分[
- Case "006" '实际数量
- If Len(Str_JudgeText) <> 0 Then
- If Trim(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) <> "" Then
- CzxsGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = CStr(Format(Val(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("005", GridStr(), Szzls))) * Val(CzxsGrid.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls))), "0.00"))
- Else
- CzxsGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = ""
- End If
- End If
- End Select
- '根据转帐性质,判断按转帐科目号取项目大类还是按来源科目取项目大类
- '字段录入正确后为零字段清空
- Call Qkwlzd(Dqpdwgh, Dqpdwgl)
- sjzdyxxpd = True
- Yxxpdlock = True
- Exit Function
- Lrcwcl: '录入错误处理
- With CzxsGrid
- Call Xtxxts(Tsxx, 0, 1)
- Changelock = True
- .Select Dqpdwgh, Dqpdwgl
- If GridBoolean(.Col, 1) = True Then
- Changelock = False
- Call xswbk
- sjzdyxxpd = False
- End If
- End With
- Exit Function
- End Function
- Private Sub xswbk() '在当前选中单元显示文本框,列表框,帮助按钮(通用)
- Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
- If Lab_OperStatus.Caption = "1" Then
- Exit Sub
- End If
- '显示文本框前返回有效行列(解决滚动条问题)
- Call Xldqh
- Call Xldql
- '隐藏文本框,帮助按钮,列表组合框 ?何用
- Call Ycwbk
- With CzxsGrid
- Dqlrwgh = .Row
- Dqlrwgl = .Col
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then Exit Sub
- Wbkpy = 30
- Wbkpy1 = 15
- If GridBoolean(.Col, 3) Then '若是下拉列表录入
- YdCombo.Left = .CellLeft + .Left + Wbkpy
- YdCombo.Top = .CellTop + .Top + Wbkpy
- YdCombo.Width = .CellWidth - Wbkpy1
- Call Wbkcl '主要是在下拉列表框可用之前填充下拉列表框
- YdCombo.Visible = True
- YdCombo.SetFocus
- Ydcommand.Visible = False
- Ydtext.Visible = False
- Else
- If GridBoolean(.Col, 2) Then '是否提供帮助
- Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
- Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
- Ydcommand.Visible = True
- Else
- Ydcommand.Visible = False
- End If
- Ydtext.Left = .CellLeft + .Left + Wbkpy
- Ydtext.Top = .CellTop + .Top + Wbkpy
- If Ydcommand.Visible Then
- If Sfblbzkd Then
- Ydtext.Width = .CellWidth - Ydcommand.Width
- Else
- Ydtext.Width = .CellWidth - Wbkpy1
- End If
- Else
- Ydtext.Width = .CellWidth - Wbkpy1
- End If
- Ydtext.Height = .CellHeight - Wbkpy1
- If GridInt(.Col, 2) <> 0 Then
- Ydtext.MaxLength = GridInt(.Col, 2)
- Else
- Ydtext.MaxLength = 3000
- End If
- ' 主要是Zdlrqnr = Trim(.Text)即将网格单元的内容赋予文本框,并且记录网格编辑之前的内容
- '为是否对该单元的内容进行字段有效判断加锁Yxxpdlock = False
- Call Wbkcl
- Ydtext.Visible = True
- Ydtext.SetFocus
- End If
- Dqtoprow = .TopRow
- Dqleftcol = .LeftCol
- '重置锁值
- Valilock = False
- Wbkbhlock = False
- End With
- End Sub
- Private Function Fun_AllowInput() As Boolean '当某种条件成立时禁止文本框激活使单据处于录入状态
- '如果单据操作状态为浏览状态则不能显示录入载体(通用)
- If Trim(Lab_OperStatus.Caption) = "1" Then
- Exit Function
- End If
- '[>>
- '此处可以填写禁止文本框激活使单据处于录入状态的理由
- '<<]
- Fun_AllowInput = True
- End Function
- Private Sub fhyxh() '返回录入数据有效行,同时让得到焦点网格可见
- With CzxsGrid
- If .Row >= .FixedRows Then
- If .TextMatrix(.Row, 0) <> "*" Then '点击网格空区域时执行此语句
- For Rowjsq = .FixedRows To .Rows - 1 '为找到最后一数据行的下一行
- If .TextMatrix(Rowjsq, 0) <> "*" Then
- Exit For
- End If
- Next Rowjsq
- If Rowjsq <= .Rows - 1 Then
- Changelock = True
- .Select Rowjsq, .Col
- Changelock = False
- Else
- Changelock = True
- .Select .Rows - 1, .Col
- Changelock = False
- End If
- End If
- Call Xldqh
- End If
- End With
- End Sub
- Private Sub Xldql() '显露当前列
- Dim Leftcolte As Long
- With CzxsGrid
- If .Col >= Qslz Then
- If .LeftCol > .Col Then
- .LeftCol = .Col
- End If
- Leftcolte = 0
- Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
- Leftcolte = .LeftCol
- .LeftCol = .LeftCol + 1
- Loop
- End If
- End With
- End Sub
- Private Sub Qkwlzd(sjh As Long, Sjl As Long) '清空为零字段
- If Not GridBoolean(Sjl, 5) Then Exit Sub
- With CzxsGrid
- If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then .TextMatrix(sjh, Sjl) = ""
- End With
- End Sub
- Private Sub Xldqh() '显露当前行
- Dim Toprowte As Long
- With CzxsGrid
- Toprowte = 0
- Do While .CellTop + .RowHeight(.Row) + Fzxwghs * Sjhgd > .Height And .TopRow <> Toprowte
- Toprowte = .TopRow
- .TopRow = .TopRow + 1
- Loop
- Toprowte = 0
- Do While .CellTop < .FixedRows * .RowHeight(0) And .TopRow <> Toprowte
- Toprowte = .TopRow
- .TopRow = .TopRow - 1
- Loop
- End With
- End Sub
- Private Sub Ycwbk() '隐藏文本框,帮助按钮,列表组合框
- Valilock = True
- Ydtext.Visible = False
- YdCombo.Visible = False
- Ydcommand.Visible = False
- End Sub
- Private Sub Wbkcl() '文本框录入之前处理(根据实际情况)
- Dim xswbrr As String
- With CzxsGrid
- Zdlrqnr = Trim(.Text)
- xswbrr = Trim(.Text)
- If GridBoolean(.Col, 3) Then '列表框录入
- '填充列表框程序
- Call FillCombo(YdCombo, GridStr(.Col, 5), xswbrr, 0)
- Else
- Wbkbhlock = True
- '====以下为用户自定义
- Ydtext.Text = xswbrr
- '====以上为用户自定义
- Wbkbhlock = False
- Ydtext.SelStart = Len(Ydtext.Text)
- End If
- End With
- End Sub
- Private Sub Xyxhbz(sjh As Long) '写行有效性标志,并判断是否增行
- With CzxsGrid
- If .TextMatrix(sjh, 0) = "*" Then
- Exit Sub
- End If
- .TextMatrix(sjh, 0) = "*"
- If sjh >= .Rows - Fzxwghs - 1 Then
- .AddItem ""
- .RowHeight(.Rows - 1) = Sjhgd
- End If
- End With
- End Sub
- Private Function pdhwk(sjh As Long) '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
- With CzxsGrid
- For Coljsq = Qslz To .Cols - 1
- If Len(Trim(.TextMatrix(sjh, Coljsq))) <> 0 And GridBoolean(Coljsq, 1) Then
- pdhwk = False
- Exit Function
- End If
- Next Coljsq
- pdhwk = True
- End With
- End Function
- Private Sub Cxxswbk() 'Formresize中重新显示文本框,列表框,帮助按钮(通用)
- Dim Wbkpy As Integer, Wbkpy1 As Integer
- Wbkpy = 30
- Wbkpy1 = 15
- With CzxsGrid
- If Ydcommand.Visible Then
- Ydcommand.Left = .Left + .CellLeft + .CellWidth - Ydcommand.Width + Wbkpy
- Ydcommand.Top = .Top + .CellTop + .CellHeight - Ydcommand.Height + Wbkpy
- End If
- If Ydtext.Visible Then
- If Ydcommand.Visible Then
- If Sfblbzkd Then
- Ydtext.Width = .CellWidth - Ydcommand.Width
- Else
- Ydtext.Width = .CellWidth - Wbkpy1
- End If
- Else
- Ydtext.Width = .CellWidth - Wbkpy1
- End If
- Ydtext.Left = .CellLeft + .Left + Wbkpy
- Ydtext.Top = .CellTop + .Top + Wbkpy
- Ydtext.Height = .CellHeight - Wbkpy1
- End If
- End With
- End Sub
- Private Function Fun_Drfrmyxxpd() As Boolean '调入其它窗体或功能产生的有效性判断(包括数据回写)
- '因为点工具栏的按纽时文本框或网格均没有失去焦点事件发生,为保证该操作之前进行录入数据的有效性判断而设。
- Fun_Drfrmyxxpd = True
- With CzxsGrid
- '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
- If Ydtext.Visible Or YdCombo.Visible Then
- Call Lrsjhx
- If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
- Fun_Drfrmyxxpd = False
- Exit Function
- End If
- End If
- '进行行有效性判断
- If Not Sjhzyxxpd(.Row) Then
- Fun_Drfrmyxxpd = False
- Exit Function
- End If
- End With
- End Function
- Private Sub Sub_AbandonBill() '放弃对当前的操作
- '先关闭录入载体
- Changelock = True
- Valilock = True
- Call Ycwbk
- Changelock = False
- Valilock = False
- '显示数据
- Call ShowCostInventory
- '设置操作状态为浏览
- Lab_OperStatus = "1"
- Call Sub_OperStatus("11")
- End Sub
- Private Sub ydtext_Change()
- If Wbkbhlock Then
- Exit Sub
- End If
- With CzxsGrid
- '限制字段录入长度
- Wbkbhlock = True
- Select Case GridInt(.Col, 1)
- Case 8, 11 '金额型
- Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9, 12 '数量型
- Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他类型
- If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
- Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
- End If
- End Select
- Wbkbhlock = False
- End With
- End Sub
- Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer)
- Dim Rowjsq As Long, Coljsq As Long
- With CzxsGrid
- Select Case KeyCode
- Case vbKeyF2
- Call Lrzdbz
- Case vbKeyEscape 'ESC 键放弃录入
- Valilock = True
- Call Ycwbk
- .SetFocus
- Case vbKeyReturn '回 车 键 =13
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- Rowjsq = .Row
- Coljsq = .Col + 1
- If Coljsq > .Cols - 1 Then
- If Rowjsq < .Rows - 1 Then
- Rowjsq = Rowjsq + 1
- End If
- Coljsq = Qslz
- End If
- Do While Rowjsq <= .Rows - 1
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq + 1
- If Coljsq > .Cols - 1 Then
- Rowjsq = Rowjsq + 1
- Coljsq = Qslz
- End If
- Else
- Exit Do
- End If
- Loop
- If Rowjsq <= .Rows - 1 Then
- .Select Rowjsq, Coljsq
- End If
- Case vbKeyUp '上 箭 头 =38
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- If .Row > .FixedRows Then
- .Row = .Row - 1
- End If
- Case vbKeyDown '下 箭 头 =40
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- If .Row < .Rows - 1 Then
- .Row = .Row + 1
- End If
- Case vbKeyLeft '左 箭 头 =37
- If .Col - 1 = Qslz Then
- If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
- GoTo jzzx
- End If
- End If
- If Ydtext.SelStart = 0 And .Col > Qslz Then
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- Coljsq = .Col - 1
- Do While Coljsq > Qslz
- If Coljsq - 1 = Qslz Then
- If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
- GoTo jzzx
- End If
- End If
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq - 1
- Else
- Exit Do
- End If
- Loop
- .Select .Row, Coljsq
- End If
- jzzx:
- Case vbKeyRight '右 箭 头 =39
- wblong = Len(Ydtext.Text)
- If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- Rowjsq = .Row
- Coljsq = .Col + 1
- If Coljsq > .Cols - 1 Then
- If Rowjsq < .Rows - 1 Then
- Rowjsq = Rowjsq + 1
- End If
- Coljsq = Qslz
- End If
- Do While Rowjsq <= .Rows - 1
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq + 1
- If Coljsq > .Cols - 1 Then
- Rowjsq = Rowjsq + 1
- Coljsq = Qslz
- End If
- Else
- Exit Do
- End If
- Loop
- .Select Rowjsq, Coljsq
- End If
- Case Else
- End Select
- End With
- End Sub
- Private Sub ydtext_KeyPress(KeyAscii As Integer)
- Call InputFieldLimit(Ydtext, GridInt(CzxsGrid.Col, 1), KeyAscii)
- End Sub
- Private Sub ydtext_LostFocus()
- With CzxsGrid
- If Not Valilock Then
- Call Lrsjhx
- If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
- Exit Sub
- End If
- If Not Sjhzyxxpd(Dqlrwgh) Then
- Exit Sub
- End If
- End If
- End With
- End Sub
- Private Sub Lrzdbz() '录入字段帮助
- If Not Ydcommand.Visible Then
- Exit Sub
- End If
- Valilock = True '为防止按ydText中帮助按纽时,引起ydText的LostFocus事件。
- With CzxsGrid
- '[>>会计科目编码帮助单独处理
- Select Case .Col
- Case Sydz("004", GridStr(), Szzls)
- Xtcdcs = Trim(Ydtext.Text)
- PZ_FrmKjkmcz.Show 1
- If Len(Xtfhcs) <> 0 Then
- Ydtext.Text = Xtfhcs
- End If
- Case Else
- '处理通用部分
- Changelock = True '调入另外窗体必须加锁,为不必执行网格的离开焦点造成的RowColChange事件
- '?没有必要,因为,文本框和命令按纽之间转换焦点,不会执行RowColChange
- Call Drbmhelp(GridInt(.Col, 6), GridStr(.Col, 3), Trim(Ydtext.Text))
- Changelock = False
- If Len(Xtfhcs) <> 0 Then
- If GridInt(.Col, 7) = 0 Then
- Ydtext.Text = Xtfhcs
- Else
- Ydtext.Text = Xtfhcsfz
- End If
- End If
- End Select
- '[>>处理完毕
- Valilock = False
- If Ydtext.Visible Then
- Ydtext.SetFocus
- End If
- End With
- End Sub
- '------------------自定义部份------------------
- Sub ShowCostInventory() '显示成本盘存数据
- '会计日历
- SqlStr = "Select Count(*) From gy_kjrlb where kjyear='" + Trim(Str(PrivateYear)) + "' And Period='" + CStr(PrivateMm) + "' " _
- & "And CwzzJzbz='1'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If RecTemp.Fields(0) > 0 Then
- Call Sub_OperStatus("10")
- Call Sub_Query(TreeNots_Code, 1)
- Else
- Call Sub_OperStatus("11")
- Call Sub_Query(TreeNots_Code, 0)
- End If
- End Sub
- Private Sub cshtree() '初始化项目树
- Dim mm_matesort As New ADODB.Recordset
- '*****************************************************
- SqlStr = "Select * From (Select A.CenterCode,B.CenterName,A.CenterCode AS AC,'1' As code_level From " _
- & "(Select Distinct CenterCode From Cb_CostObject Where ObjectCode In " _
- & "(Select Distinct Objectcode From Cb_CostStructure Where CheckFlag='1')) A " _
- & "Left Outer Join Cb_CostCenter B On A.CenterCode=B.CenterCode " _
- & "Union " _
- & "Select A.ObjectCode,B.ObjectName,Rtrim(B.CenterCode)+Ltrim(A.ObjectCode),'2' " _
- & "From (Select Distinct Objectcode From Cb_CostStructure Where CheckFlag='1') A " _
- & "Left Outer Join Cb_CostObject B On A.ObjectCode=B.ObjectCode) A Order By Ac"
- Set mm_matesort = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- '树的形式出现
- Call fill_tv(Tree_List, mm_matesort, "CenterCode", "CenterName", "AC", True, "数据盘存", "xttb", "gnqx")
- End Sub
- '---------------------------------------------填充TREEVIEW---------------------------
- Public Sub fill_tv(tv As TreeView, flbm As ADODB.Recordset, field1 As String, field2 As String, Field3 As String, bmjc_bz As Boolean, tree_name As String, Treeprant As String, Treechr As String)
- Dim fllb, lsbl(), lsbl1(), remlayer, nodX, tem, count
- On Error GoTo ERRORCL
- tv.Nodes.Clear
- flbm.Requery
- If flbm.EOF Then
- Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
- Exit Sub
- Else
- Set nodX = tv.Nodes.Add(, 4, "r", tree_name, Treeprant)
- End If
- flbm.MoveFirst
- count = 1
- If bmjc_bz Then
- Do While Not flbm.EOF
- fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
- remlayer = flbm.Fields("code_level")
- tem = Trim(flbm.Fields(Field3))
- Select Case remlayer
- Case 1
- ReDim Preserve lsbl(remlayer)
- ReDim Preserve lsbl1(remlayer)
- lsbl(remlayer) = "p" & tem
- Set nodX = tv.Nodes.Add("r", 4, lsbl(remlayer), fllb, Treechr)
- tv.Nodes(count).Expanded = True
- Case 2
- ReDim Preserve lsbl1(remlayer)
- ReDim Preserve lsbl1(remlayer)
- lsbl1(remlayer) = "p" & tem
- Set nodX = tv.Nodes.Add(lsbl(remlayer - 1), tvwChild, lsbl1(remlayer), fllb, Treechr)
- Case 3
- ReDim Preserve lsbl(remlayer)
- ReDim Preserve lsbl1(remlayer)
- lsbl(remlayer) = lsbl1(remlayer - 1)
- lsbl1(remlayer) = "p" & tem
- Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
- Case Else
- ReDim Preserve lsbl(remlayer)
- ReDim Preserve lsbl1(remlayer)
- lsbl(remlayer) = lsbl1(remlayer - 1)
- lsbl1(remlayer) = "p" & tem
- Set nodX = tv.Nodes.Add(lsbl(remlayer), tvwChild, lsbl1(remlayer), fllb, Treechr)
- End Select
- count = count + 1
- flbm.MoveNext
- Loop
- Else
- Do While Not flbm.EOF
- fllb = "(" + Trim(flbm.Fields(field1)) + ")" + Trim(flbm.Fields(field2))
- tem = Trim(flbm.Fields("flbm"))
- lsbl(remlayer) = "p" & tem
- Set nodX = tv.Nodes.Add(, 4, lsbl(remlayer), fllb)
- flbm.MoveNext
- Loop
- End If
- Exit Sub
- ERRORCL:
- MsgBox "程序出现错误", vbExclamation, Title_Bar
- Exit Sub
- End Sub