资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:69k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{65A39231-6133-11D1-BAA2-444553540000}#1.0#0"; "vslight6.OCX"
- Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form JS_FrmObjectComplete
- 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 = 15
- Top = 150
- Visible = 0 'False
- Width = 1275
- End
- Begin VB.CommandButton Yd_Help
- Height = 299
- Left = 6810
- Picture = "成本计算_对象完工.frx":1042
- Style = 1 'Graphical
- TabIndex = 14
- Top = 150
- Visible = 0 'False
- Width = 300
- End
- Begin VB.CommandButton Ydcommand
- Height = 299
- Left = 7200
- Picture = "成本计算_对象完工.frx":13CC
- Style = 1 'Graphical
- TabIndex = 13
- 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 = 12
- Top = 210
- Visible = 0 'False
- Width = 1179
- End
- Begin VB.PictureBox Pic_Title
- AutoRedraw = -1 'True
- BackColor = &H00FFFFFF&
- Height = 1065
- Left = 30
- Picture = "成本计算_对象完工.frx":1756
- ScaleHeight = 1005
- ScaleWidth = 11850
- TabIndex = 3
- Top = 600
- Width = 11915
- Begin VB.ComboBox Combo_Center
- Height = 300
- Left = 1770
- Style = 2 'Dropdown List
- TabIndex = 17
- Top = 690
- Width = 2025
- End
- Begin VB.ComboBox Combo_KJQJ
- Height = 300
- Left = 7830
- Style = 2 'Dropdown List
- TabIndex = 4
- Top = 690
- Width = 2025
- End
- Begin VB.Label Label1
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "成本中心:"
- Height = 180
- Left = 900
- TabIndex = 16
- Top = 750
- Width = 810
- 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 = 11
- Top = 240
- Width = 1530
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "当前记录"
- Height = 180
- Index = 5
- Left = 9795
- TabIndex = 10
- Top = 210
- Width = 720
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "行)"
- Height = 180
- Index = 4
- Left = 11220
- TabIndex = 9
- Top = 210
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "(第"
- Height = 180
- Index = 3
- Left = 10605
- TabIndex = 8
- 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 = 7
- Top = 210
- Width = 90
- End
- Begin VB.Label Label2
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "会计期间:"
- Height = 180
- Left = 6990
- TabIndex = 6
- Top = 750
- Width = 810
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 195
- Left = 4830
- TabIndex = 5
- 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.Toolbar SzToolbar
- Align = 1 'Align Top
- Height = 570
- Left = 0
- TabIndex = 0
- Top = 0
- Width = 8880
- _ExtentX = 15663
- _ExtentY = 1005
- ButtonWidth = 820
- ButtonHeight = 953
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "Imagelist1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 13
- 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 = "sh"
- ImageKey = "check"
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "弃审"
- Key = "qs"
- ImageKey = "qs"
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 540
- Left = 10200
- TabIndex = 1
- 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 = 30
- TabIndex = 2
- Top = 1710
- Width = 11910
- _ExtentX = 21008
- _ExtentY = 11060
- 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
- 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 'False
- ShowComboButton = -1 'True
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- End
- End
- Attribute VB_Name = "JS_FrmObjectComplete"
- 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 Combo_CenterCode() As String '成本中心编码
- Dim Str_RightEdit As String '编辑权限索引
- Dim Str_RightCheck As String '审核权限索引
- 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_Center_Click() '选择成本中心
- If ShowBillLock = True Then
- '显示数据
- Call ShowObjectComplete
- End If
- End Sub
- 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 ShowObjectComplete
- 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_ObjectComplete"
- Load Dyymctbl
- '调入网格
- GridCode = "Cb_ObjectComplete"
- 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)
- '成本中心
- Call CshCostCenter
- If Combo_Center.ListCount > 0 Then
- '显示数据
- Call ShowObjectComplete
- ShowBillLock = True
- Else
- Call Sub_OperStatus("10")
- End If
- Lab_OperStatus.Caption = "1"
- '编辑权限
- Str_RightEdit = "CB_ObjectComplete_Edit"
- '审核权限
- Str_RightCheck = "CB_ObjectComplete_Check"
- End Sub
- Private Sub Sub_Query(Index As Integer) '查询内容填充网格
- Dim SqlStr As String
- Dim jsqte As Long
- '禁止网格刷新动作,为加快网格显示速度(Fixed)
- CzxsGrid.Redraw = False
- '查询连接串
- If Index = 0 Then
- SqlStr = "Select A.Objectcode,A.ObjectName,B.UnitName,A.PlanQuantity,A.PlanCost,C.Quantity,C.Auditing " _
- & "From Cb_CostObject A " _
- & "Left Outer Join Gy_UnitSet B On A.MeasureUnitCode=B.UnitCode " _
- & "Left Outer Join Cb_ObjectComplete C On A.ObjectCode=C.ObjectCode And C.Year='" & PrivateYear & "' And C.Period='" & PrivateMm & "' " _
- & "Where A.CenterCode='" & Combo_CenterCode(Combo_Center.ListIndex) & "'"
- Else
- SqlStr = "Select * From (Select A.Objectcode,B.ObjectName,B.UnitName,A.PlanQuantity,A.PlanCost,A.Quantity,A.Auditing, " _
- & "A.Year,A.Period,B.CenterCode From Cb_ObjectComplete A " _
- & "Left Outer Join (Select ObjectCode,ObjectName,UnitName,CenterCode From Cb_CostObject A " _
- & "Left Outer Join Gy_UnitSet B On A.MeasureUnitCode=B.UnitCode) B On A.ObjectCode=B.ObjectCode) A " _
- & "Where A.CenterCode='" & Combo_CenterCode(Combo_Center.ListIndex) & "' And A.Year='" & PrivateYear & "' And A.Period='" & 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("Objectcode") & "") '对象编码
- CzxsGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("ObjectName") & "") '对象名称
- CzxsGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("UnitName") & "") '计量单位
- CzxsGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("PlanQuantity")) & "" '定额数量
- CzxsGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("PlanCost") & "") '计划成本
- CzxsGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("Quantity") & "") '数量
- CzxsGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = Trim(.Fields("Auditing") & "") '审核
- '<<]
- 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 CzxsGrid
- .Width = Me.Width - 160
- .Height = Me.Height - .Top - 400
- End With
- With Pic_Title
- .Width = Me.Width - 160
- 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
- Cw_DataEnvi.DataConnect.BeginTrans
- For Rowjsq = CzxsGrid.FixedRows To CzxsGrid.Rows - 1
- SqlStr = "Delete From Cb_ObjectComplete Where Year='" & PrivateYear & "' And Period='" & PrivateMm & "' And ObjectCode='" + Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) + "'"
- Cw_DataEnvi.DataConnect.Execute (SqlStr)
- If RecDigest.State = 1 Then RecDigest.Close
- RecDigest.Open "Select * From Cb_ObjectComplete 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("Objectcode") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) '对象编码
- If Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls))) = "" Then
- .Fields("PlanCost") = 0 '计划成本
- Else
- .Fields("PlanCost") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls))) '计划成本
- End If
- If Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls))) = "" Then
- .Fields("PlanQuantity") = 0 '计划产量
- Else
- .Fields("PlanQuantity") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls))) '计划产量
- End If
- If Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))) = "" Then
- .Fields("Quantity") = 0 '完工数量
- Else
- .Fields("Quantity") = Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))) '完工数量
- End If
- If Trim(CzxsGrid.TextMatrix(Rowjsq, Sydz("007", GridStr(), Szzls))) = True Then
- .Fields("Auditing") = 1 '审核
- Else
- .Fields("Auditing") = 0 '审核
- End If
- .Fields("Year") = PrivateYear '会计年度
- .Fields("Period") = PrivateMm '会计期间
- .Fields("TranEngSign") = 0 '结转否
- .Update
- End With
- End If
- Next
- Cw_DataEnvi.DataConnect.CommitTrans
- Tsxx = "存盘完毕! "
- Call Xtxxts(Tsxx, 0, 4)
- Sub_SaveBill = True
- '标识单据发生改动
- Bln_BillChange = 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 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 "sh" '审核
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightCheck, Xtczybm, 1, True) Then
- Exit Sub
- End If
- Call Sub_CheckObject
- Case "qs" '弃审
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightCheck, Xtczybm, 1, True) Then
- Exit Sub
- End If
- Call Sub_AbandonObject
- 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
- .Buttons("sh").Enabled = False
- .Buttons("qs").Enabled = False
- Case "11" '浏览
- '工具条
- .Buttons("xg").Enabled = True '修改
- .Buttons("bc").Enabled = False
- .Buttons("fq").Enabled = False
- .Buttons("sh").Enabled = True
- .Buttons("qs").Enabled = True
- Case "30" '修改
- '工具条
- .Buttons("xg").Enabled = False '修改
- .Buttons("bc").Enabled = True
- .Buttons("fq").Enabled = True
- .Buttons("sh").Enabled = False
- .Buttons("qs").Enabled = False
- 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
- If Combo_Center.ListCount > 0 Then
- Bbxbt(1) = Space(2) + Fun_FormatOutPut("成本中心:" + Right(Trim(Combo_Center.List(Combo_Center.ListIndex)), Len(Trim(Combo_Center.List(Combo_Center.ListIndex))) - 4), 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
- 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 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)
- '以下为自定义部分[
- 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 Fun_AllowInput = False 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
- '[>>
- If CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("007", GridStr(), Szzls)) = True 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 ShowObjectComplete
- '设置操作状态为浏览
- 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 CshCostCenter() '初始化成本中心
- Dim RecTemp As New ADODB.Recordset
- SqlStr = "Select CenterCode,CenterName From Cb_CostCenter Order By CenterCode"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- ReDim Combo_CenterCode(RecTemp.RecordCount)
- Do Until RecTemp.EOF
- Combo_Center.AddItem "(" + Trim(RecTemp.Fields("CenterCode")) + ")" + RecTemp.Fields("CenterName")
- Combo_CenterCode(Combo_Center.NewIndex) = RecTemp.Fields("CenterCode")
- RecTemp.MoveNext
- Loop
- If Combo_Center.ListCount >= 1 Then
- Combo_Center.ListIndex = 0
- End If
- End Sub
- Sub Sub_CheckObject() '审核
- Dim yhAnswer As Integer
- If CzxsGrid.Rows <= CzxsGrid.FixedRows Then
- Tsxx = "没有需审核的核算对象。"
- Call Xtxxts(Tsxx, 0, 3)
- Exit Sub
- End If
- SqlStr = "Select * From Cb_ObjectComplete Where Objectcode='" & Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))) & "' And Year='" & PrivateYear & "' And Period='" & PrivateMm & "'"
- If Cxnrrec.State = 1 Then Cxnrrec.Close
- Cxnrrec.Open SqlStr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
- If Not Cxnrrec.EOF Then
- If Cxnrrec.Fields("Auditing") = True Then
- '对象已审核
- Tsxx = "对象已审核,不能重新进行审核。"
- Call Xtxxts(Tsxx, 0, 3)
- Else
- Tsxx = "是否确认审核对象《" + CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("002", GridStr(), Szzls)) + "》?"
- yhAnswer = Xtxxts(Tsxx, 2, 2)
- If yhAnswer = 2 Then
- Exit Sub
- End If
- Cxnrrec.Fields("Auditing") = 1
- Cxnrrec.Update
- '显示数据
- Call ShowObjectComplete
- End If
- Else
- Tsxx = "对象未初始化,请先初始化对象。"
- Call Xtxxts(Tsxx, 0, 3)
- End If
- End Sub
- Sub Sub_AbandonObject() '弃审
- Dim yhAnswer As Integer
- If CzxsGrid.Rows <= CzxsGrid.FixedRows Then
- Tsxx = "没有需审核的核算对象。"
- Call Xtxxts(Tsxx, 0, 3)
- Exit Sub
- End If
- SqlStr = "Select * From Cb_ObjectComplete Where Objectcode='" & Trim(CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("001", GridStr(), Szzls))) & "' And Year='" & PrivateYear & "' And Period='" & PrivateMm & "'"
- If Cxnrrec.State = 1 Then Cxnrrec.Close
- Cxnrrec.Open SqlStr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
- If Not Cxnrrec.EOF Then
- If Cxnrrec.Fields("Auditing") = False Then
- '对象未审
- Tsxx = "对象未审核,不能重新进行弃审。"
- Call Xtxxts(Tsxx, 0, 3)
- Else
- Tsxx = "是否确认弃审对象《" + CzxsGrid.TextMatrix(CzxsGrid.Row, Sydz("002", GridStr(), Szzls)) + "》?"
- yhAnswer = Xtxxts(Tsxx, 2, 2)
- If yhAnswer = 2 Then
- Exit Sub
- End If
- Cxnrrec.Fields("Auditing") = 0
- Cxnrrec.Update
- '显示数据
- Call ShowObjectComplete
- End If
- Else
- Tsxx = "对象未初始化,请先初始化对象。"
- Call Xtxxts(Tsxx, 0, 3)
- End If
- End Sub
- Sub ShowObjectComplete() '显示数据
- '会计日历
- 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(1)
- Else
- '设置工具条状态
- Call Sub_OperStatus("11")
- '显示数据
- Call Sub_Query(0)
- End If
- End Sub