资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:104k
源码类别:
企业管理
开发平台:
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 AutoTran_DefiMy
- BackColor = &H00E9F4FA&
- BorderStyle = 1 'Fixed Single
- Caption = "自定义转帐凭证"
- ClientHeight = 7815
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 11715
- Icon = "自动转帐凭证_自定义.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 7815
- ScaleWidth = 11715
- Begin VB.PictureBox Pic_Title
- AutoRedraw = -1 'True
- Height = 1335
- Left = 0
- Picture = "自动转帐凭证_自定义.frx":1042
- ScaleHeight = 1275
- ScaleMode = 0 'User
- ScaleWidth = 11944.03
- TabIndex = 9
- Top = 540
- Width = 11900
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "凭证类别:"
- Height = 180
- Index = 0
- Left = 690
- TabIndex = 20
- Top = 900
- Width = 810
- End
- Begin VB.Label Lab_Row
- Alignment = 2 'Center
- Appearance = 0 'Flat
- AutoSize = -1 'True
- BackColor = &H80000005&
- BackStyle = 0 'Transparent
- ForeColor = &H00000000&
- Height = 240
- Left = 9945
- TabIndex = 19
- Top = 900
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "(第"
- Height = 240
- Index = 11
- Left = 9570
- TabIndex = 18
- Top = 900
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "行)"
- Height = 240
- Index = 12
- Left = 10185
- TabIndex = 17
- Top = 900
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "当前记录"
- Height = 240
- Index = 13
- Left = 8760
- TabIndex = 16
- Top = 900
- Width = 735
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "转帐名称:"
- Height = 180
- Index = 2
- Left = 3990
- TabIndex = 15
- Top = 900
- Width = 810
- End
- Begin VB.Label Lbl_AutoAccName
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lbl_AutoAccName"
- Height = 240
- Left = 4890
- TabIndex = 14
- Top = 900
- Width = 1575
- End
- Begin VB.Label Lbl_AutoAccCode
- Caption = "Lbl_AutoAccCode"
- Height = 240
- Left = 180
- TabIndex = 13
- Top = 90
- Visible = 0 'False
- Width = 1380
- End
- Begin VB.Label Lbl_AutoAccClassName
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "Lbl_AutoAccClassName"
- Height = 240
- Left = 1590
- TabIndex = 12
- Top = 900
- Width = 1830
- End
- Begin VB.Label Lbl_AutoAccClassCode
- Caption = "Lbl_AutoAccClassCode"
- Height = 240
- Left = 1695
- TabIndex = 11
- Top = 90
- Visible = 0 'False
- Width = 1980
- 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 = 6
- Left = 600
- TabIndex = 10
- Top = 240
- Width = 1785
- End
- End
- Begin VB.CommandButton Yd_Help
- Height = 300
- Left = 7421
- Picture = "自动转帐凭证_自定义.frx":35106
- Style = 1 'Graphical
- TabIndex = 7
- Top = 659
- Visible = 0 'False
- Width = 300
- End
- Begin VB.CommandButton Ydcommand
- Height = 300
- Left = 6924
- Picture = "自动转帐凭证_自定义.frx":35490
- Style = 1 'Graphical
- TabIndex = 6
- Top = 615
- Visible = 0 'False
- Width = 300
- End
- Begin VB.ComboBox YdCombo
- Height = 300
- Left = 8148
- Style = 2 'Dropdown List
- TabIndex = 5
- Top = 983
- Visible = 0 'False
- Width = 1149
- End
- Begin VB.TextBox Ydtext
- BackColor = &H00C0FFFF&
- BorderStyle = 0 'None
- Height = 338
- Left = 9640
- MultiLine = -1 'True
- TabIndex = 4
- Top = 615
- Visible = 0 'False
- Width = 1179
- End
- Begin VSFlex8Ctl.VSFlexGrid WglrGrid
- Height = 5895
- Left = 0
- TabIndex = 3
- Top = 1890
- Width = 11730
- _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 = -2147483632
- 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
- Begin VB.Timer Timer1
- Interval = 1
- Left = 9840
- Top = 960
- End
- Begin MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 1
- Top = 0
- Width = 11715
- _ExtentX = 20664
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 14
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- Object.ToolTipText = "打印页面设置"
- ImageIndex = 1
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- Object.ToolTipText = "打印当前单据或Ctrl+P"
- ImageIndex = 2
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- ImageIndex = 3
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "编辑"
- Key = "xg"
- Object.ToolTipText = "修改当前单据或F3"
- ImageIndex = 4
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh0"
- Style = 3
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "增行"
- Key = "zh"
- Description = "6"
- Object.ToolTipText = "插入一行或Insert"
- ImageIndex = 5
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "删行"
- Key = "sh"
- Object.ToolTipText = "删除当前记录行或Delete"
- ImageIndex = 6
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh1"
- Style = 3
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "保存"
- Key = "bc"
- Object.ToolTipText = "保存单据或F6"
- ImageIndex = 7
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "放弃"
- Key = "fq"
- Object.ToolTipText = "放弃此次操作"
- ImageIndex = 8
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Key = "fgh2"
- Style = 3
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageIndex = 9
- EndProperty
- BeginProperty Button14 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageIndex = 10
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Left = 9990
- TabIndex = 8
- Top = 0
- Width = 1695
- _ExtentX = 2990
- _ExtentY = 926
- ButtonWidth = 1455
- ButtonHeight = 926
- 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"
- ImageIndex = 11
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "默认列宽"
- Key = "hfmrgs"
- ImageIndex = 12
- EndProperty
- EndProperty
- End
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 7380
- Top = 960
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 13
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":3581A
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":35BB4
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":35F4E
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":362E8
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":36682
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":36A1C
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":36DB6
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":37150
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":374EA
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":37884
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":37C1E
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":37FB8
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "自动转帐凭证_自定义.frx":38352
- Key = "xsxm"
- EndProperty
- EndProperty
- End
- Begin VB.Label Lab_Pzclzt
- BackColor = &H0000FFFF&
- Caption = "2"
- ForeColor = &H00808080&
- Height = 322
- Left = 9012
- TabIndex = 2
- Top = 553
- Visible = 0 'False
- Width = 403
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 353
- Left = 8684
- TabIndex = 0
- Top = 553
- Visible = 0 'False
- Width = 343
- End
- Begin VB.Line Line1
- BorderColor = &H000000FF&
- Index = 0
- X1 = 4234
- X2 = 7211
- Y1 = 1108
- Y2 = 1108
- End
- Begin VB.Line Line1
- BorderColor = &H000000FF&
- Index = 1
- X1 = 4234
- X2 = 7211
- Y1 = 1153
- Y2 = 1153
- End
- End
- Attribute VB_Name = "AutoTran_DefiMy"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '*********************************************************************************************************
- '* 模 块 名 称 :自定义转帐凭证编辑
- '* 功 能 描 述 :此功能模块主要完成自动转帐凭证的录入、修改、删除、预览打印等。
- '* 程序员姓名 : 姜冬梅
- '* 最后修改人 : 姜冬梅
- '* 最后修改时间:2001/4/29
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '*
- '* 1.每次调入外部功能窗体,均要加锁ChangeLock=True,窗体关闭后解锁ChangeLock=false
- '*
- '* 2.网格列存储内容注解
- '*
- '* 3.Lab_OperStatus 用此标签来标识单据录入状态(默认值为1) "1"-浏览 "2"-新增 "3"-修改
- '*
- '* 4.Lab_Pzclzt 用此标签来标识凭证处理状态(默认值为1) "1"-填制凭证 "2"-查询凭证列表 "3"-审核凭证
- '*
- '* 5.原则:只要单据能够存盘(无论修改或新增)则其必须接受完整性及有效性规则检查
- '* 6.其他注解
- '* Bln_AssHelp(0) 个人编码
- '* Bln_AssHelp(1) 部门编码
- '* Bln_AssHelp(2) 项目编码
- '* Bln_AssHelp(3) 客户编码
- '* Bln_AssHelp(4) 供应商编码
- '* 索引对照
- '* 001摘要 002-转帐科目编码 003-转帐科目名称 004-转帐方向 005-转帐性质 006-来源科目
- '* 007-来源科目名称 008-来源数据项目 009-分配比例 010-辅助项目
- '*********************************************************************************************************
- '[以下为根据实际情况设置变量
- Dim Rec_AutoTranItem As New ADODB.Recordset '转帐项目动态集
- Dim Int_AssCount As Integer '辅助核算项目总数
- Dim Bln_AssShow() As Boolean '辅助核算项目是否显示
- Dim Bln_AssHelp() As Boolean '辅助核算项目是否有帮助
- Dim Str_Digest As String '最后录入的一条凭证分录的摘要内容
- Dim Bln_BillChange As Boolean '标识单据是否发生改动
- Dim Jsqte As Long '临时计数器
- Dim Sqlstr As String '临时的SQL字符串
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Help_Bz_Col() As Boolean '网格列不能编辑但是否需要帮助
- Dim Str_Memo As String '辅助核算信息
- Dim TranClassCode 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 Form_KeyPress(KeyAscii As Integer) '控 制 焦 点 转 移
- Dim jdzygs 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() '窗 体 装 入
- '初始化各种锁值
- Me.Top = (Screen.Height - Me.Height) / 2
- Me.Left = (Screen.Width - Me.Width) / 2
- TranClassCode = AutoTran_TranList.TranClassCode
- changelock = False '网格行列改变控制锁
- Gdtlock = False '滚动条滚动控制
- Yxxpdlock = True '字段有效性判断锁
- Hyxxpdlock = True '行有效性判断锁
- Wbkbhlock = False '文本框内容改变锁
- '[>>开始 设置辅助核算项目属性
- Int_AssCount = 5
- ReDim Bln_AssShow(Int_AssCount - 1)
- ReDim Bln_AssHelp(Int_AssCount - 1)
- Bln_AssHelp(0) = True '个人
- Bln_AssHelp(1) = True '部门
- Bln_AssHelp(2) = True '项目
- Bln_AssHelp(3) = True '客户
- Bln_AssHelp(4) = True '供应
- '完毕<<]
- '报表主标题及报表编码
- ReportTitle = "自定义转帐凭证"
- XtReportCode = "cwzz_AutoAccDefiMy"
- Load Dyymctbl
- '调 入 网 格
- GridCode = "cwzz_AutoAccDefiMy" '网格属性编码
- Call BzWgcsh(WglrGrid, 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 = WglrGrid.Cols - 1
- For Jsqte = WglrGrid.FixedRows To WglrGrid.Rows - 1
- WglrGrid.RowHeight(Jsqte) = Sjhgd
- Next Jsqte
- '[
- ReDim Help_Bz_Col(Szzls)
- For Jsqte = 1 To Szzls
- Help_Bz_Col(Jsqte) = False
- Next Jsqte
- Help_Bz_Col(Sydz("010", GridStr(), Szzls)) = True '辅助信息列不能编辑但需要帮助
- ']
- '单据变动置为False
- Bln_BillChange = False
- '装入会计科目编码帮助窗体(为加快参照速度)PZ_FrmKjkmcz
- Load PZ_FrmKjkmcz
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '卸载打印页面窗体
- Unload Dyymctbl
- '卸载会计科目编码参照窗体
- PZ_FrmKjkmcz.UnloadCheck.Value = 1
- Unload PZ_FrmKjkmcz
- '判断凭证是否发生变化
- If Bln_BillChange Then
- Xtfhcs = "1"
- Else
- Xtfhcs = "0"
- End If
- Set Rec_AutoTranItem = Nothing
- Set RecTemp = Nothing
- End Sub
- Private Sub WglrGrid_AfterUserResize(ByVal Row As Long, ByVal Col As Long)
- With WglrGrid
- If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 And Yd_Help.Visible = True Then
- Call Yd_Help_Show
- End If
- End With
- End Sub
- Private Sub Yd_Help_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
- If Not Yd_Help.Visible Then
- Exit Sub
- End If
- With WglrGrid
- Call Yd_Help_content
- End With
- WglrGrid.SetFocus
- End Sub
- Private Sub Timer1_Timer() '根据不同凭证或单据状态处理不同的数据初始化
- '关闭定时器
- Timer1.Enabled = False
- '调入数据初始化模块
- Call Sjcsh(Trim(1)) '读入转帐编码转帐名称转帐凭证类别
- End Sub
- Private Sub Sjcsh(Str_Pzclzt As String) '数据初始化模块(根据实际情况)
- Select Case Str_Pzclzt
- Case 1 '单据处于编辑状态
- With AutoTran_TranList.CzxsGrid
- Lbl_AutoAccCode.Caption = .Tag
- End With
- Sqlstr = "SELECT Cwzz_AutoTranMain.VouchClassCode, Cwzz_VouchClass.VouchClassName, " & _
- " Cwzz_AutoTranMain.TranName , Cwzz_AutoTranMain.TranCode FROM Cwzz_AutoTranMain " & _
- "left OUTER JOIN Cwzz_VouchClass ON " & _
- "Cwzz_VouchClass.VouchClassCode = Cwzz_AutoTranMain.VouchClassCode where TranCode='" & Lbl_AutoAccCode.Caption & "' and TranClass='" & TranClassCode & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Lbl_AutoAccName.Caption = Trim(RecTemp.Fields("TranName"))
- Lbl_AutoAccClassCode.Caption = Trim(RecTemp.Fields("VouchClassCode"))
- Lbl_AutoAccClassName.Caption = Trim(RecTemp.Fields("VouchClassName"))
- RecTemp.Close
- '设置操作状态为浏览
- Lab_OperStatus.Caption = "1"
- '设置工具条状态
- Call Sub_OperStatus("11")
- '显示整张单据信息
- Call Sub_ShowBill
- Call Sub_AdjustGrid
- Case 2 '单据处于浏览状态
- Case 3
- End Select
- End Sub
- Private Sub Sub_ShowBill() '根据当前单据号显示整张单据内容
- If RecTemp.State = 1 Then RecTemp.Close
- Sqlstr = "SELECT Cwzz_AutoTranItem.AutoTranID, Cwzz_AutoTranItem.TranCode," & _
- "Cwzz_AutoTranItem.Digest, Cwzz_AccCode.Cname, Cwzz_AutoTranItem.TranOri," & _
- "Cwzz_AutoTranItem.TranProp, Cwzz_AutoTranItem.PersonCode," & _
- "Gy_Person.PersonName, Cwzz_AutoTranItem.Suppliercode," & _
- "Gy_supplier.SupplierName, Cwzz_AutoTranItem.CusCode, Gy_Customer.CusName," & _
- "Cwzz_AutoTranItem.DeptCode, Gy_Department.DeptName," & _
- "Cwzz_AutoTranItem.ItemClassCode, Cwzz_ItemClass.ItemClassName," & _
- "Cwzz_AutoTranItem.ItemCode, Cwzz_Item.ItemName, Cwzz_Item.QuantityFlag," & _
- "Cwzz_AutoTranItem.GetCcode, Cwzz_AccCode1.Cname AS getname," & _
- "Cwzz_AccCode1.PersonFlag, Cwzz_AccCode1.CusFlag," & _
- "Cwzz_AccCode1.SupplierFlag, Cwzz_AccCode1.DeptFlag," & _
- "Cwzz_AutoTranItem.DistriProp, Cwzz_AutoTranItem.Formulastring," & _
- "cwzz_Formula.FormulaName, Cwzz_AutoTranItem.Ccode, Cwzz_AccCode.EndFlag," & _
- "Cwzz_AccCode1.ItemFlag , Cwzz_AutoTranItem.TranClass FROM Cwzz_AutoTranItem LEFT OUTER JOIN" & _
- " Cwzz_AccCode ON Cwzz_AutoTranItem.Ccode = Cwzz_AccCode.Ccode LEFT OUTER JOIN " & _
- "Cwzz_ItemClass ON Cwzz_AutoTranItem.ItemClassCode = Cwzz_ItemClass.ItemClassCode LEFT OUTER JOIN " & _
- "Cwzz_Item ON Cwzz_AutoTranItem.ItemClassCode = Cwzz_Item.ItemClassCode AND " & _
- "Cwzz_AutoTranItem.ItemCode = Cwzz_Item.ItemCode LEFT OUTER JOIN" & _
- " cwzz_Formula ON Cwzz_AutoTranItem.FormulaCode = cwzz_Formula.FormulaCode LEFT OUTER JOIN" & _
- " Gy_Department ON Cwzz_AutoTranItem.DeptCode = Gy_Department.DeptCode " & _
- " LEFT OUTER JOIN Gy_supplier ON Cwzz_AutoTranItem.Suppliercode = Gy_supplier.SupplierCode " & _
- " LEFT OUTER JOIN Gy_Person ON Cwzz_AutoTranItem.PersonCode = Gy_Person.PersonCode" & _
- " LEFT OUTER JOIN Gy_Customer ON Cwzz_AutoTranItem.CusCode = Gy_Customer.CusCode " & _
- " LEFT OUTER JOIN Cwzz_AccCode Cwzz_AccCode1 ON Cwzz_AutoTranItem.GetCcode = Cwzz_AccCode1.Ccode" & _
- " where TranCode='" & Lbl_AutoAccCode.Caption & "' and tranclass='" & TranClassCode & "' order by AutoTranId"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- WglrGrid.Clear 1
- If .EOF Then
- Exit Sub
- Else
- WglrGrid.Rows = .RecordCount + WglrGrid.FixedRows
- '[>>显示单据头
- Jsqte = WglrGrid.FixedRows
- Do While Not .EOF
- If Jsqte >= WglrGrid.Rows Then
- WglrGrid.AddItem ""
- End If
- '[>>显示单据分录
- WglrGrid.TextMatrix(Jsqte, 0) = "*" '行标识
- WglrGrid.TextMatrix(Jsqte, 1) = Trim(.Fields("PersonCode") & "") '个人编码
- WglrGrid.TextMatrix(Jsqte, 2) = Trim(.Fields("PersonName") & "") '个人名称
- WglrGrid.TextMatrix(Jsqte, 3) = Trim(.Fields("DeptCode") & "") '部门编码
- WglrGrid.TextMatrix(Jsqte, 4) = Trim(.Fields("DeptName") & "") '部门名称
- WglrGrid.TextMatrix(Jsqte, 5) = Trim(.Fields("CusCode") & "") '客户编码
- WglrGrid.TextMatrix(Jsqte, 6) = Trim(.Fields("CusName") & "") '客户名称
- WglrGrid.TextMatrix(Jsqte, 7) = Trim(.Fields("Suppliercode") & "") '供应商编码
- WglrGrid.TextMatrix(Jsqte, 8) = Trim(.Fields("SupplierName") & "") '供应商名称
- WglrGrid.TextMatrix(Jsqte, 9) = Trim(.Fields("ItemClassCode") & "") '项目类别编码
- WglrGrid.TextMatrix(Jsqte, 10) = Trim(.Fields("ItemClassName") & "") '项目类别名称
- WglrGrid.TextMatrix(Jsqte, 11) = Trim(.Fields("ItemCode") & "") '项目编码
- WglrGrid.TextMatrix(Jsqte, 12) = Trim(.Fields("ItemName") & "") '项目名称
- WglrGrid.TextMatrix(Jsqte, Sydz("001", GridStr(), Szzls)) = Trim(.Fields("Digest") & "") '摘 要
- WglrGrid.TextMatrix(Jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("Ccode")) '科目编码
- WglrGrid.TextMatrix(Jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("Cname") & "") '科目名称
- WglrGrid.TextMatrix(Jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("TranOri")) '转帐方向
- WglrGrid.TextMatrix(Jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("TranProp")) '转帐性质
- WglrGrid.TextMatrix(Jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("FormulaString") & "") '公式串
- Call Sub_ShowMemo(Jsqte)
- WglrGrid.TextMatrix(Jsqte, Sydz("007", GridStr(), Szzls)) = Str_Memo
- '<<]
- WglrGrid.RowHeight(Jsqte) = Sjhgd
- .MoveNext
- Jsqte = Jsqte + 1
- Loop
- End If
- End With
- RecTemp.Close
- '调整网格,保持1录入行,提供屏幕保持行数.
- Call Sub_AdjustGrid
- End Sub
- Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button) '用户点击工具条
- '屏蔽文本框,下拉组合框有效性判断,即在网格单元内录入数据时,点帮助信息等,不执行文本框等验证,即不执行YdText或YdCombo的LostFocus事件.
- Valilock = True
- '屏蔽网格失去焦点产生的有效性判断
- changelock = True
- Select Case Button.Key
- Case "ymsz" '页面设置
- Dyymctbl.Show 1
- Case "yl" '预 览
- If Fun_Drfrmyxxpd Then Call bbyl(True)
- Case "dy" '打 印
- If Fun_Drfrmyxxpd Then Call bbyl(False)
- Case "xg" '修 改
- Call Sub_EditBill
- Case "zh" '增 行
- Call zjlrfl
- Case "sh" '删 行
- Call Scdqfl
- Case "bc" '保 存
- If Fun_Drfrmyxxpd Then Call Sub_SaveBill
- Case "fq" '放 弃
- Call Sub_AbandonBill
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- Unload Me
- End Select
- '解 锁
- Valilock = False
- changelock = False
- End Sub
- Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '支持热键操作,更确切地讲,是工具栏热键
- If Shift = 2 Then 'Ctrl的位屏蔽值=2
- Select Case UCase(Chr(KeyCode))
- Case "P" 'Ctrl+P 打印
- If Tlb_Action.Buttons("dy").Enabled Then Call bbyl(False)
- End Select
- End If
- Select Case KeyCode
- Case vbKeyF3 '修改凭证
- If Tlb_Action.Buttons("xg").Enabled Then
- Call Sub_EditBill
- End If
- Case vbKeyF6 '保存凭证
- If Tlb_Action.Buttons("bc").Enabled Then
- Call Sub_SaveBill
- End If
- End Select
- End Sub
- Private Sub Sub_OperStatus(Str_Status As String) '工具条依据不同状态所进行的变化
- With Tlb_Action
- Select Case Str_Status
- Case "10" '浏览(系统进入、放弃新增单据、填制凭证时删除单据,凭证审核)
- '工具条
- .Buttons("dy").Enabled = True '打印
- .Buttons("yl").Enabled = True '预览
- .Buttons("xg").Enabled = False '修改
- .Buttons("zh").Enabled = False '增行
- .Buttons("sh").Enabled = False '删行
- .Buttons("cx").Enabled = True '查询
- .Buttons("bc").Enabled = False '保存
- .Buttons("fq").Enabled = False '放弃
- Case "11" '浏览(放弃修改单据,查询单据)
- '工具条
- .Buttons("dy").Enabled = True '打印
- .Buttons("yl").Enabled = True '预览
- .Buttons("xg").Enabled = True '修改
- .Buttons("zh").Enabled = False '增行
- .Buttons("sh").Enabled = False '删行
- .Buttons("bc").Enabled = False '保存
- .Buttons("fq").Enabled = False '放弃
- Case "30" '修改
- '工具条
- .Buttons("dy").Enabled = False '打印
- .Buttons("yl").Enabled = False '预览
- .Buttons("xg").Enabled = False '修改
- .Buttons("zh").Enabled = True '增行
- .Buttons("sh").Enabled = True '删行
- .Buttons("bc").Enabled = True '保存
- .Buttons("fq").Enabled = True '放弃
- End Select
- End With
- End Sub
- Private Sub xswbk() '在当前选中单元显示文本框,列表框,帮助按钮(通用)
- Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then Exit Sub
- '显示文本框前返回有效行列(解决滚动条问题)
- Call Xldqh
- Call Xldql
- '隐藏文本框,帮助按钮,列表组合框
- Call Ycwbk
- With WglrGrid
- 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
- Yd_Help.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
- If Ydtext.Enabled Then Ydtext.SetFocus
- End If
- Dqtoprow = .TopRow
- Dqleftcol = .LeftCol
- '重置锁值
- Valilock = False
- Wbkbhlock = False
- End With
- End Sub
- Private Sub Lrsjhx() '文本框录入数据回写
- With WglrGrid
- 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 Sub Wbkcl() '文本框录入之前处理(根据实际情况)
- Dim xswbrr As String
- With WglrGrid
- 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 Function sjzdyxxpd(Dqpdwgh As Long, Dqpdwgl As Long) '录入数据字段有效性判断,同时进行字段录入事后处理
- Dim Str_JudgeText As String '临时有效性判断字段内容
- Dim Coljsq As Long '临时列计数器
- With WglrGrid
- '非录入状态有效性为合法
- 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 "005" '转帐性质
- If Len(Str_JudgeText) <> 0 Then
- If Str_JudgeText <> "转入" And Str_JudgeText <> "转出" Then
- Tsxx = "转帐方向必须选择“转入”或“转出”"
- GoTo Lrcwcl
- End If
- End If
- Case "001" '凭证摘要(如用户录入编码正确,则自动调入摘要内容)
- If Len(Str_JudgeText) <> 0 Then
- Sqlstr = "SELECT * FROM Cwzz_Digest Where DigestCode='" & Str_JudgeText & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- If Not RecTemp.EOF Then
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls)) = Trim(RecTemp.Fields("DigestText"))
- End If
- '保存最后录入的一条凭证分录的摘要内容
- Str_Digest = WglrGrid.TextMatrix(Dqpdwgh, Sydz("001", GridStr(), Szzls))
- End If
- Case "002"
- If Len(Str_JudgeText) <> 0 Then
- Sqlstr = "Select Cwzz_AccCode.* ,ItemClassName FROM Cwzz_AccCode " & _
- " LEFT OUTER JOIN Cwzz_ItemClass ON Cwzz_AccCode.ItemClassCode = Cwzz_ItemClass.ItemClassCode " & _
- " Where Ccode='" & Str_JudgeText & "' OR AssCode='" & Str_JudgeText & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If .EOF Then
- Tsxx = "此科目不存在!"
- GoTo Lrcwcl
- Else
- If Not .Fields("EndFlag") Then
- Tsxx = "此科目非末级科目!"
- GoTo Lrcwcl
- End If
- If .Fields("StopFlag") Then
- Tsxx = "此科目已停用!"
- GoTo Lrcwcl
- End If
- '如果此科目存在且改变过则执行下列操作
- '1.显示科目编码,改变科目名称
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("002", GridStr(), Szzls)) = Trim(RecTemp.Fields("Ccode"))
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = Trim(RecTemp.Fields("Cname"))
- WglrGrid.TextMatrix(Dqpdwgh, 9) = Trim(RecTemp.Fields("ItemClassCode") & "")
- WglrGrid.TextMatrix(Dqpdwgh, 10) = Trim(RecTemp.Fields("ItemClassName") & "")
- Call Sub_Drfzhsx(Dqpdwgh, Str_JudgeText)
- End If
- End With
- Else
- '清除所有辅助核算内容
- For Jsqte = 1 To 12
- WglrGrid.TextMatrix(Dqpdwgh, Jsqte) = ""
- Next Jsqte
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("003", GridStr(), Szzls)) = ""
- End If
- Case "006" '来源科目
- If Len(Str_JudgeText) <> 0 Then
- Sqlstr = "Select Cwzz_AccCode.* ,ItemClassName FROM Cwzz_AccCode " & _
- " LEFT OUTER JOIN Cwzz_ItemClass ON Cwzz_AccCode.ItemClassCode = Cwzz_ItemClass.ItemClassCode " & _
- " Where Ccode='" & Str_JudgeText & "' OR AssCode='" & Str_JudgeText & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If .EOF Then
- Tsxx = "此科目不存在!"
- GoTo Lrcwcl
- Else
- If .Fields("StopFlag") Then
- Tsxx = "此科目已停用"
- GoTo Lrcwcl
- End If
- End If
- '如果此科目存在且改变过则执行下列操作
- '1.显示科目编码,改变科目名称
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("006", GridStr(), Szzls)) = Trim(RecTemp.Fields("Ccode"))
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = Trim(RecTemp.Fields("Cname"))
- End With
- Else
- '清除所有内容
- If GridStr(Dqpdwgl, 1) = "006" Then
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("007", GridStr(), Szzls)) = ""
- End If
- End If
- Case "004" '转帐方向
- If Len(Str_JudgeText) <> 0 Then
- If Str_JudgeText <> "借" And Str_JudgeText <> "贷" Then
- Tsxx = "转帐方向必须选择“借”或“贷”"
- GoTo Lrcwcl
- End If
- End If
- Case "008" '来源数据项
- If Len(Str_JudgeText) <> 0 Then
- Sqlstr = "Select * from Cwzz_Formula where Formulacode='" & Str_JudgeText & "' OR FormulaName='" & Str_JudgeText & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- If .EOF Then
- Tsxx = "此取数项目不存在!"
- GoTo Lrcwcl
- End If
- End With
- '2.放置字段事后处理程序
- WglrGrid.TextMatrix(Dqpdwgh, 13) = RecTemp.Fields("FormulaCode")
- '以上为自定义部分]
- End If
- End Select
- '根据转帐性质,判断按转帐科目号取项目大类还是按来源科目取项目大类
- '字段录入正确后为零字段清空
- Call Qkwlzd(Dqpdwgh, Dqpdwgl)
- sjzdyxxpd = True
- Yxxpdlock = True
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts(Tsxx, 0, 1)
- changelock = True
- .Select Dqpdwgh, Dqpdwgl
- If GridBoolean(.Col, 1) = True Then
- changelock = False
- Call xswbk
- sjzdyxxpd = False
- Else
- If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- End If
- End If
- End With
- Exit Function
- End Function
- Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean '录入数据行有效性判断,同时进行行处理
- Dim Lrywlz As Long
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Bln_AssVali As Boolean '辅助核算错误
- Dim Bj As Boolean '辅助项有效性标志
- With WglrGrid
- '判断行是否为空和无效数据行清除
- 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
- If Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("006", GridStr(), Szzls))) = "" Then
- Tsxx = "自定义公式不能为空!"
- GoTo Lrcwcl
- End If
- '判断辅助核算项目是否已填写,且有效
- If Trim(WglrGrid.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))) <> "" Then
- Sqlstr = "Select * FROM Cwzz_AccCode Where Ccode='" & Trim(.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))) & "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Lrywlz = Sydz("002", GridStr(), Szzls)
- If Not RecTemp.EOF Then
- '部门核算则部门不能为空,且有效
- If RecTemp.Fields("DeptFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Yxxpdh, 3))) = 0 Then
- Tsxx = "该转帐科目需要部门核算,部门项不能为空!"
- Bln_AssVali = True
- GoTo Lrcwcl
- End If
- Else
- .TextMatrix(Yxxpdh, 3) = ""
- .TextMatrix(Yxxpdh, 4) = ""
- End If
- '客户单位核算则往来单位不能为空,且有效
- If RecTemp.Fields("CusFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Yxxpdh, 5))) = 0 Then
- Tsxx = "该转帐科目需要客户单位核算,客户单位项不能为空!"
- Bln_AssVali = True
- GoTo Lrcwcl
- End If
- Else
- .TextMatrix(Yxxpdh, 5) = ""
- .TextMatrix(Yxxpdh, 6) = ""
- End If
- '供应商单位核算则供应商单位不能为空
- If RecTemp.Fields("SupplierFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Yxxpdh, 7))) = 0 Then
- Tsxx = "该转帐科目需要供应商单位核算,供应商单位项不能为空!"
- Bln_AssVali = True
- GoTo Lrcwcl
- End If
- Else
- .TextMatrix(Yxxpdh, 7) = ""
- .TextMatrix(Yxxpdh, 8) = ""
- End If
- '个人往来核算则个人项不能为空
- If RecTemp.Fields("PersonFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Yxxpdh, 1))) = 0 Then
- Tsxx = "该转帐科目需要个人往来核算,个人项不能为空!"
- Bln_AssVali = True
- GoTo Lrcwcl
- End If
- Else
- .TextMatrix(Yxxpdh, 1) = ""
- .TextMatrix(Yxxpdh, 2) = ""
- End If
- '项目核算则项目不能为空
- If RecTemp.Fields("ItemFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Yxxpdh, 11))) = 0 Then
- Tsxx = "该转帐科目需要项目核算,核算项目不能为空!"
- Bln_AssVali = True
- GoTo Lrcwcl
- End If
- Else
- .TextMatrix(Yxxpdh, 11) = ""
- .TextMatrix(Yxxpdh, 12) = ""
- End If
- End If
- End If
- '2.放置行处理程序
- '以上为自定义部分]
- End With
- Sjhzyxxpd = True
- Hyxxpdlock = True
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts(Tsxx, 0, 1)
- changelock = True
- .Select Yxxpdh, Lrywlz
- changelock = False
- '[>>如果辅助核算出现错误则调用辅助核算功能
- If Bln_AssVali Then
- Call Sub_Drfzhsx(Yxxpdh, Trim(.TextMatrix(Yxxpdh, Sydz("002", GridStr(), Szzls))))
- '解决鼠标点击取消造成的换行
- changelock = True
- .Select Yxxpdh, Lrywlz
- changelock = False
- '<<]
- Else
- Call xswbk
- End If
- Sjhzyxxpd = False
- Exit Function
- End With
- End Function
- Private Sub Yd_Help_content() '点击辅助核算信息列
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then Exit Sub
- '当科目编码处于录入状态时不能调入辅助核算项目
- If Ydtext.Visible Then Exit Sub
- '当焦点处于非录入区域时也不能调入辅助核算项目
- If WglrGrid.Row < WglrGrid.FixedRows Then Exit Sub
- If Yd_Help.Visible = False Then Exit Sub
- '屏蔽文本框,下拉组合框有效性判断
- Valilock = True
- With WglrGrid
- If Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))) = "" Then
- Tsxx = "请录入转帐科目!"
- Call Xtxxts(Tsxx, 0, 1)
- Else
- Call Sub_Drfzhsx(.Row, Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))))
- End If
- End With
- Valilock = False
- End Sub
- Private Sub Sub_Drfzhsx(Dqpdwgh As Long, Str_JudgeText As String) '判断科目是否有辅助核算,如有则调入辅助核算窗体
- '函数参数:当前判断网格行,判断科目
- Dim Coljsq As Long '临时列计数器
- Dim jsq As Integer '记录有效辅助信息个数
- '首先进行必要输入项目的判断
- If Len(Str_JudgeText) <> 0 Then
- Sqlstr = "Select Cwzz_AccCode.* ,ItemClassName FROM Cwzz_AccCode " & _
- " LEFT OUTER JOIN Cwzz_ItemClass ON Cwzz_AccCode.ItemClassCode = Cwzz_ItemClass.ItemClassCode " & _
- " Where Ccode='" + Str_JudgeText + "' and EndFlag=1"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- With RecTemp
- '判断科目进行哪些辅助核算
- '清空辅助核算标识
- For Jsqte = 0 To Int_AssCount - 1
- Bln_AssShow(Jsqte) = False
- Next Jsqte
- If .EOF Then
- WglrGrid.TextMatrix(Dqpdwgh, 1) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 2) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 3) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 4) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 5) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 6) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 7) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 8) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 9) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 10) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 11) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 12) = ""
- Tsxx = "该转帐科目没有辅助核算信息"
- Call Xtxxts(Tsxx, 0, 4)
- Else
- If RecTemp.Fields("StopFlag") = True Then
- Tsxx = "该科目已停用!"
- Call Xtxxts(Tsxx, 0, 4)
- Exit Sub
- End If
- '个人核算
- If RecTemp.Fields("PersonFlag") Then
- Bln_AssShow(0) = True '个人
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 1) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 2) = ""
- End If
- '部门核算
- If RecTemp.Fields("DeptFlag") Then
- Bln_AssShow(1) = True '部门
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 3) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 4) = ""
- End If
- '客户核算
- If RecTemp.Fields("CusFlag") Then
- Bln_AssShow(3) = True '客户是否需要帮助的标志
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 5) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 6) = ""
- End If
- '供应商核算
- If RecTemp.Fields("SupplierFlag") Then
- Bln_AssShow(4) = True '供应商是否需要帮助的标志
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 7) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 8) = ""
- End If
- '项目核算
- If RecTemp.Fields("ItemFlag") Then
- If WglrGrid.TextMatrix(Dqpdwgh, 9) <> Trim(.Fields("ItemClassCode") & "") Then '项目类别编码与数据表中不符
- WglrGrid.TextMatrix(Dqpdwgh, 9) = "" '项目类别编码、名称、项目编码、名称均为空
- WglrGrid.TextMatrix(Dqpdwgh, 10) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 11) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 12) = ""
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 9) = Trim(.Fields("ItemClassCode") & "") '项目类别编码
- WglrGrid.TextMatrix(Dqpdwgh, 10) = Trim(.Fields("ItemClassName") & "") '项目类别名称
- Bln_AssShow(2) = True '项目是否需要帮助的标志
- End If
- Else
- WglrGrid.TextMatrix(Dqpdwgh, 9) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 10) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 11) = ""
- WglrGrid.TextMatrix(Dqpdwgh, 12) = ""
- End If
- '是否存在帮助信息
- jsq = 0
- For Jsqte = 0 To Int_AssCount - 1
- If Bln_AssShow(Jsqte) = True Then
- jsq = jsq + 1
- End If
- Next Jsqte
- If jsq <> 0 Then
- '调入科目辅助核算项目
- For Jsqte = 0 To Int_AssCount - 1
- If Bln_AssShow(Jsqte) Then
- PZ_FrmAss.lab_GridRow = Dqpdwgh
- Call Kmfzhsx(Dqpdwgh)
- End If
- Next Jsqte
- End If
- End If
- '重新显示辅助核算信息
- Call Sub_ShowMemo(WglrGrid.Row)
- WglrGrid.TextMatrix(Dqpdwgh, Sydz("010", GridStr(), Szzls)) = Str_Memo
- End With
- End If
- End Sub
- Private Sub Kmfzhsx(Lng_GridRow As Long) '调用科目辅助核算项
- '过程函数;Lng_gridrow当前网格调入辅助核算行
- Dim Kjqstop#, Kjqsleft#, Kjjg#, Ctzxgd#, Kjxsgs%
- Kjqstop = 300 '控件显示起始高度
- Kjqsleft = 300 '控件显示起始左边界
- Kjjg = 360 '控件显示间隔
- Kjxsgs = 0 '控件显示个数
- Ctzxgd = 1500 '窗体显示最小高度
- With AutoTran_AssMy '辅助核算项目窗体
- For Jsqte = 0 To Int_AssCount - 1
- If Bln_AssShow(Jsqte) Then
- .tsLabel(Jsqte).Visible = True
- .tsLabel(Jsqte).Move Kjqsleft, Kjqstop + Kjxsgs * Kjjg
- .LrText(Jsqte).Visible = True
- .LrText(Jsqte).Move .tsLabel(Jsqte).Left + .tsLabel(Jsqte).Width + 50, .tsLabel(Jsqte).Top - 100
- If Bln_AssHelp(Jsqte) Then
- .Ydcommand1(Jsqte).Visible = True
- .Ydcommand1(Jsqte).Move .LrText(Jsqte).Left + .LrText(Jsqte).Width, .LrText(Jsqte).Top, .Ydcommand1(Jsqte).Width, .LrText(Jsqte).Height
- End If
- Kjxsgs = Kjxsgs + 1
- Select Case Jsqte
- Case 0 '个人
- .LrText(Jsqte).Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 1))
- .LrText(Jsqte).Text = Trim(WglrGrid.TextMatrix(Lng_GridRow, 2))
- Case 1 '部门
- .LrText(Jsqte).Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 3))
- .LrText(Jsqte).Text = Trim(WglrGrid.TextMatrix(Lng_GridRow, 4))
- Case 3 '客户
- .LrText(Jsqte).Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 5))
- .LrText(Jsqte).Text = Trim(WglrGrid.TextMatrix(Lng_GridRow, 6))
- Case 4 '供应商
- .LrText(Jsqte).Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 7))
- .LrText(Jsqte).Text = Trim(WglrGrid.TextMatrix(Lng_GridRow, 8))
- Case 2 '项目
- .Lab_ItemClass.Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 9))
- .Lab_ItemClass.Caption = "(" + Trim(WglrGrid.TextMatrix(Lng_GridRow, 10)) + ")"
- .Lab_ItemClass.Move .LrText(Jsqte).Left + .LrText(Jsqte).Width + 400, .LrText(Jsqte).Top + 80
- .LrText(Jsqte).Tag = Trim(WglrGrid.TextMatrix(Lng_GridRow, 11))
- .LrText(Jsqte).Text = Trim(WglrGrid.TextMatrix(Lng_GridRow, 12))
- End Select
- Else
- .tsLabel(Jsqte).Visible = False
- .LrText(Jsqte).Visible = False
- If Bln_AssHelp(Jsqte) Then
- .Ydcommand1(Jsqte).Visible = False
- End If
- End If
- Next Jsqte
- If Kjqstop * 3 + Kjxsgs * Kjjg > Ctzxgd Then
- .Height = Kjqstop * 3 + Kjxsgs * Kjjg + 100
- Else
- .Height = Ctzxgd
- End If
- .BcCommand.Top = .Top + .Height - 750
- .QxCommand.Top = .Top + .Height - 750
- '加锁
- changelock = True
- .Show 1
- changelock = False
- End With
- End Sub
- Private Sub Sub_ShowMemo(Lng_GridRow) '显示网格备注项
- '函数参数:网格行
- Str_Memo = ""
- With WglrGrid
- If Len(Trim(.TextMatrix(Lng_GridRow, 1))) <> 0 Then
- Str_Memo = Str_Memo + Trim(.TextMatrix(Lng_GridRow, 2)) + Space(2)
- End If
- If Len(Trim(.TextMatrix(Lng_GridRow, 3))) <> 0 Then
- Str_Memo = Str_Memo + Trim(.TextMatrix(Lng_GridRow, 4)) + Space(2)
- End If
- If Len(Trim(.TextMatrix(Lng_GridRow, 5))) <> 0 Then
- Str_Memo = Str_Memo + Trim(.TextMatrix(Lng_GridRow, 6)) + Space(2)
- End If
- If Val(.TextMatrix(Lng_GridRow, 7)) <> 0 Then
- Str_Memo = Str_Memo + Trim(.TextMatrix(Lng_GridRow, 8)) + Space(2)
- End If
- If Len(Trim(.TextMatrix(Lng_GridRow, 11))) <> 0 Then
- Str_Memo = Str_Memo + Trim(.TextMatrix(Lng_GridRow, 12)) + Space(2)
- End If
- End With
- End Sub
- Private Sub Sub_EditBill() '修改一张单据
- '判断当前凭证是否允许修改
- If Not Fun_AllowEdit Then
- Exit Sub
- End If
- '设置操作状态为修改
- Lab_OperStatus.Caption = "3"
- '设置工具条状态
- Call Sub_OperStatus("30")
- End Sub
- Private Sub Sub_AbandonBill() '放弃对当前单据的操作
- '先关闭录入载体
- changelock = True
- Valilock = True
- Call Ycwbk
- changelock = False
- Valilock = False
- Yd_Help.Visible = False
- Select Case Trim(Lab_OperStatus.Caption)
- Case "3" '修改状态
- '重新显示当前单据
- Call Sub_ShowBill
- '设置操作状态为浏览
- Lab_OperStatus = "1"
- Call Sub_OperStatus("11")
- End Select
- End Sub
- Private Function Fun_AllowEdit() As Boolean '判断当前定义是否允许编辑或删除
- Fun_AllowEdit = True
- End Function
- '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改======================='
- Private Sub Sub_AdjustGrid()
- '调 整 网 格
- With WglrGrid
- '加 1 保持一行录入行
- If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
- .Rows = Pmbcsjhs + .FixedRows + Fzxwghs + 1
- For Jsqte = .FixedRows To .Rows - 1
- .RowHeight(Jsqte) = Sjhgd
- Next Jsqte
- Else
- '判断是否有辅助行和录入行,如没有则加行
- Do While .TextMatrix(.Rows - 1 - Fzxwghs, 0) = "*"
- .AddItem ""
- .RowHeight(.Rows - 1) = Sjhgd
- Loop
- End If
- End With
- End Sub
- Private Sub Lrzdbz() '录入字段帮助
- If Not Ydcommand.Visible Then
- Exit Sub
- End If
- Valilock = True '为防止按ydText中帮助按纽时,引起ydText的LostFocus事件。
- With WglrGrid
- '[>>会计科目编码帮助单独处理
- Select Case .Col
- Case Sydz("002", GridStr(), Szzls), Sydz("006", GridStr(), Szzls)
- Xtcdcs = Trim(Ydtext.Text)
- PZ_FrmKjkmcz.Show 1
- If Len(Xtfhcs) <> 0 Then
- Ydtext.Text = Xtfhcs
- End If
- Case Sydz("010", GridStr(), Szzls)
- AutoTran_AssMy.Show 1
- 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
- If Ydtext.Enabled Then Ydtext.SetFocus
- End If
- End With
- End Sub
- Private Sub Form_Resize() '窗体大小发生变化时,重新显示文本框
- Call Cxxswbk
- End Sub
- Private Function Fun_Drfrmyxxpd() As Boolean '调入其它窗体或功能产生的有效性判断(包括数据回写)
- '因为点工具栏的按纽时文本框或网格均没有失去焦点事件发生,为保证该操作之前进行录入数据的有效性判断而设。
- Fun_Drfrmyxxpd = True
- With WglrGrid
- '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
- If Yd_Help.Visible = True Then
- Yd_Help.Visible = False
- End If
- 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 WglrGrid_EnterCell() '显示当前数据行相关信息
- With WglrGrid
- If .Row >= .FixedRows Then
- Lab_Row = Trim(Str(.Row - .FixedRows + 1))
- End If
- End With
- End Sub
- Private Sub WglrGrid_GotFocus() '网格得到焦点
- '网格得到焦点,如果当前选择行为非数据行
- '则调整当前焦点至有效数据行
- With WglrGrid
- 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
- If .Row >= .FixedRows And Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- End If
- End With
- End Sub
- Private Sub WglrGrid_KeyUp(KeyCode As Integer, Shift As Integer)
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then
- Exit Sub
- End If
- If Help_Bz_Col(WglrGrid.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- Else
- Yd_Help.Visible = False
- End If
- End Sub
- Private Sub WglrGrid_LostFocus() '录入网格失去焦点
- '网格内部原因:网格单元内需要录入信息过程中,(程序控制)本单元内的文本框或下拉列表框显露并获得焦点时引发该事件发生;
- '网格外部原因:网格之外的控件获得焦点造成网格失去焦点,比如网格外的文本框。
- '用以屏蔽调用其它窗体时发生网格失去焦点事件
- If changelock Then
- Exit Sub
- End If
- '在每个单元输入均合法,但整行输入有可能不合法,在文本框不可编辑状态,这时网格外的某控件获得焦点时,网格失去焦点,必须人为引发RowColChange事件
- '故意引发网格RowcolChange事件
- With WglrGrid
- If Not (Ydtext.Visible Or YdCombo.Visible) Then
- .Select 0, 0
- End If
- End With
- End Sub
- Private Sub WglrGrid_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 WglrGrid
- If Ydtext.Visible Or YdCombo.Visible Or Yd_Help.Visible = True Then
- Gdtlock = True
- .TopRow = Dqtoprow
- .LeftCol = Dqleftcol
- Gdtlock = False
- Exit Sub
- End If
- End With
- End Sub
- Private Sub WglrGrid_LeaveCell() '离开单元格
- If changelock Then
- Exit Sub
- End If
- '记录刚刚离开网格单元的行列值
- Dqlkwgh = WglrGrid.Row
- Dqlkwgl = WglrGrid.Col
- '判断是否需要录入数据回写
- If Help_Bz_Col(WglrGrid.Col) = True Then
- Yd_Help.Visible = False
- End If
- If Not (Ydtext.Visible Or YdCombo.Visible) Then
- Exit Sub
- End If
- Call Lrsjhx
- End Sub
- Private Sub WglrGrid_RowColChange() '网格录入行列发生变化时,进行有效性判断
- Valilock = True '屏蔽文本框失去焦点进行有效性判断
- With WglrGrid
- 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 WglrGrid_DblClick() '鼠标双击网格显示文本框
- Dim CurrentRow As Integer
- Dim CurrentCol As Integer
- If Lab_OperStatus.Caption = "3" Then
- With WglrGrid
- If .Col = Sydz("006", GridStr(), Szzls) Then
- CurrentRow = .Row
- CurrentCol = .Col
- Glo_FormulaString = WglrGrid.TextMatrix(.Row, .Col)
- AutoTran_FormulaGen.Show 1
- .Row = CurrentRow
- .Col = CurrentCol
- .TextMatrix(.Row, .Col) = Glo_FormulaString
- End If
- End With
- End If
- With WglrGrid
- If GridBoolean(.Col, 1) = True Then
- Call xswbk
- Else
- If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- End If
- End If
- End With
- End Sub
- Private Sub Ycwbk() '隐藏文本框,帮助按钮,列表组合框
- Valilock = True
- Ydtext.Visible = False
- YdCombo.Visible = False
- Ydcommand.Visible = False
- End Sub
- Private Sub YdCombo_KeyDown(KeyCode As Integer, Shift As Integer) '列表框的光标移动
- With WglrGrid
- Select Case KeyCode
- Case vbKeyEscape 'ESC 键放弃录入
- Valilock = True
- .SetFocus
- Call Ycwbk
- Valilock = False
- 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) And Help_Bz_Col(Coljsq) = False) 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
- Case vbKeyLeft '左 箭 头 =37
- If .Col - 1 = Qslz Then
- If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
- GoTo jzzx
- End If
- End If
- If .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) And Help_Bz_Col(Coljsq) = False) Then
- Coljsq = Coljsq - 1
- Else
- Exit Do
- End If
- Loop
- .Select .Row, Coljsq
- End If
- Case vbKeyRight '右 箭 头 =39
- 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) And Help_Bz_Col(Coljsq) = False) 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
- Case Else
- End Select
- End With
- jzzx:
- End Sub
- Private Sub YdCombo_LostFocus() '下拉列表框失去焦点
- With WglrGrid '因为选中网格会先发生Rowcolchange事件置Valiock
- If Not Valilock Then '为TRUE
- Call Lrsjhx
- If Not Sjhzyxxpd(Dqlrwgh) Then
- Exit Sub
- End If
- End If
- End With
- End Sub
- Private Sub Ydcommand_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
- Call Lrzdbz
- End Sub
- Private Sub ydtext_KeyDown(KeyCode As Integer, Shift As Integer) '录入文本框的焦点发生移动或特殊击键动作,回车、帮助、ESC键、上下左右箭头
- Dim Rowjsq As Long, Coljsq As Long
- With WglrGrid
- 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) And Help_Bz_Col(Coljsq) = False) 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
- 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) And Help_Bz_Col(Coljsq) = False) 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) And Help_Bz_Col(Coljsq) = False) 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(WglrGrid.Col, 1), KeyAscii) '参数:文本框控件,字段数据类型,输入字符
- If KeyAscii <> 0 Then
- Call Xyxhbz(Dqlrwgh)
- End If
- End Sub
- Private Sub ydtext_Change() '录入事中变化处理
- '防止程序改变但不进行处理
- If Wbkbhlock Then
- Exit Sub
- End If
- With WglrGrid
- '限制字段录入长度
- Wbkbhlock = True
- Select Case GridInt(.Col, 1)
- Case 8
- Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9
- 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_LostFocus() '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
- With WglrGrid
- If Valilock = False Then
- Call Lrsjhx
- If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then Exit Sub
- If Not Sjhzyxxpd(Dqlrwgh) Then
- Exit Sub
- End If
- End If
- End With
- End Sub
- Private Sub WglrGrid_KeyDown(KeyCode As Integer, Shift As Integer) '网格录入在录入状态下的增行,删行快捷键
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then
- Exit Sub
- End If
- Select Case KeyCode
- Case vbKeyDelete '删行
- Call Scdqfl
- Case vbKeyInsert '增行
- Call zjlrfl
- Case vbKeyF2
- If Help_Bz_Col(WglrGrid.Col) = True Then
- If GridStr(WglrGrid.Col, 1) = "010" Then
- Call Yd_Help_content
- End If
- End If
- End Select
- End Sub
- Private Sub WglrGrid_KeyPress(KeyAscii As Integer) '网格接受键盘录入
- Dim Str_ChangeTe As String '临时交换内容
- Dim Coljsq As Long '临时列计数器
- Dim Int_SaveKey As Integer '保存KeyAscii值
- '如果单据操作状态为浏览状态则不能显示录入载体
- If Trim(Lab_OperStatus.Caption) = "1" Then Exit Sub
- Int_SaveKey = KeyAscii
- With WglrGrid
- '屏 蔽 回 车 键,因为光标在网格单元内回两次车才能转移到下一单元,因此需要屏蔽一次回车键
- 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) And Help_Bz_Col(Coljsq) = False) 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
- If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- Else
- Yd_Help.Visible = False
- End If
- Exit Sub
- End If
- '接受用户录入
- Select Case KeyAscii
- Case 0 To 32 '显示录入载体
- If GridBoolean(.Col, 1) = True Then
- Call xswbk
- Else
- If Help_Bz_Col(.Col) = True Then
- Call Sub_Drfzhsx(.Row, Trim(.TextMatrix(.Row, Sydz("002", GridStr(), Szzls))))
- End If
- End If
- Case Else
- '防止非编辑字段SendKeys()出现死循环
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then Exit Sub '该网格列不允许编辑时,退出.
- If GridBoolean(.Col, 3) Then '列表框录入
- Call xswbk
- Else
- Wbkbhlock = True
- Ydtext.Text = ""
- Wbkbhlock = False
- Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii) '?何用
- If KeyAscii = 0 Then Exit Sub
- '写有效行数据标志
- Call Xyxhbz(.Row)
- Call xswbk
- Wbkbhlock = True
- Ydtext.Text = ""
- Wbkbhlock = False
- Valilock = True
- SendKeys Chr(KeyAscii), wait
- DoEvents
- Valilock = False
- End If
- End Select
- End With
- End Sub
- Private Sub zjlrfl() '增加录入分录
- With WglrGrid
- If Not (Ydtext.Visible Or YdCombo.Visible) Then
- If Not Fun_Drfrmyxxpd Then Exit Sub
- Else
- Exit Sub
- End If
- If .Row < .FixedRows Then Exit Sub
- .AddItem "", .Row
- .RowHeight(.Row) = Sjhgd
- If .Row <> .Rows - 1 Then
- If .TextMatrix(.Row + 1, 0) = "*" Then
- .TextMatrix(.Row, 0) = "*"
- Else
- .RemoveItem .Rows - 1
- End If
- End If
- Call Xldqh
- Call Xldql
- Hyxxpdlock = False
- End With
- End Sub
- Private Sub Scdqfl() '删除当前分录
- Dim Answer As Integer, Scqwghz As Long, Scqwglz As Long, Hjlzte As Long, Sflrzt As Boolean
- With WglrGrid
- Scqwghz = .Row
- Scqwglz = .Col
- If .TextMatrix(.Row, 0) = "*" Then
- '判断是否为录入状态
- If Ydtext.Visible Or YdCombo.Visible Then
- Sflrzt = True
- Validate = True
- Call Lrsjhx
- Validate = False
- End If
- If Yd_Help.Visible = True Then
- Yd_Help.Visible = False
- End If
- Call Xldqh
- changelock = True
- .Select .Row, 0
- changelock = False
- If Shsfts Then
- .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = QBColor(12)
- Tsxx = "请确认是否删除当前记录?"
- Yhanswer = Xtxxts(Tsxx, 2, 2)
- If Yhanswer = 2 Then
- .Cell(flexcpBackColor, .Row, Qslz, .Row, .Cols - 1) = &H80000005
- changelock = True
- .Select Scqwghz, Scqwglz
- changelock = False
- '如为录入状态,则恢复录入
- If Sflrzt Then
- If GridBoolean(.Col, 1) = True Then
- Call xswbk
- Else
- If Help_Bz_Col(.Col) = True And Lab_OperStatus.Caption = 3 Then
- Call Yd_Help_Show
- End If
- End If
- End If
- Exit Sub
- End If
- End If
- .RemoveItem .Row
- If .Rows < Pmbcsjhs + .FixedRows + Fzxwghs + 1 Then
- .AddItem ""
- .RowHeight(.Rows - 1) = Sjhgd
- End If
- changelock = True
- .Select .Row, Scqwglz
- changelock = False
- End If
- End With
- End Sub
- Private Sub Qkwlzd(sjh As Long, Sjl As Long) '清空为零字段
- If Not GridBoolean(Sjl, 5) Then Exit Sub
- With WglrGrid
- If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then .TextMatrix(sjh, Sjl) = ""
- End With
- End Sub
- Private Sub fhyxh() '返回录入数据有效行,同时让得到焦点网格可见
- With WglrGrid
- 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 Xldqh() '显露当前行
- Dim Toprowte As Long
- With WglrGrid
- 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 Xldql() '显露当前列
- Dim Leftcolte As Long
- With WglrGrid
- 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 Function pdhwk(sjh As Long) '判断网格行是否为空行(所有录入字段均为空*非录入字段除外)
- With WglrGrid
- 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 Xyxhbz(sjh As Long) '写行有效性标志,并判断是否增行
- With WglrGrid
- 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 Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button) '表格格式设置(通用)
- Yd_Help.Visible = False
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(WglrGrid, GridCode, GridStr)
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(WglrGrid, 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 = 1 '报 表 表 尾 行 数
- 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
- bbxbtzzxs(1) = 0 '报表行组织形式(0-居左 1-居中 2-居右)
- Bbxbt(1) = "转帐名称: " + Lbl_AutoAccName.Caption '报表行组织形式(0-居左 1-居中 2-居右)
- Call Scyxsjb(WglrGrid) '生成报表数据
- Call Scdybb(Dyymctbl, Bbzbt, Bbxbt(), bbxbtzzxs(), Bbxbtgs, Bbbwh(), Bbbwhzzxs(), Bbbwhgs, bbylte)
- If Not bbylte Then
- Unload DY_Tybbyldy
- End If
- 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 Bln_AssVali As Boolean '辅助核算错误标识
- Dim Lrywlz As Long '录入有误列值
- Dim Bj As Boolean '辅助项有效标志
- Dim rs As New ADODB.Recordset
- '下面将对所有有效数据行进行有效性判断
- Int_RowCount = 0
- With WglrGrid
- For Rowjsq = .FixedRows To .Rows
- '带*号者为有效数据行
- If .TextMatrix(Rowjsq, 0) <> "*" Then
- Exit For
- 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(Yxxpdh, Jsqte))) = 0) Then
- Tsxx = GridStr(Jsqte, 2)
- Lrywlz = Jsqte
- GoTo Lrcwcl
- Exit For
- End If
- Next Jsqte
- If Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls))) = "" Then
- Tsxx = "自定义公式不能为空!"
- GoTo Lrcwcl
- End If
- '判断辅助项目有效性
- If Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) <> "" Then
- Sqlstr = "Select * FROM Cwzz_AccCode Where Ccode='" & Trim(.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) & "' "
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(Sqlstr)
- Lrywlz = Sydz("002", GridStr(), Szzls)
- If AssVali(Rowjsq, RecTemp) = False Then
- Exit Function
- End If
- End If
- Next Rowjsq
- 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
- '修改单据
- '1.删除原单据所有内容
- Cw_DataEnvi.DataConnect.Execute ("Delete Cwzz_AutoTranItem Where TranCode='" & Trim(Lbl_AutoAccCode.Caption) & "' and TranClass='" & TranClassCode & "'")
- If Rec_AutoTranItem.State = 1 Then Rec_AutoTranItem.Close
- Rec_AutoTranItem.Open "Select * From Cwzz_AutoTranItem Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockPessimistic
- For Rowjsq = WglrGrid.FixedRows To WglrGrid.Rows
- If WglrGrid.TextMatrix(Rowjsq, 0) <> "*" Then
- Exit For
- End If
- With Rec_AutoTranItem
- .AddNew
- .Fields("TranClass") = TranClassCode
- .Fields("TranCode") = Trim(Lbl_AutoAccCode.Caption) '转帐编号
- .Fields("Digest") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("001", GridStr(), Szzls))) '摘要
- .Fields("Ccode") = Trim(WglrGrid.TextMatrix(Rowjsq, Sydz("002", GridStr(), Szzls))) '转帐科目
- .Fields("TranOri") = WglrGrid.TextMatrix(Rowjsq, Sydz("004", GridStr(), Szzls)) '转帐方向
- .Fields("TranProp") = WglrGrid.TextMatrix(Rowjsq, Sydz("005", GridStr(), Szzls)) '转帐性质
- .Fields("FormulaString") = WglrGrid.TextMatrix(Rowjsq, Sydz("006", GridStr(), Szzls)) '来源科目
- ' If Val(WglrGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls))) <> 0 Then '分配比例
- ' .Fields("DistriProp") = Val(WglrGrid.TextMatrix(Rowjsq, Sydz("009", GridStr(), Szzls)))
- ' Else
- ' .Fields("DistriProp") = 100 '若网格内该项没有填写,默认100%
- ' End If
- ' .Fields("FormulaCode") = WglrGrid.TextMatrix(Rowjsq, 13) '来源数据项目
- .Fields("PersonCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 1)) '职员编码
- .Fields("DeptCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 3)) '部门编码
- .Fields("CusCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 5)) '客户单位编码
- .Fields("Suppliercode") = Trim(WglrGrid.TextMatrix(Rowjsq, 7)) '供应商编码
- .Fields("ItemClassCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 9)) '项目大类编码
- .Fields("ItemCode") = Trim(WglrGrid.TextMatrix(Rowjsq, 11)) '项目编码
- .Update
- End With
- Next Rowjsq
- Cw_DataEnvi.DataConnect.CommitTrans
- Sub_SaveBill = True
- Tsxx = "保存完毕! "
- Call Xtxxts(Tsxx, 0, 4)
- '标识单据发生改动
- Bln_BillChange = True
- '设置操作状态为浏览
- Lab_OperStatus = "1"
- Call Sub_OperStatus("11")
- Exit Function
- Swcwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts("(第 " + Trim(Str(Int_RowCount)) + " 条记录)-" + Tsxx, 0, 1)
- changelock = True
- .Select Rowjsq, Lrywlz
- WglrGrid.SetFocus
- changelock = False
- Exit Function
- End With
- End Function
- '************以下为文本框录入处理程序(固定不变部分)*************'
- Private Sub Wbklrwbcl(Index As Integer) '文本框录入事后处理程序
- '以下为依据实际情况自定义部分[
- '在此填写文本框录入事后处理程序
- ']以上为依据实际情况自定义部分
- End Sub
- Private Sub Cxxswbk() 'Formresize中重新显示文本框,列表框,帮助按钮(通用)
- Dim Wbkpy As Integer, Wbkpy1 As Integer
- Wbkpy = 30
- Wbkpy1 = 15
- With WglrGrid
- If YdCombo.Visible Then
- YdCombo.Left = .CellLeft + .Left + Wbkpy
- YdCombo.Top = .CellTop + .Top + Wbkpy
- YdCombo.Width = .CellWidth - Wbkpy1
- End If
- 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 Sub Yd_Help_Show()
- Dim RecTemp As New ADODB.Recordset
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute("select * from cwzz_AccCode where Ccode='" & Trim(WglrGrid.TextMatrix(WglrGrid.Row, Sydz("002", GridStr(), Szzls))) & "'")
- If RecTemp.EOF = False Then
- If RecTemp.Fields("DeptFlag") = True Or RecTemp.Fields("PersonFlag") = True Or RecTemp.Fields("CusFlag") = True Or RecTemp.Fields("SupplierFlag") = True Or RecTemp.Fields("ItemFlag") = True Then
- With WglrGrid
- Yd_Help.Visible = True
- Yd_Help.Left = .Left + .CellLeft + .CellWidth - Yd_Help.Width
- Yd_Help.Top = .Top + .CellTop + .CellHeight - Yd_Help.Height
- End With
- End If
- End If
- With WglrGrid '记录下当前的顶行和列,以备在YD_HELP按纽可用时,滚动滚动条时保持屏幕网格不发生滚动
- Dqtoprow = .TopRow
- Dqleftcol = .LeftCol
- End With
- End Sub
- Private Function AssVali(Row As Long, rs As ADODB.Recordset) As Boolean
- Dim RsTemp As ADODB.Recordset '临时数据表
- '部门核算则部门不能为空且有效
- AssVali = False
- With rs
- If .Fields("EndFlag") Then '末级标志时
- If rs.Fields("DeptFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Row, 3))) = 0 Then
- Tsxx = "需要部门核算,部门项不能为空!"
- GoTo Lrcwcl
- Else
- Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select DeptCode FROM Gy_Department Where DeptCode='" & Trim(WglrGrid.TextMatrix(Row, 3)) & "'")
- If RsTemp.EOF Then
- Tsxx = "部门不存在!"
- GoTo Lrcwcl
- End If
- End If
- Else
- WglrGrid.TextMatrix(Row, 3) = ""
- WglrGrid.TextMatrix(Row, 4) = ""
- End If
- Else
- WglrGrid.TextMatrix(Row, 3) = ""
- WglrGrid.TextMatrix(Row, 4) = ""
- End If
- '客户单位核算则往来单位不能为空
- If .Fields("EndFlag") Then '末级标志时
- If RecTemp.Fields("CusFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Row, 5))) = 0 Then
- Tsxx = "需要客户单位核算,客户单位项不能为空!"
- GoTo Lrcwcl
- Else
- Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select CusCode FROM Gy_Customer Where CusCode='" & Trim(WglrGrid.TextMatrix(Row, 5)) & "'")
- If RsTemp.EOF Then
- Tsxx = "客户单位不存在!"
- GoTo Lrcwcl
- End If
- End If
- Else
- WglrGrid.TextMatrix(Row, 5) = ""
- WglrGrid.TextMatrix(Row, 6) = ""
- End If
- Else
- WglrGrid.TextMatrix(Row, 5) = ""
- WglrGrid.TextMatrix(Row, 6) = ""
- End If
- '供应商单位核算则供应商单位不能为空
- If .Fields("EndFlag") Then '末级标志时
- If RecTemp.Fields("SupplierFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Row, 7))) = 0 Then
- Tsxx = "需要供应商核算,供应商单位项不能为空"
- GoTo Lrcwcl
- Else
- Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select Suppliercode FROM Gy_Supplier Where Suppliercode='" & Trim(WglrGrid.TextMatrix(Row, 7)) & "'")
- If RsTemp.EOF Then
- Tsxx = "供应商单位不存在!"
- GoTo Lrcwcl
- End If
- End If
- Else
- WglrGrid.TextMatrix(Row, 7) = ""
- WglrGrid.TextMatrix(Row, 8) = ""
- End If
- Else
- WglrGrid.TextMatrix(Row, 7) = ""
- WglrGrid.TextMatrix(Row, 8) = ""
- End If
- '个人往来核算则个人项不能为空
- If .Fields("EndFlag") Then '末级标志时
- If RecTemp.Fields("PersonFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Row, 1))) = 0 Then
- Tsxx = "需要个人往来核算,个人项不能为空"
- GoTo Lrcwcl
- Else
- Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select PersonCode FROM Gy_Person Where PersonCode='" & Trim(WglrGrid.TextMatrix(Row, 1)) & "'")
- If RsTemp.EOF Then
- Tsxx = "个人不存在!"
- GoTo Lrcwcl
- End If
- End If
- Else
- WglrGrid.TextMatrix(Row, 1) = ""
- WglrGrid.TextMatrix(Row, 2) = ""
- End If
- Else
- WglrGrid.TextMatrix(Row, 1) = ""
- WglrGrid.TextMatrix(Row, 2) = ""
- End If
- '项目核算则项目不能为空
- If .Fields("EndFlag") Then '末级标志时
- If RecTemp.Fields("ItemFlag") Then
- If Len(Trim(WglrGrid.TextMatrix(Row, 11))) = 0 Then
- Tsxx = "需要项目核算,核算项目不能为空"
- GoTo Lrcwcl
- Else
- Set RsTemp = Cw_DataEnvi.DataConnect.Execute("Select ItemCode FROM Cwzz_Item Where ItemClassCode='" & Trim(WglrGrid.TextMatrix(Row, 9)) & "' " & _
- "And ItemCode='" & Trim(WglrGrid.TextMatrix(Row, 11)) & "'")
- If RsTemp.EOF Then
- Tsxx = "核算项目不存在!"
- GoTo Lrcwcl
- End If
- End If
- Else
- WglrGrid.TextMatrix(Row, 11) = ""
- WglrGrid.TextMatrix(Row, 12) = ""
- End If
- Else
- WglrGrid.TextMatrix(Row, 11) = ""
- WglrGrid.TextMatrix(Row, 12) = ""
- End If
- End With
- rs.Close
- AssVali = True
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts("(第 " + Trim(Str(Row)) + " 条记录)-" + Tsxx, 0, 1)
- changelock = True
- .Select Row, Sydz("010", GridStr(), Szzls)
- WglrGrid.SetFocus
- changelock = False
- Exit Function
- End With
- End Function