资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:71k
源码类别:
企业管理
开发平台:
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 JZ_FrmTranList
- BackColor = &H00E9F4FA&
- BorderStyle = 1 'Fixed Single
- Caption = "结转生产成本"
- ClientHeight = 6480
- ClientLeft = 675
- ClientTop = 720
- ClientWidth = 9225
- Icon = "结转凭证_结转成本.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 6480
- ScaleWidth = 9225
- StartUpPosition = 2 '屏幕中心
- Begin VB.PictureBox Pic_Title
- AutoRedraw = -1 'True
- BackColor = &H00FFFFFF&
- Height = 1155
- Left = 0
- Picture = "结转凭证_结转成本.frx":1042
- ScaleHeight = 1095
- ScaleMode = 0 'User
- ScaleWidth = 9264.57
- TabIndex = 6
- Top = 570
- Width = 9245
- Begin VB.ComboBox Combo_KJQJ
- Height = 300
- Left = 1620
- Style = 2 'Dropdown List
- TabIndex = 7
- Top = 750
- Width = 2025
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 4800
- Top = 300
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 22
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":35106
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":354A0
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":3583A
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":35BD4
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":35F6E
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":36308
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":366A2
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":36A3C
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":36DD6
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":37170
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":3750A
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":378A4
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":37C3E
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":37FD8
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":38372
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":3870C
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":38AA6
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":38E40
- Key = "xx"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":391DA
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":39574
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":3990E
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "结转凭证_结转成本.frx":39CA8
- Key = "sc"
- EndProperty
- EndProperty
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "会计期间:"
- Height = 180
- Index = 0
- Left = 720
- TabIndex = 13
- Top = 810
- Width = 810
- 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 = 8625
- TabIndex = 12
- Top = 810
- Width = 90
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "(第"
- Height = 180
- Index = 11
- Left = 8160
- TabIndex = 11
- Top = 810
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "行)"
- Height = 180
- Index = 12
- Left = 8775
- TabIndex = 10
- Top = 810
- Width = 270
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "当前记录"
- Height = 180
- Index = 13
- Left = 7350
- TabIndex = 9
- Top = 810
- Width = 720
- 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 = 360
- TabIndex = 8
- Top = 240
- Width = 1530
- End
- End
- Begin VB.CommandButton Ydcommand
- Height = 300
- Left = 5190
- Picture = "结转凭证_结转成本.frx":3A042
- Style = 1 'Graphical
- TabIndex = 5
- Top = 150
- Visible = 0 'False
- Width = 300
- End
- Begin VB.Timer Timer1
- Interval = 1
- Left = 7320
- Top = 960
- End
- Begin VB.ComboBox YdCombo
- Height = 300
- Left = 8148
- Style = 2 'Dropdown List
- TabIndex = 4
- 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 = 3
- Top = 615
- Visible = 0 'False
- Width = 1179
- End
- Begin VSFlex8Ctl.VSFlexGrid WglrGrid
- Height = 4695
- Left = 0
- TabIndex = 2
- Top = 1770
- Width = 9225
- _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 MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 555
- Left = 0
- TabIndex = 14
- Top = 0
- Width = 9225
- _ExtentX = 16272
- _ExtentY = 979
- ButtonWidth = 820
- ButtonHeight = 926
- AllowCustomize = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 9
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- ImageKey = "sz"
- BeginProperty ButtonMenus {66833FEC-8583-11D1-B16A-00C0F0283628}
- NumButtonMenus = 1
- BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
- EndProperty
- EndProperty
- 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}
- Enabled = 0 'False
- Object.Visible = 0 'False
- Caption = "定义"
- Key = "define"
- ImageKey = "define"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "结转"
- Key = "run"
- ImageKey = "exec"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- Begin MSComctlLib.Toolbar GsToolbar
- Height = 525
- Left = 6600
- TabIndex = 15
- Top = 0
- Width = 2595
- _ExtentX = 4577
- _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 = 3
- 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
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "显示项目"
- Key = "szxsxm"
- ImageKey = "xsxm"
- EndProperty
- EndProperty
- End
- End
- Begin VB.Label Lab_Pzclzt
- BackColor = &H0000FFFF&
- Caption = "2"
- ForeColor = &H00808080&
- Height = 322
- Left = 9012
- TabIndex = 1
- 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 = "JZ_FrmTranList"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '*********************************************************************************************************
- '* 模 块 名 称 :结转凭证
- '* 功 能 描 述 :结转凭证
- '* 程序员姓名 :xjl
- '* 最后修改人 :xjl
- '* 最后修改时间:2002/1/22
- '* 备 注:程序中所有依实际情况自定义部分均用[>> <<]括起
- '*********************************************************************************************************
- '[以下为根据实际情况设置变量
- Dim Rec_AutoTranItem As New ADODB.Recordset '转帐项目动态集
- Dim jsqte As Long '临时计数器
- Dim SqlStr As String '临时的SQL字符串
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Combo_CostCellCode() As String '成本中心COMBO
- Dim IsShowBill As Boolean
- Public PrivateMm As Integer
- Public PrivateYear As Integer
- Dim Tranjsq As Integer
- Dim TranNum() As String
- Dim OperationNum As Integer
- Public TranClassCode As String
- Public Object As String
- Dim Str_RightEdit As String '编辑权限索引
- Dim Bln_DeleteFlag As Boolean '转帐后是否删除临时表
- ']
- '以下为固定使用变量(网格)
- Dim Cxnrrec As New ADODB.Recordset '显示查询内容动态集
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- Dim ReportTitle As String '报表主标题
- Dim Tsxx As String '系统提示信息
- Dim Pmbcsjhs As Long '屏幕网格保持数据行数(大于等于1)
- Dim Fzxwghs As Integer '辅助项网格行数(包括合计行)
- Dim Sfxshjwg As Boolean '是否显示合计网格
- Dim Qslz As Long '网格隐藏(非操作显示)列数
- Dim Sjhgd As Double '网格数据行高度
- Dim GridBoolean() As Boolean '网格列信息(布尔型)
- Dim GridStr() As String '网格列信息(字符型)
- Dim GridInt() As Integer '网格列信息(整型)
- Dim Sfblbzkd As Boolean '是否保留帮助宽度(字段提供帮助时,是否为按钮保留空间)
- Dim Dqlrwgh As Long '当前录入数据网格行
- Dim Dqlrwgl As Long '当前录入数据网格列
- Dim Dqlkwgh As Long '刚刚离开网格行(不一定为录入行)
- Dim Dqlkwgl As Long '刚刚离开网格列
- Dim Dqtoprow As Long '当前录入状态时最上端可视行
- Dim Dqleftcol As Long '当前录入状态时最左端可视列
- Dim Zdlrqnr As String '字段录入修改前内容(用来判断内容是否修改)
- Dim Wbkbhlock As Boolean '文本框改变值锁
- Dim Changelock As Boolean '网格行列改变控制锁(用来区别用户改变.程序改变)
- Dim Gdtlock As Boolean '滚动条滚动控制(用来区别用户改变.程序改变)
- Dim Yxxpdlock As Boolean '字段有效性判断锁(内容不修改不需进行字段有效性判断)
- Dim Hyxxpdlock As Boolean '行有效性判断锁(字段内容不修改不需进行行有效性判断)
- Dim Valilock As Boolean '文本框失去焦点是否进行有效性控制(TRUE 为锁定*限用网格录入)
- Dim Shsfts As Boolean '删除记录行是否提示
- Dim Szzls As Integer '网格信息数组最大下标值(网格列数-1)
- Private Sub Combo_KJQJ_Click() '选择会计期间
- PrivateYear = Mid(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 1, 4)
- PrivateMm = Right(Trim(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex))), 2)
- Lab_OperStatus.Caption = "1"
- If IsShowBill = False Then
- Exit Sub
- End If
- '显示数据
- Call Sub_Query
- End Sub
- 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() '窗体装入
- '初始化各种锁值
- Changelock = False '网格行列改变控制锁
- Gdtlock = False '滚动条滚动控制
- Yxxpdlock = True '字段有效性判断锁
- Hyxxpdlock = True '行有效性判断锁
- Wbkbhlock = False '文本框内容改变锁
- IsShowBill = False '显示查询信息控制
- PrivateYear = Xtyear '会计年度
- PrivateMm = Xtmm '会计期间
- '报表主标题及报表编码
- If TranClassCode = "01" Then
- ReportTitle = "结转生产成本"
- Str_RightEdit = "CB_CostCarryForward_Edit"
- Else
- ReportTitle = "结转产成品"
- Str_RightEdit = "CB_CostManuFactured_Edit"
- End If
- XtReportCode = "CB_CostCarryForward"
- Load Dyymctbl
- '调 入 网 格
- GridCode = "CB_CostCarryForward" '网格属性编码
- 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
- '填充会计期间列表框(年度默认为用户选择年度)
- Call Sub_FillPeriod(Combo_KJQJ, PrivateYear, PrivateMm)
- '判断是否为空
- SqlStr = "Select Count(*) From Cb_CostObject"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If RecTemp.Fields(0) <= 0 Then
- Call Sub_OperStatus("10")
- End If
- '填充网格
- Call Sub_Query
- '设置操作状态为浏览
- Lab_OperStatus.Caption = "1"
- IsShowBill = True
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- '卸载打印页面窗体
- Unload Dyymctbl
- Set Rec_AutoTranItem = Nothing
- Set RecTemp = Nothing
- End Sub
- Private Sub Sub_Query() '根据当前单据号显示整张单据内容
- '禁止网格刷新动作,为加快网格显示速度(Fixed)
- WglrGrid.Redraw = False
- SqlStr = "Select A.Objectcode,ObjectName,UnitName,Quantity,ThmonCost,TranEngSign,TranEngSign1 From Cb_ObjectComplete A " _
- & "Left Outer Join (Select ObjectCode,ObjectName,UnitName From Cb_CostObject A " _
- & "Left Outer Join Gy_UnitSet B On A.MeasureUnitCode=B.UnitCode) B On A.ObjectCode=B.ObjectCode " _
- & "Where Year='" + CStr(PrivateYear) + "' And Period='" + CStr(PrivateMm) + "'"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- With RecTemp
- WglrGrid.Rows = WglrGrid.FixedRows
- If .EOF Then
- WglrGrid.Redraw = True
- Exit Sub
- End If
- jsqte = WglrGrid.FixedRows
- Do While Not .EOF
- WglrGrid.AddItem ""
- '[>>显示
- WglrGrid.TextMatrix(jsqte, 0) = "*" '行标识
- WglrGrid.TextMatrix(jsqte, Sydz("002", GridStr(), Szzls)) = Trim(.Fields("Objectcode")) '对象编码
- WglrGrid.TextMatrix(jsqte, Sydz("003", GridStr(), Szzls)) = Trim(.Fields("ObjectName") & "") '对象名称
- WglrGrid.TextMatrix(jsqte, Sydz("004", GridStr(), Szzls)) = Trim(.Fields("UnitName") & "") '计量单位
- WglrGrid.TextMatrix(jsqte, Sydz("005", GridStr(), Szzls)) = Trim(.Fields("Quantity") & "") '数量
- WglrGrid.TextMatrix(jsqte, Sydz("006", GridStr(), Szzls)) = Trim(.Fields("ThmonCost") & "") '实际成本
- If TranClassCode = "01" Then
- If Trim(.Fields("TranEngSign") & "") = "" Or Trim(.Fields("TranEngSign") & "") = False Then
- WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = False '结转标志(生产成本)
- Else
- WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = True '结转标志(生产成本)
- End If
- Else
- If Trim(.Fields("TranEngSign1") & "") = "" Or Trim(.Fields("TranEngSign1") & "") = False Then
- WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = False '结转标志(产成品)
- Else
- WglrGrid.TextMatrix(jsqte, Sydz("007", GridStr(), Szzls)) = True '结转标志(产成品)
- End If
- End If
- '<<]
- WglrGrid.RowHeight(jsqte) = Sjhgd
- .MoveNext
- jsqte = jsqte + 1
- Loop
- End With
- '将网格刷新解禁(Fixed)
- WglrGrid.Redraw = True
- 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" '预 览
- Call bbyl(True)
- Case "dy" '打 印
- Call bbyl(False)
- Case "define" '定 义
- Case "run" '结 转
- '判断用户是否有此功能执行权限,如有则写上机日志(进入)
- If Not Security_Log(Str_RightEdit, Xtczybm, 1, True) Then
- Exit Sub
- End If
- Select Case TranClassCode
- Case "01"
- Call Run1 '结转生产成本
- Case "02"
- Call Run2 '结转产成品
- End Select
- 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
- 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
- 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 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)
- '以下为自定义部分[
- '以上为自定义部分]
- 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
- 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 '辅助项有效性标志
- Dim Rowjsq As Long
- 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
- '2.放置行处理程序
- '以上为自定义部分]
- End With
- Sjhzyxxpd = True
- Hyxxpdlock = True
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts(Tsxx, 0, 1)
- Changelock = True
- .Select Yxxpdh, Lrywlz
- Changelock = False
- Sjhzyxxpd = False
- Exit Function
- End With
- End Function
- Private Function Fun_AllowEdit() As Boolean '判断当前定义是否允许编辑或删除
- Fun_AllowEdit = True
- End Function
- '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改======================='
- 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(Combo_CostCellCode(Combo_CostCell.ListIndex)))
- 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
- Private Sub Form_Resize() '窗体大小发生变化时,重新显示文本框
- Call Cxxswbk
- End Sub
- Private Function Fun_Drfrmyxxpd() As Boolean '调入其它窗体或功能产生的有效性判断(包括数据回写)
- '因为点工具栏的按纽时文本框或网格均没有失去焦点事件发生,为保证该操作之前进行录入数据的有效性判断而设。
- Fun_Drfrmyxxpd = True
- With WglrGrid
- '如果当前网格处于编辑状态,则先进行数据回写再进行有效性判断
- 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_DblClick()
- With WglrGrid
- If .Row < .FixedRows Then
- Exit Sub
- End If
- If GridStr(.Col, 1) <> "001" Then
- Exit Sub
- Else
- If .TextMatrix(.Row, Sydz("001", GridStr(), Szzls)) = "√" Then
- .TextMatrix(.Row, Sydz("001", GridStr(), Szzls)) = ""
- Else
- .TextMatrix(.Row, Sydz("001", GridStr(), Szzls)) = "√"
- End If
- End If
- End With
- End Sub
- 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
- 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 Then
- Gdtlock = True
- .TopRow = Dqtoprow
- .LeftCol = Dqleftcol
- Gdtlock = False
- Exit Sub
- 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)) 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)) 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)) 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)) 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)) 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(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 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 Sub_OperStatus(Str_Status As String) '工具条依据不同状态所进行的变化
- With Tlb_Action
- Select Case Str_Status
- Case "10" '浏览
- '工具条
- '.Buttons("dy").Enabled = False '打印
- '.Buttons("yl").Enabled = False '预览
- .Buttons("run").Enabled = False
- Case "11" '浏览
- '工具条
- Case "30" '修改
- '工具条
- End Select
- End With
- End Sub
- Private Sub GsToolbar_ButtonClick(ByVal Button As MSComctlLib.Button) '表格格式设置(通用)
- Select Case Button.Key
- Case "bcgs" '保存表格格式
- Call Bcwggs(WglrGrid, GridCode, GridStr())
- Case "hfmrgs" '恢复默认格式
- Call Hfmrgs(WglrGrid, GridCode, GridStr())
- Case "szxsxm" '设置显示项目
- Call Szxsxm(WglrGrid, GridCode)
- 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
- '判断是否为空
- SqlStr = "Select Count(*) From Cb_CostObject"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If RecTemp.Fields(0) <= 0 Then
- Bbxbt(1) = ""
- Else
- Bbxbt(1) = Mid(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 1, 4) + "年" + Right(CStr(Combo_KJQJ.List(Combo_KJQJ.ListIndex)), 2) + "月"
- End If
- bbxbtzzxs(1) = 1 '报表行组织形式(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 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
- '=================以下自定义部分=================
- Sub Run2() '结转产成品
- Dim Rec_SubTemp As New ADODB.Recordset
- Dim lng_OperationNum As Long
- Dim i As Integer
- Dim CF_Count As Integer
- Dim IdCount As Integer
- Bln_DeleteFlag = True
- Changelock = False
- CF_Count = 0
- If CF_Judge = False Then '结转之前判断
- Exit Sub
- End If
- On Error GoTo Err1
- Screen.MousePointer = 11
- Cw_DataEnvi.DataConnect.BeginTrans
- IdCount = 0
- For jsq = 1 To Tranjsq
- '有无可结转的数据
- SqlStr = "Select Sum(ThmonConsumeMoney) As ThmonConsumeMoney From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(PrivateYear) + "," + CStr(PrivateMm) + ") "
- Set Rec_SubTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If Not IsNull(Rec_SubTemp.Fields("ThmonConsumeMoney")) Or Rec_SubTemp.Fields("ThmonConsumeMoney") = 0 Then
- '写临时凭证主表
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(OperationNum, lng_OperationNum)
- '写临时凭证子表
- SqlStr = "Select '成本结转' As Digest,0 As Jfje,Sum(ThmonConsumeMoney) As Dfje,0 As ye,0 As Jfsl,Sum(ThmonConsumeAmount) As Dfsl,Ccode1 As Ccode " _
- & "From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(PrivateYear) + "," + CStr(PrivateMm) + ") Group By Ccode1 Having Sum(ThmonConsumeMoney)<>0 Union " _
- & "Select '成本结转',Sum(ThmonConsumeMoney),0,0,Sum(ThmonConsumeAmount),0,B.Ccode From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(PrivateYear) + "," + CStr(PrivateMm) + ") A " _
- & "Left Outer Join Cb_CostObject B On A.ObjectCode=b.ObjectCode " _
- & "Group By B.Ccode"
- Set Rec_SubTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- i = 1
- Do Until Rec_SubTemp.EOF
- Call Save_TempPz_Ass(Rec_SubTemp, lng_OperationNum, i)
- Rec_SubTemp.MoveNext
- i = i + 1
- Loop
- If IdCount = 0 Then
- ReDim Glo_ObjectId1.OId(IdCount)
- ReDim Glo_ObjectId1.ONum(IdCount)
- Glo_ObjectId1.OId(IdCount) = TranNum(jsq)
- Glo_ObjectId1.ONum(IdCount) = lng_OperationNum
- End If
- If IdCount > 0 Then
- ReDim Preserve Glo_ObjectId1.OId(IdCount)
- ReDim Preserve Glo_ObjectId1.ONum(IdCount)
- Glo_ObjectId1.OId(IdCount) = TranNum(jsq)
- Glo_ObjectId1.ONum(IdCount) = lng_OperationNum
- End If
- IdCount = IdCount + 1
- CF_Count = CF_Count + 1
- Else
- Tsxx = "对象没有可结转的数据!"
- Call Xtxxts(Tsxx, 0, 3)
- End If
- Next
- Cw_DataEnvi.DataConnect.CommitTrans
- Screen.MousePointer = 0
- If CF_Count > 0 Then
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "成本核算"
- AutoTran_PzFrm.HelpContextID = "0705003"
- AutoTran_PzFrm.Show 1
- End If
- Call WriteVouchId(OperationNum, 2) '写数据
- Call Clean '删除信息
- Call Sub_Query '查询信息
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Screen.MousePointer = 0
- Exit Sub
- End Sub
- Sub Run1() '结转生产成本
- Dim jsq As Integer
- Dim Rec_SubTemp As New ADODB.Recordset
- Dim lng_OperationNum As Long
- Dim i As Integer
- Dim CF_Count As Integer
- Dim IdCount As Integer
- Bln_DeleteFlag = True
- Changelock = False
- CF_Count = 0
- If CF_Judge = False Then '结转之前判断
- Exit Sub
- End If
- On Error GoTo Err1
- Screen.MousePointer = 11
- Cw_DataEnvi.DataConnect.BeginTrans
- IdCount = 0
- For jsq = 1 To Tranjsq
- '有无可结转的数据
- SqlStr = "Select Sum(Isnull(ThmonConsumeMoney,0)) As ThmonConsumeMoney From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(PrivateYear) + "," + CStr(PrivateMm) + ") "
- Set Rec_SubTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If Not IsNull(Rec_SubTemp.Fields("ThmonConsumeMoney")) Or Rec_SubTemp.Fields("ThmonConsumeMoney") = 0 Then
- '写临时凭证主表
- lng_OperationNum = CreatBillID("0102")
- Call Save_TempPz_Main(OperationNum, lng_OperationNum)
- '写临时凭证子表
- SqlStr = "Select '成本结转' As Digest,0 As Jfje,isnull(ThmonConsumeMoney,0) As Dfje,0 As ye,0 As Jfsl,isnull(ThmonConsumeAmount,0) As Dfsl,Ccode2 As Ccode From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(CStr(PrivateYear)) + "," + CStr(PrivateMm) + ") Where isnull(ThmonConsumeMoney,0)<>0" _
- & "Union " _
- & "Select '成本结转',Sum(Isnull(ThmonConsumeMoney,0)),0,0,Sum(Isnull(ThmonConsumeAmount,0)),0,Ccode1 From Cb_Fn_CFProduceCost('" + CStr(TranNum(jsq)) + "'," + CStr(PrivateYear) + "," + CStr(PrivateMm) + ") Group By Ccode1 Having Sum(Isnull(ThmonConsumeMoney,0))<>0"
- Set Rec_SubTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- i = 1
- Do Until Rec_SubTemp.EOF
- Call Save_TempPz_Ass(Rec_SubTemp, lng_OperationNum, i)
- Rec_SubTemp.MoveNext
- i = i + 1
- Loop
- If IdCount = 0 Then
- ReDim Glo_ObjectId1.OId(IdCount)
- ReDim Glo_ObjectId1.ONum(IdCount)
- Glo_ObjectId1.OId(IdCount) = TranNum(jsq)
- Glo_ObjectId1.ONum(IdCount) = lng_OperationNum
- End If
- If IdCount > 0 Then
- ReDim Preserve Glo_ObjectId1.OId(IdCount)
- ReDim Preserve Glo_ObjectId1.ONum(IdCount)
- Glo_ObjectId1.OId(IdCount) = TranNum(jsq)
- Glo_ObjectId1.ONum(IdCount) = lng_OperationNum
- End If
- IdCount = IdCount + 1
- CF_Count = CF_Count + 1
- Else
- Tsxx = "对象没有可结转的数据!"
- Call Xtxxts(Tsxx, 0, 3)
- End If
- Next
- Cw_DataEnvi.DataConnect.CommitTrans
- Screen.MousePointer = 0
- If CF_Count > 0 Then
- AutoTran_PzFrm.OperationNumPz = OperationNum
- AutoTran_PzFrm.vouchsourcePz = "成本核算"
- AutoTran_PzFrm.HelpContextID = "0705003"
- AutoTran_PzFrm.Show 1
- End If
- Call WriteVouchId(OperationNum, 1) '写数据
- Call Clean '删除数据
- Call Sub_Query '查询信息
- Exit Sub
- Err1:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Screen.MousePointer = 0
- End Sub
- Private Function CF_Judge() As Boolean '结转之前的判断
- Dim jsq As Long '临时计数器
- '提示已转过的凭证是否再转一次
- If WglrGrid.Rows <= WglrGrid.FixedRows Then
- Exit Function
- End If
- With WglrGrid
- For jsq = .FixedRows To .Rows - 1
- If .TextMatrix(jsq, Sydz("001", GridStr(), Szzls)) = "√" Then
- If .TextMatrix(jsq, Sydz("007", GridStr(), Szzls)) <> "" Then
- If .TextMatrix(jsq, Sydz("007", GridStr(), Szzls)) = True Then
- Tsxx = "第" & WglrGrid.TextMatrix(jsq, Sydz("002", GridStr(), Szzls)) & "号已转过凭证,再转一次吗?"
- If Xtxxts(Tsxx, 1, 4) = 7 Then
- .TextMatrix(jsq, Sydz("001", GridStr(), Szzls)) = ""
- End If
- End If
- End If
- End If
- Next jsq
- End With
- '判断选择的转帐过程共几个,保存在TranJsq中。将每个转帐过程编号赋值到TranNum()数组中,
- ReDim TranNum(1) '转帐过程数组附初值
- Tranjsq = 0
- With WglrGrid
- For jsq = .FixedRows To .Rows - 1
- If .TextMatrix(jsq, Sydz("001", GridStr(), Szzls)) = "√" Then
- If Tranjsq = 0 Then
- TranNum(1) = .TextMatrix(jsq, Sydz("002", GridStr(), Szzls))
- End If
- If Tranjsq > 0 Then
- ReDim Preserve TranNum(UBound(TranNum) + 1)
- TranNum(Tranjsq + 1) = .TextMatrix(jsq, Sydz("002", GridStr(), Szzls))
- End If
- Tranjsq = Tranjsq + 1
- End If
- Next jsq
- End With
- If Tranjsq = 0 Then
- Tsxx = "没有选择结帐对象!"
- Call Xtxxts(Tsxx, 0, 4)
- Tran_Pd = False
- Exit Function
- End If
- OperationNum = CreatBillID("0102")
- CF_Judge = True
- End Function
- '====================单据ID处理==================
- Public Function CreatBillID(BillCode As String) As Integer
- '参数说明: BillCode 单据编码
- Dim BillType As String
- Dim aDo_re As New Recordset
- Set aDo_re = Cw_DataEnvi.DataConnect.Execute("select * from Gy_BillNumber where BillCode='" & Trim(BillCode) & "'")
- If aDo_re.RecordCount > 0 Then
- CreatBillID = aDo_re!IDNow
- BillType = aDo_re!BillType
- End If
- aDo_re.Close
- Cw_DataEnvi.DataConnect.Execute "update Gy_BillNumber set IDNow=IDNow+1 where BillType='" & Trim(BillType) & "'"
- End Function
- Private Sub Save_TempPz_Main(OperationNum1 As Integer, VouchIdTemp_Id As Long) '将有效数据写入临时凭证主表。(先写辅表再写主表,为了防止在主表中写入没有发生额的空凭证记录)
- Dim Rec_VouchMainTemp As New ADODB.Recordset '临时凭证主表记录集
- '打开临时凭证主表,用于存放有效凭证的凭证号等信息
- If Rec_VouchMainTemp.State = 1 Then Rec_VouchMainTemp.Close
- Rec_VouchMainTemp.Open "select * from Cwzz_AccVouchMainTemp Where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_VouchMainTemp
- .AddNew
- .Fields("VouchId") = VouchIdTemp_Id '转帐过程序号
- .Fields("Year") = PrivateYear '取选中的年份
- .Fields("period") = PrivateMm '取选中的会计期间
- .Fields("Ddate") = Xtrq '取系统日期
- .Fields("VouchClassCode") = "转" '所转转帐过程的凭证类别
- .Fields("Doc") = 0
- .Fields("Bill") = Xtczy
- .Fields("VouchSource") = "成本核算" '凭证来源
- .Fields("OperationClass") = "" '业务类型
- .Fields("BillType") = ""
- .Fields("OperationNo") = OperationNum1 '存放批号
- .Fields("DeleteFlag") = 1
- .Update
- End With
- End Sub
- Private Sub Save_TempPz_Ass(Rec_Record As ADODB.Recordset, VouchIdTemp_Id As Long, serialnum As Integer) '写临时凭证辅表
- 'VouchIdTemp_Id临时凭证主表、辅表对应关系Id号
- Dim Rec_VouchTemp As New ADODB.Recordset '临时凭证辅表记录集
- '打开临时凭证辅表,用于存放转帐凭证内容
- Rec_VouchTemp.Open "select * from Cwzz_AccVouchsubTemp where 1=2", Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- With Rec_VouchTemp
- .AddNew
- .Fields("SerialID") = serialnum
- .Fields("VouchId") = VouchIdTemp_Id
- .Fields("Digest") = Rec_Record.Fields("Digest")
- .Fields("Jfje") = Rec_Record.Fields("Jfje")
- .Fields("Dfje") = Rec_Record.Fields("dfje")
- .Fields("Balance") = 0
- .Fields("Jfsl") = Rec_Record.Fields("jfsl")
- .Fields("Dfsl") = Rec_Record.Fields("dfsl")
- .Fields("Ccode") = Rec_Record.Fields("Ccode")
- .Update
- End With
- End Sub
- Private Sub Clean() '删除临时数据表数据
- If Bln_DeleteFlag = True Then
- If RecTemp.State = 1 Then RecTemp.Close
- '删除临时凭证主从表
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchSubTemp Where VouchId in (select VouchId from Cwzz_AccVouchMainTemp where OperationNo='" & OperationNum & "')"
- Cw_DataEnvi.DataConnect.Execute "Delete From Cwzz_AccVouchMainTemp Where OperationNo='" & OperationNum & "'"
- End If
- End Sub
- Private Sub WriteVouchId(op As Integer, i As Integer) '回写正式凭证ID到单据表和明细帐表中
- Dim SqlStr As String 'SQL语句
- Dim RecTemp As New ADODB.Recordset '临时记录集
- Dim VId As Integer 'VouchId
- Dim SId As Integer 'SureVouchId
- Dim l As Integer
- If i = 1 Then
- '结转生产成本
- SqlStr = "Select * From Cwzz_AccVouchMainTemp Where SureVouchId>0 And OperationNo='" & op & "' Order By BillNo"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- Do Until RecTemp.EOF
- VId = RecTemp.Fields("VouchId")
- SId = RecTemp.Fields("SureVouchId")
- SqlStr = "Select * From Cwzz_AccVouchMain Where VouchId='" + CStr(Trim(SId)) + "'"
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If Not Cxnrrec.EOF Then
- For i = 0 To UBound(Glo_ObjectId1.OId)
- If Glo_ObjectId1.ONum(i) = VId Then
- If Cxnrrec.State = 1 Then Cxnrrec.Close
- SqlStr = "Select * From Cb_ObjectComplete Where ObjectCode='" + CStr(Glo_ObjectId1.OId(i)) + "' And Year=" + CStr(PrivateYear) + " And Period=" + CStr(PrivateMm) + ""
- Cxnrrec.Open SqlStr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Cxnrrec.Fields("TranEngSign") = "1"
- Cxnrrec.Update
- Exit For
- End If
- Next
- End If
- RecTemp.MoveNext
- Loop
- Else
- '结转产成品
- SqlStr = "Select * From Cwzz_AccVouchMainTemp Where SureVouchId>0 And OperationNo='" & op & "' Order By BillNo"
- Set RecTemp = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- Do Until RecTemp.EOF
- VId = RecTemp.Fields("VouchId")
- SId = RecTemp.Fields("SureVouchId")
- SqlStr = "Select * From Cwzz_AccVouchMain Where VouchId='" + CStr(Trim(SId)) + "'"
- Set Cxnrrec = Cw_DataEnvi.DataConnect.Execute(SqlStr)
- If Not Cxnrrec.EOF Then
- For i = 0 To UBound(Glo_ObjectId1.OId)
- If Glo_ObjectId1.ONum(i) = VId Then
- If Cxnrrec.State = 1 Then Cxnrrec.Close
- SqlStr = "Select * From Cb_ObjectComplete Where ObjectCode='" + CStr(Glo_ObjectId1.OId(i)) + "' And Year=" + CStr(PrivateYear) + " And Period=" + CStr(PrivateMm) + ""
- Cxnrrec.Open SqlStr, Cw_DataEnvi.DataConnect, adOpenDynamic, adLockOptimistic
- Cxnrrec.Fields("TranEngSign1") = "1"
- Cxnrrec.Update
- Exit For
- End If
- Next
- End If
- RecTemp.MoveNext
- Loop
- End If
- End Sub