+
资源名称:ERPSYS.zip [点击查看]
上传用户:zhpu1995
上传日期:2013-09-06
资源大小:61151k
文件大小:68k
源码类别:
企业管理
开发平台:
Visual Basic
- VERSION 5.00
- Object = "{D76D7128-4A96-11D3-BD95-D296DC2DD072}#1.0#0"; "VSOCX7.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
- Begin VB.Form Salary_Frm_Compute
- BackColor = &H00C0C0C0&
- BorderStyle = 1 'Fixed Single
- Caption = "计算工资"
- ClientHeight = 8310
- ClientLeft = 660
- ClientTop = 1155
- ClientWidth = 11910
- HelpContextID = 2213005
- Icon = "计算工资.frx":0000
- KeyPreview = -1 'True
- LinkTopic = "Form4"
- MaxButton = 0 'False
- MinButton = 0 'False
- ScaleHeight = 8310
- ScaleWidth = 11910
- StartUpPosition = 1 '所有者中心
- Begin MSComctlLib.ProgressBar PB_Proc
- Height = 330
- Left = 4200
- TabIndex = 10
- Top = 3660
- Visible = 0 'False
- Width = 4440
- _ExtentX = 7832
- _ExtentY = 582
- _Version = 393216
- Appearance = 1
- Scrolling = 1
- End
- Begin VB.PictureBox Pic_Title
- BackColor = &H00FFFFFF&
- Height = 1095
- Left = 15
- Picture = "计算工资.frx":1042
- ScaleHeight = 1035
- ScaleWidth = 11865
- TabIndex = 6
- Top = 585
- Width = 11925
- Begin MSComctlLib.ImageCombo ImgCmb_Sort
- Height = 315
- Left = 2010
- TabIndex = 8
- Top = 705
- Width = 3225
- _ExtentX = 5689
- _ExtentY = 556
- _Version = 393216
- ForeColor = -2147483640
- BackColor = -2147483643
- Locked = -1 'True
- End
- Begin VB.Label Lab_Mark
- AutoSize = -1 'True
- BackStyle = 0 'Transparent
- Caption = "工资类别:"
- Height = 180
- Index = 5
- Left = 1050
- TabIndex = 9
- Top = 765
- Width = 810
- End
- Begin VB.Label tsLabel
- AutoSize = -1 'True
- BackColor = &H80000018&
- BackStyle = 0 'Transparent
- Caption = "计算工资"
- BeginProperty Font
- Name = "宋体"
- Size = 12
- Charset = 134
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- ForeColor = &H00000000&
- Height = 240
- Index = 4
- Left = 480
- TabIndex = 7
- Top = 285
- Width = 1020
- End
- End
- Begin VB.TextBox Ydtext
- BackColor = &H00C0FFFF&
- BorderStyle = 0 'None
- Height = 300
- Left = 8895
- MultiLine = -1 'True
- TabIndex = 0
- Top = 2130
- Visible = 0 'False
- Width = 1185
- End
- Begin VB.ComboBox YdCombo
- Height = 300
- Left = 8790
- Style = 2 'Dropdown List
- TabIndex = 3
- Top = 1830
- Visible = 0 'False
- Width = 1695
- End
- Begin VB.CommandButton Ydcommand
- Height = 300
- Left = 10530
- Picture = "计算工资.frx":35106
- Style = 1 'Graphical
- TabIndex = 1
- Top = 1830
- Visible = 0 'False
- Width = 300
- End
- Begin VSFlex8Ctl.VSFlexGrid WglrGrid
- Height = 6705
- Left = 75
- TabIndex = 4
- Top = 1755
- Width = 8730
- _ExtentX = 15399
- _ExtentY = 11827
- 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 = 16777215
- ForeColor = -2147483640
- BackColorFixed = 12632256
- ForeColorFixed = -2147483630
- BackColorSel = -2147483635
- ForeColorSel = -2147483634
- BackColorBkg = -2147483636
- BackColorAlternate= 16777215
- 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 = 50
- Cols = 5
- FixedRows = 1
- FixedCols = 1
- RowHeightMin = 0
- RowHeightMax = 0
- ColWidthMin = 0
- ColWidthMax = 0
- ExtendLastCol = 0 'False
- FormatString = ""
- ScrollTrack = 0 'False
- ScrollBars = 3
- ScrollTips = 0 'False
- MergeCells = 0
- MergeCompare = 0
- AutoResize = -1 'True
- AutoSizeMode = 0
- AutoSearch = 0
- MultiTotals = -1 'True
- SubtotalPosition= 1
- OutlineBar = 0
- OutlineCol = 0
- Ellipsis = 0
- ExplorerBar = 0
- PicturesOver = 0 'False
- FillStyle = 0
- RightToLeft = 0 'False
- PictureType = 0
- TabBehavior = 0
- OwnerDraw = 0
- Editable = 0 'False
- ShowComboButton = -1 'True
- WordWrap = 0 'False
- TextStyle = 0
- TextStyleFixed = 0
- OleDragMode = 0
- OleDropMode = 0
- DataMode = 0
- VirtualData = -1 'True
- End
- Begin MSComctlLib.Toolbar Tlb_Action
- Align = 1 'Align Top
- Height = 570
- Left = 0
- TabIndex = 2
- Top = 0
- Width = 11910
- _ExtentX = 21008
- _ExtentY = 1005
- ButtonWidth = 820
- ButtonHeight = 953
- AllowCustomize = 0 'False
- Wrappable = 0 'False
- Appearance = 1
- Style = 1
- ImageList = "ImageList1"
- _Version = 393216
- BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
- NumButtons = 13
- BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "设置"
- Key = "ymsz"
- Object.ToolTipText = "打印页面设置"
- ImageKey = "sz"
- EndProperty
- BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "打印"
- Key = "dy"
- Object.ToolTipText = "打印当前单据或Ctrl+P"
- ImageKey = "dy"
- EndProperty
- BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "预览"
- Key = "yl"
- Object.ToolTipText = "显示当前数据的打印模式"
- ImageKey = "yl"
- EndProperty
- BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "查询"
- Key = "Query"
- Object.ToolTipText = "以某种条件取得数据"
- ImageKey = "cx"
- EndProperty
- BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "定位"
- Key = "Locate"
- Object.ToolTipText = "根据工号或姓名定位数据"
- ImageKey = "Locate"
- EndProperty
- BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "刷新"
- Key = "Refresh"
- Object.ToolTipText = "以当前条件重新取得数据"
- ImageKey = "Refresh"
- EndProperty
- BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "计算"
- Key = "Compute"
- Object.ToolTipText = "计算工资"
- ImageKey = "Compute"
- EndProperty
- BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "项目"
- Key = "Item"
- Object.ToolTipText = "选择需要显示的项目"
- ImageKey = "Item"
- EndProperty
- BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Style = 3
- EndProperty
- BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "帮助"
- Key = "bz"
- Object.ToolTipText = "获得关于计算工资的帮助"
- ImageKey = "bz"
- EndProperty
- BeginProperty Button13 {66833FEA-8583-11D1-B16A-00C0F0283628}
- Caption = "退出"
- Key = "fh"
- Object.ToolTipText = "退出计算工资"
- ImageKey = "tc"
- EndProperty
- EndProperty
- BorderStyle = 1
- End
- Begin MSComctlLib.ImageList ImageList1
- Left = 9315
- Top = 2670
- _ExtentX = 1005
- _ExtentY = 1005
- BackColor = -2147483643
- ImageWidth = 16
- ImageHeight = 16
- MaskColor = 12632256
- _Version = 393216
- BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
- NumListImages = 32
- BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":35490
- Key = "sz"
- EndProperty
- BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3582A
- Key = "dy"
- EndProperty
- BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":35BC4
- Key = "yl"
- EndProperty
- BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":35F5E
- Key = "xg"
- EndProperty
- BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":362F8
- Key = "zh"
- EndProperty
- BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":36692
- Key = "sh"
- EndProperty
- BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":36A2C
- Key = "bc"
- EndProperty
- BeginProperty ListImage8 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":36DC6
- Key = "fq"
- EndProperty
- BeginProperty ListImage9 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":37160
- Key = "bz"
- EndProperty
- BeginProperty ListImage10 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":374FA
- Key = "tc"
- EndProperty
- BeginProperty ListImage11 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":37894
- Key = "bcgs"
- EndProperty
- BeginProperty ListImage12 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":37C2E
- Key = "mrlk"
- EndProperty
- BeginProperty ListImage13 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":37FC8
- Key = "xsxm"
- EndProperty
- BeginProperty ListImage14 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":38362
- Key = "first"
- EndProperty
- BeginProperty ListImage15 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":386FC
- Key = "prev"
- EndProperty
- BeginProperty ListImage16 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":38A96
- Key = "next"
- EndProperty
- BeginProperty ListImage17 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":38E30
- Key = "last"
- EndProperty
- BeginProperty ListImage18 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":391CA
- Key = "Item"
- EndProperty
- BeginProperty ListImage19 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":39564
- Key = "define"
- EndProperty
- BeginProperty ListImage20 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":398FE
- Key = "exec"
- EndProperty
- BeginProperty ListImage21 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":39C98
- Key = "xz"
- EndProperty
- BeginProperty ListImage22 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3A032
- Key = "sc"
- EndProperty
- BeginProperty ListImage23 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3A3CC
- Key = "sx"
- EndProperty
- BeginProperty ListImage24 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3A766
- Key = "cx"
- EndProperty
- BeginProperty ListImage25 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3AB00
- Key = "zd"
- EndProperty
- BeginProperty ListImage26 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3AE9A
- Key = "dz"
- EndProperty
- BeginProperty ListImage27 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3B234
- Key = "ph"
- EndProperty
- BeginProperty ListImage28 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3B5CE
- Key = "fz"
- EndProperty
- BeginProperty ListImage29 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3B968
- Key = "dw"
- EndProperty
- BeginProperty ListImage30 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3BD02
- Key = "Compute"
- EndProperty
- BeginProperty ListImage31 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3C09C
- Key = "Refresh"
- EndProperty
- BeginProperty ListImage32 {2C247F27-8591-11D1-B16A-00C0F0283628}
- Picture = "计算工资.frx":3C436
- Key = "Locate"
- EndProperty
- EndProperty
- End
- Begin VB.Label Lab_OperStatus
- BackColor = &H000080FF&
- Caption = "1"
- Height = 345
- Left = 10500
- TabIndex = 5
- Top = 1440
- Visible = 0 'False
- Width = 345
- End
- End
- Attribute VB_Name = "Salary_Frm_Compute"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '**************************************************************************************
- '* 模 块 名 称 计算工资
- '* 功 能 描 述 :
- '* 程序员姓名 :苗鹏
- '* 最后修改人 :苗鹏
- '* 最后修改时间:2002/01/01
- '*
- '***************************************************************************************
- '以下为自定义变量
- Dim sFields() As New CFieldValue
- Public sSqlWhere As String
- Public sSortID As String
- Public sSqlWhereTax As String
- Dim iYear As Integer
- Dim iPeriod As Integer
- Dim bRefreshData As Boolean
- '其它固定使用变量
- Dim Tsxx As String '系统信息提示(Fixed)
- Dim ReportTitle As String '报表主标题(Fixed)
- '以下为固定使用变量(网格)
- Dim Dyymctbl As New DY_Dyymsz '打印页面窗体变量
- Dim GridCode As String '显示网格网格代码
- Dim GridInf() As Variant '整个网格设置信息
- 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) '限制录入字符"'"
- Select Case KeyAscii
- Case 39 '屏蔽字符"'"
- KeyAscii = 0
- End Select
- End Sub
- Private Sub Form_Load() '窗 体 装 入
- On Error GoTo ErrCtrl
- Dim s As String
- Dim rs As New ADODB.Recordset
- Dim nod As ComboItem
- '初始化各种锁值(Fixed)
- Changelock = False '网格行列改变控制锁
- Gdtlock = False '滚动条滚动控制
- Yxxpdlock = True '字段有效性判断锁
- Hyxxpdlock = True '行有效性判断锁
- Wbkbhlock = False '文本框内容改变锁
- '报表主标题及报表编码(Fixed)
- ReportTitle = "计算工资"
- XtReportCode = "PM_ComputeSalary"
- Load Dyymctbl
- '调 入 网 格(Fixed)
- GridCode = "Pm_ComputeSalary" '网格属性编码
- 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
- '设置标题栏宽度、网格宽度高度(Fixed)
- Pic_Title.Move 50, Pic_Title.Top, Me.Width - 150, Pic_Title.Height
- WglrGrid.Move 50, Pic_Title.Top + Pic_Title.Height, Me.Width - 150
- WglrGrid.Height = Me.Height - WglrGrid.Top - 380
- '填充工资类别
- s = "select b.SortID,b.SortName FROM PM_OpeSort a inner join PM_Sort b ON a.SortID=b.SortID WHERE a.Czybm='" & Xtczybm & "'"
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- Do While Not .EOF()
- Set nod = Me.ImgCmb_Sort.ComboItems.Add(, "@" & Trim(!SortId), Trim(!SortName))
- nod.Tag = !SortId
- .MoveNext
- Loop
- .Close
- End With
- '设置状态为修改状态
- Lab_OperStatus = "2"
- '取得会计期间
- s = "select Top 1 KjYear,Period FROM GY_Kjrlb WHERE PMjzbz= 0 ORDER BY KjYear,Period "
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If Not .EOF() Then
- TextChangeLock = True
- iYear = rs!KjYear
- iPeriod = rs!Period
- Else
- MsgBox "当前会计日期未知", vbOKOnly + vbCritical
- Exit Sub
- End If
- .Close
- End With
- Set rs = Nothing
- Exit Sub
- ErrCtrl:
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = notjing
- Set nod = Nothing
- End Sub
- Private Sub Form_Unload(Cancel As Integer) '窗体卸载
- If Not Fun_Drfrmyxxpd Then
- Cancel = True
- Exit Sub
- End If
- '卸载打印页面窗体
- Unload Dyymctbl
- End Sub
- Public Function ShowRecord(sSortID As String) '查询数据填充网格
- On Error GoTo ErrCtrl
- '判断刷新是否完成
- Me.MousePointer = 11
- If bRefreshData = True Then
- Me.MousePointer = 0
- Exit Function
- End If
- '设置默认查询条件
- Dim sWhere As String
- If Trim(sSqlWhere) = "" Then
- sSqlWhere = "WHERE PM_PayRoll.DeptCode in (Select DeptCode FROM PM_OpeDept WHERE Czybm='" & Xtczybm & "') " & Chr(10) _
- & " AND PM_PayRoll.SortID in (Select SortID FROM PM_OpeSort WHERE Czybm ='" & Xtczybm & "') " & Chr(10) _
- & " AND PM_PayRoll.KjYear=" & iYear & " AND PM_PayRoll.Period=" & iPeriod
- End If
- sWhere = sSqlWhere & " AND PM_PayRoll.SortID='" & sSortID & "' " & Chr(10) _
- & " AND PM_PayRoll.KjYear=" & iYear & " AND PM_PayRoll.Period=" & iPeriod
- '定义变量
- Dim s As String
- Dim rs As New ADODB.Recordset
- Dim sSqlExec As String
- Dim sSqlSelect As String
- Dim sSqlFrom As String
- Dim sSqlOrder As String
- Dim i As Long
- Dim j As Long
- Dim iFixedCols As Integer
- Dim iBeginCol As Integer
- '初始化各种变量
- iBeginCol = GridInf(1) '数据开始行数
- 'From子句
- sSqlFrom = " FROM PM_PayRoll Inner Join Rs_BasicInfo ON Rs_BasicInfo.EmpID=PM_PayRoll.EmpID " & Chr(10) _
- & " Left Outer Join Rs_ExtendInfo ON PM_PayRoll.EmpID=Rs_ExtendInfo.EmpID " & Chr(10) _
- & " Left Outer Join PM_AttendRecord ON PM_PayRoll.EmpID=PM_AttendRecord.EmpID AND PM_PayRoll.KjYear=PM_AttendRecord.KjYear AND PM_PayRoll.Period=PM_AttendRecord.Period " & Chr(10)
- 'Order子句
- sSqlOrder = " ORDER BY PM_PayRoll.DeptCode,Rs_BasicInfo.EmpNo"
- ReDim sFields(2) '字段属性
- sFields(0).FieldName = "PM_PayRoll#DeptCode"
- sFields(0).FieldValueName = "PM_PayRoll#DeptCode#N"
- sFields(0).FieldNameC = "部门"
- sFields(0).FieldLengthInt = 0
- sFields(0).FieldLengthFra = 0
- sFields(1).FieldName = "PM_PayRoll#EmpNo"
- sFields(1).FieldValueName = "PM_PayRoll#EmpNo"
- sFields(1).FieldNameC = "工号"
- sFields(1).FieldLengthInt = 0
- sFields(1).FieldLengthFra = 0
- sFields(2).FieldName = "PM_PayRoll#EmpName"
- sFields(2).FieldValueName = "PM_PayRoll#EmpName"
- sFields(2).FieldNameC = "姓名"
- sFields(2).FieldLengthInt = 0
- sFields(2).FieldLengthFra = 0
- 'select子句
- sSqlSelect = "select Pm_PayRoll.EmpID AS Pm_PayRoll#EmpID " & Chr(10) _
- & " ,PM_PayRoll#DeptCode#N=(select DeptName FROM GY_Department a WHERE a.DeptCode=PM_PayRoll.DeptCode) " & Chr(10) _
- & " ,PM_PayRoll.EmpNo AS PM_PayRoll#EmpNo " & Chr(10) _
- & " ,PM_PayRoll.EmpName AS PM_PayRoll#EmpName " & Chr(10)
- s = "select Top 1 KjYear,Period FROM GY_Kjrlb WHERE PMjzbz= 0 ORDER BY KjYear,Period " '会计期间
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If Not .EOF() Then
- iPeriod = !Period
- iYear = !KjYear
- Else
- MsgBox "当前会计日期未知", vbOKOnly + vbCritical
- Exit Function
- End If
- .Close
- End With
- '生成查询语句
- '工资项
- s = "select b.FieldName AS FieldName ,b.ChName AS FieldNameC,b.FieldLength AS FieldLength ,b.FieldDotL AS FieldDotL " & Chr(10) _
- & " FROM PM_SortItem a inner join Rs_Items b ON a.ItemID=b.ItemID " & Chr(10) _
- & " WHERE a.HaltFlag=0 AND SortID ='" & sSortID & "'" & Chr(10) _
- & " order by a.DisplayOrder "
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- Do While Not .EOF()
- If Trim(sFields(0).FieldName) <> "" Then
- ReDim Preserve sFields(UBound(sFields) + 1)
- End If
- sFields(UBound(sFields)).FieldName = Trim("PM_PayRoll#" & Trim(!FieldName))
- sFields(UBound(sFields)).FieldValueName = Trim("PM_PayRoll#" & Trim(!FieldName))
- sFields(UBound(sFields)).FieldNameC = Trim(!FieldNameC)
- sFields(UBound(sFields)).FieldLengthInt = !FieldLength - !FieldDotL
- sFields(UBound(sFields)).FieldLengthFra = !FieldDotL
- sSqlSelect = sSqlSelect & ",PM_PayRoll." & Trim(!FieldName) & " AS " & sFields(UBound(sFields)).FieldValueName & Chr(10)
- .MoveNext
- Loop
- .Close
- End With
- With Me.WglrGrid
- '初始化网格
- .Redraw = False
- .Cols = UBound(sFields) + 2
- .FixedCols = iBeginCol + 3
- s = "#,##0"
- For i = .FixedCols To .Cols - 1
- .ColAlignment(i) = flexAlignRightCenter
- .ColFormat(i) = s & IIf(sFields(i - 1).FieldLengthFra = 0, "", "." & String(sFields(i - 1).FieldLengthFra, "0"))
- Next i
- For i = 1 To .Cols - 1
- .TextMatrix(0, i) = sFields(i - 1).FieldNameC
- .FixedAlignment(i) = flexAlignCenterCenter
- Next i
- '填充数据
- sSqlSelect = Trim(sSqlSelect)
- sSqlExec = sSqlSelect & sSqlFrom & sWhere & sSqlOrder
- Set rs = Cw_DataEnvi.DataConnect.Execute(sSqlExec)
- .Rows = .FixedRows + rs.RecordCount
- '初始化进度条
- Me.PB_Proc.Visible = True
- Me.PB_Proc.Min = 0
- Me.PB_Proc.Value = 0
- Me.PB_Proc.Max = rs.RecordCount + 1
- bRefreshData = True ' 声明正在刷新数据
- For i = .FixedRows To .Rows - 1
- '相应其他事件
- DoEvents
- '设置进度条
- Me.PB_Proc.Value = Me.PB_Proc.Value + 1
- .RowHeight(i) = GridInf(2)
- .Cell(flexcpBackColor, i, .FixedCols, i, .Cols - 1) = vbWhite
- .TextMatrix(i, 0) = rs.Fields("PM_PayRoll#EmpID")
- For j = iBeginCol To .Cols - 1
- .TextMatrix(i, j) = rs.Fields(Trim(sFields(j - iBeginCol).FieldValueName)) & ""
- If IsNumeric(.TextMatrix(i, j)) And Val(.TextMatrix(i, j)) = 0 Then
- .TextMatrix(i, j) = ""
- End If
- Next j
- rs.MoveNext
- Next i
- rs.Close
- Me.PB_Proc.Visible = False
- bRefreshData = False ' 声明刷新数据完成
- .Redraw = True
- End With
- '刷新控制数组
- GridInf(1) = iBeginCol '起始列值
- With Me.WglrGrid
- ReDim GridBoolean(.Cols - 1, 1 To 6)
- ReDim GridInt(.Cols - 1, 1 To 7)
- ReDim GridStr(.Cols - 1, 1 To 5)
- For i = 0 To iFixedCols - 1
- GridBoolean(i, 1) = False '网格列是否可编辑
- GridBoolean(i, 2) = False '网格列是否提供帮助
- GridBoolean(i, 3) = False '网格列是否列表框录入
- GridBoolean(i, 4) = False '网格列是否合计
- GridBoolean(i, 5) = False '网格内容为零是否清空
- GridBoolean(i, 6) = False '网格列是否为布尔型
- GridInt(i, 1) = 0 '字段数据类型
- GridInt(i, 2) = 100 '字段录入长度
- GridInt(i, 3) = 100 '字段整数位长度
- GridInt(i, 4) = 100 '字段小数位长度
- GridInt(i, 5) = 0 '字段不允许为空或为零
- GridInt(i, 6) = 0 '帮助类型
- GridInt(i, 7) = 0 '帮助返回值(0-显示返回编码 1-显示返回名称)
- GridStr(i, 1) = IIf(i - iBeginCol + 1 > 0, Format(i - iBeginCol + 1 > 0, "000"), Format(0, "000")) '网格列索引值
- GridStr(i, 2) = "" '字段为空提示信息
- GridStr(i, 3) = "" '通用帮助编码
- GridStr(i, 4) = "" '连接字段(通用帮助)
- GridStr(i, 5) = "" '列表框编码
- Next i
- For i = .FixedCols To .Cols - 1
- GridBoolean(i, 1) = True '网格列是否可编辑
- GridBoolean(i, 2) = False '网格列是否提供帮助
- GridBoolean(i, 3) = False '网格列是否列表框录入
- GridBoolean(i, 4) = False '网格列是否合计
- GridBoolean(i, 5) = True '网格内容为零是否清空
- GridBoolean(i, 6) = False '网格列是否为布尔型
- GridInt(i, 1) = 5 '字段数据类型
- GridInt(i, 2) = 0 '字段录入长度
- GridInt(i, 3) = sFields(i - iBeginCol).FieldLengthInt '字段整数位长度
- GridInt(i, 4) = sFields(i - iBeginCol).FieldLengthFra '字段小数位长度
- GridInt(i, 5) = 0 '字段不允许为空或为零
- GridInt(i, 6) = 0 '帮助类型
- GridInt(i, 7) = 0 '帮助返回值(0-显示返回编码 1-显示返回名称)
- GridStr(i, 1) = IIf(i - iBeginCol + 1 > 0, Format(i - iBeginCol + 1 > 0, "000"), Format(0, "000")) '网格列索引值
- GridStr(i, 2) = "" '字段为空提示信息
- GridStr(i, 3) = "" '通用帮助编码
- GridStr(i, 4) = "" '连接字段(通用帮助)
- GridStr(i, 5) = "" '列表框编码
- Next i
- End With
- Set rs = Nothing
- Me.MousePointer = 0
- Exit Function
- ErrCtrl:
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- Me.WglrGrid.Redraw = True
- Me.MousePointer = 0
- End Function
- Public Function Locate(sPerson As String) As Integer '根据工号或姓名定位人员,成功返回1,没有找到返回0,错误返回-1
- On Error GoTo ErrCtrl
- Dim i As Long, j As Long
- Dim iCol(1) As Integer
- Dim bFound As Boolean
- sPerson = UCase(Trim(sPerson))
- With Me.WglrGrid
- If .Rows = .FixedRows Then
- Exit Function
- End If
- '取得工号和姓名列
- If GetCol(sFields, iCol(0), iCol(1), Val(GridInf(1))) <> 1 Then
- MsgBox "无法找到工号和姓名列,定位失败!", vbOKOnly + vbCritical
- GoTo ErrCtrl
- End If
- bFound = False
- .Cell(flexcpBackColor, .Row, .FixedCols, .Row, .Cols - 1) = vbWhite
- For j = 0 To 1
- If iCol(j) >= 0 And bFound = False Then
- '从当前行的下一行找到末尾
- For i = .Row + 1 To .Rows - 1
- If UCase(Trim(.TextMatrix(i, iCol(j)))) = sPerson Then
- bFound = True
- .Row = i
- .TopRow = i
- .Cell(flexcpBackColor, .Row, .FixedCols, .Row, .Cols - 1) = &HFFC0C0
- Exit For
- Else
- .Cell(flexcpBackColor, i, .FixedCols, i, .Cols - 1) = vbWhite
- End If
- Next i
- '如果没有找到,从数据开始行找到当前行
- If bFound = False Then
- For i = .FixedRows To .Row
- If UCase(Trim(.TextMatrix(i, iCol(j)))) = sPerson Then
- bFound = True
- .Row = i
- .TopRow = i
- .Cell(flexcpBackColor, .Row, .FixedCols, .Row, .Cols - 1) = &HFFC0C0
- Exit For
- Else
- .Cell(flexcpBackColor, i, .FixedCols, i, .Cols - 1) = vbWhite
- End If
- Next i
- End If
- End If
- Next j
- If bFound = False Then
- Locate = 0
- Else
- Locate = 1
- End If
- End With
- Exit Function
- ErrCtrl:
- Locate = -1
- End Function
- Public Function ComputeSalary() '计算工资
- On Error GoTo ErrCtrl
- Dim s As String
- Dim sSortID As String
- Dim st As String
- Dim rs As New ADODB.Recordset
- '取得会计期间
- s = "select Top 1 KjYear,Period FROM GY_Kjrlb WHERE PMjzbz= 0 ORDER BY KjYear,Period "
- Set rs = Cw_DataEnvi.DataConnect.Execute(s)
- With rs
- If Not .EOF() Then
- iPeriod = !Period
- iYear = !KjYear
- Else
- MsgBox "当前会计日期未知", vbOKOnly + vbCritical
- Exit Function
- End If
- .Close
- End With
- Set rs = Nothing
- Me.MousePointer = 11
- sSortID = GetComboKey(Me.ImgCmb_Sort, 0)
- st = Replace(Me.sSqlWhere & " AND PM_PayRoll.SortID='" & sSortID & "'", "'", "''")
- s = "PM_SP_ComputeSalary " & "'" & sSortID & "'," & iYear & "," & iPeriod & ",'" & st & "'"
- Cw_DataEnvi.DataConnect.Execute (s)
- DoEvents
- Me.MousePointer = 0
- '刷新数据
- ShowRecord sSortID
- MsgBox "计算完成!", vbOKOnly + vbInformation
- Exit Function
- ErrCtrl:
- Me.MousePointer = 0
- If rs.State = 1 Then
- rs.Close
- End If
- Set rs = Nothing
- MsgBox "计算出现错误!", vbOKOnly + vbCritical
- End Function
- Private Sub ImgCmb_Sort_Click()
- Call Tlb_Action_ButtonClick(Me.Tlb_Action.Buttons("Refresh"))
- End Sub
- Private Sub Tlb_Action_ButtonClick(ByVal Button As MSComctlLib.Button) '用户点击工具条
- On Error GoTo ErrCtrl
- Dim frm As Form
- '屏蔽文本框,下拉组合框有效性判断
- If Not Fun_Drfrmyxxpd Then
- Exit Sub
- End If
- Valilock = True
- '屏蔽网格失去焦点产生的有效性判断
- Changelock = True
- Select Case Button.Key
- Case "ymsz" '页面设置
- Dyymctbl.Show 1
- Case "yl" '预 览
- If Fun_Drfrmyxxpd Then
- Call bbyl(True)
- End If
- Case "dy" '打 印
- If Fun_Drfrmyxxpd Then
- Call bbyl(False)
- End If
- Case "bz" '帮 助
- Call F1bz
- Case "fh" '退 出
- '如果正在刷新数据,则不允许退出
- If bRefreshData = True Then
- Exit Sub
- End If
- Unload Me
- Case "Refresh" '刷新
- With Me.ImgCmb_Sort
- If .SelectedItem Is Nothing Then
- Exit Sub
- End If
- If .SelectedItem.Key = "" Then
- Exit Sub
- End If
- ShowRecord GetComboKey(Me.ImgCmb_Sort, 0)
- End With
- Case "Query" '查询
- Set frm = New Query_Frm
- Dim coll As New Collection
- With frm
- Set .collTableName = coll
- .Show 1
- If .bChecked = False Then
- Exit Sub
- End If
- If Trim(.sSqlWhere) = "" Then
- Me.sSqlWhere = "WHERE PM_PayRoll.DeptCode in (Select DeptCode FROM PM_OpeDept WHERE Czybm='" & Xtczybm & "') " & Chr(10) _
- & " AND PM_PayRoll.SortID in (Select SortID FROM PM_OpeSort WHERE Czybm ='" & Xtczybm & "') " & Chr(10)
- Else
- Me.sSqlWhere = "WHERE PM_PayRoll.DeptCode in (Select DeptCode FROM PM_OpeDept WHERE Czybm='" & Xtczybm & "') " & Chr(10) _
- & " AND PM_PayRoll.SortID in (Select SortID FROM PM_OpeSort WHERE Czybm ='" & Xtczybm & "') " & Chr(10) _
- & " AND " & frm.sSqlWhere
- End If
- End With
- Call Tlb_Action_ButtonClick(Me.Tlb_Action.Buttons("Refresh"))
- Case "Compute" '计算工资
- If Trim(Me.ImgCmb_Sort.Text) = "" Then
- GoTo ErrCtrl
- End If
- ComputeSalary
- Case "Locate" '定位
- If Trim(Me.ImgCmb_Sort.Text) = "" Then
- GoTo ErrCtrl
- End If
- Set frm = New Locate_Frm
- With frm
- Set .frm = Me
- .Show 1
- End With
- Case "Item" '选择项目
- Set frm = New Salary_ShowItem_Frm
- Set frm.vs = Me.WglrGrid
- frm.iBeginCol = GridInf(1)
- frm.Show 1
- Set frm = Nothing
- End Select
- Set frm = Nothing
- '解 锁
- Valilock = False
- Changelock = False
- Exit Sub
- ErrCtrl:
- Set frm = Nothing
- '解 锁
- Valilock = False
- Changelock = False
- End Sub
- Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) '支持热键操作
- If Shift = 2 Then
- Select Case UCase(Chr(KeyCode))
- Case "P" 'Ctrl+P 打印
- If Tlb_Action.Buttons("dy").Enabled Then
- Call bbyl(False)
- End If
- End Select
- End If
- 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 '临时列计数器
- Dim RecTemp As New ADODB.Recordset '临时使用动态集
- Dim Dbl_Qcye As Double '临时期初余额
- With WglrGrid
- '非录入状态有效性为合法
- If Yxxpdlock Or .Row < .FixedRows Then
- sjzdyxxpd = True
- Exit Function
- End If
- Str_JudgeText = Trim(.TextMatrix(Dqpdwgh, Dqpdwgl))
- Select Case GridStr(Dqpdwgl, 1)
- '以下为自定义部分[
- '1.放置字段有效性判断程序
- 'Case "004"
- '2.放置字段事后处理程序
- '以上为自定义部分]
- End Select
- '字段录入正确后为零字段清空
- Call Qkwlzd(Dqpdwgh, Dqpdwgl)
- sjzdyxxpd = True
- Yxxpdlock = True
- Exit Function
- End With
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts(Tsxx, 0, 1)
- Changelock = True
- .Select Dqpdwgh, Dqpdwgl
- Changelock = False
- Call xswbk
- sjzdyxxpd = False
- Exit Function
- End With
- End Function
- Private Function Sjhzyxxpd(ByVal Yxxpdh As Long) As Boolean '录入数据行有效性判断,同时进行行处理
- Dim Lrywlz As Long '录入错误列值(Fixed)
- Dim s As String '临时查询字符串
- Dim i As Long
- With WglrGrid
- '行没有发生变化则不进行有效性判断
- If Hyxxpdlock Then
- Sjhzyxxpd = True
- Exit Function
- End If
- '以下为自定义部分[
- '1.1首先进行单个不能为空或不能为零判断(Fixed)
- For jsqte = Qslz To .Cols - 1
- '字段不能为空
- If GridInt(jsqte, 5) = 1 Then
- If Len(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
- Tsxx = GridStr(jsqte, 2)
- Lrywlz = jsqte
- GoTo Lrcwcl
- Exit For
- End If
- End If
- '字段不能为零
- If GridInt(jsqte, 5) = 2 Then
- If Val(Trim(.TextMatrix(Yxxpdh, jsqte))) = 0 Then
- Tsxx = GridStr(jsqte, 2)
- Lrywlz = jsqte
- GoTo Lrcwcl
- Exit For
- End If
- End If
- Next jsqte
- '1.2进行其他有效性判断,编写格式同1.1
- '2.放置行处理程序(当数据行通过有效性判断)
- On Error GoTo Swcwcl
- With Me.WglrGrid
- For i = .FixedCols To .Cols - 1
- s = s & "," & Replace(sFields(i - GridInf(1)).FieldName, "#", ".") & "=" & Val(.TextMatrix(Yxxpdh, i)) & Chr(10)
- Next i
- If Trim(s) <> "" Then
- s = Trim(s)
- s = Mid(s, 2, Len(s) - 1)
- s = "update PM_PayRoll set " & s & " WHERE EmpID=" & .TextMatrix(Yxxpdh, 0) & " AND SortID='" & GetComboKey(Me.ImgCmb_Sort, 0) & "' " & Chr(10) _
- & " AND Period=" & iPeriod & " AND KjYear =" & iYear
- Else
- Exit Function
- End If
- End With
- Cw_DataEnvi.DataConnect.BeginTrans
- Cw_DataEnvi.DataConnect.Execute (s)
- Cw_DataEnvi.DataConnect.CommitTrans
- End With
- '以上为自定义部分]
- Sjhzyxxpd = True
- Hyxxpdlock = True
- Exit Function
- Swcwcl:
- Cw_DataEnvi.DataConnect.RollbackTrans
- Tsxx = "存盘过程中出现未知错误,程序自动恢复保存前状态!"
- Call Xtxxts(Tsxx, 0, 1)
- Exit Function
- Lrcwcl: '录入错误处理
- With WglrGrid
- Call Xtxxts(Tsxx, 0, 1)
- Changelock = True
- .Select Yxxpdh, Lrywlz
- Changelock = False
- Call xswbk
- Sjhzyxxpd = False
- Exit Function
- End With
- End Function
- '===================以 下 程 序 为 通 用 部 分 ,一 般 不 需 更 改(程序动作部分)======================='
- Private Sub Lrzdbz() '录入字段帮助
- If Not Ydcommand.Visible Then
- Exit Sub
- End If
- With WglrGrid
- Valilock = True
- '处理通用部分
- Changelock = True '调入另外窗体必须加锁
- 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
- 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_EnterCell() '显示当前数据行相关信息
- With WglrGrid
- If .Row >= .FixedRows Then
- '[>>
- '此处可以填写显示与此网格行相关信息
- '<<]
- 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_LostFocus() '录入网格失去焦点
- '用以屏蔽调用其它窗体时发生网格失去焦点事件
- If Changelock Then
- Exit Sub
- End If
- '引发网格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 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 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() '鼠标双击网格显示文本框
- With WglrGrid
- Call xswbk
- 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
- jzzx:
- End With
- 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)
- 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
- If Rowjsq <= .Rows - 1 Then
- .Select Rowjsq, Coljsq
- End If
- Case vbKeyUp '上 箭 头 =38
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- If .Row > .FixedRows Then
- .Row = .Row - 1
- End If
- Case vbKeyDown '下 箭 头 =40
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- If .Row < .Rows - 1 Then
- .Row = .Row + 1
- End If
- Case vbKeyLeft '左 箭 头 =37
- If .Col - 1 = Qslz Then
- If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
- GoTo jzzx
- End If
- End If
- If Ydtext.SelStart = 0 And .Col > Qslz Then
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- Coljsq = .Col - 1
- Do While Coljsq > Qslz
- If Coljsq - 1 = Qslz Then
- If .ColHidden(Qslz) Or (Not GridBoolean(Qslz, 1)) Then
- GoTo jzzx
- End If
- End If
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq - 1
- Else
- Exit Do
- End If
- Loop
- .Select .Row, Coljsq
- End If
- jzzx:
- Case vbKeyRight '右 箭 头 =39
- wblong = Len(Ydtext.Text)
- If (Ydtext.SelStart = wblong Or Ydtext.SelLength = wblong) Then
- KeyCode = 0
- .SetFocus
- Call Lrsjhx
- Rowjsq = .Row
- Coljsq = .Col + 1
- If Coljsq > .Cols - 1 Then
- If Rowjsq < .Rows - 1 Then
- Rowjsq = Rowjsq + 1
- End If
- Coljsq = Qslz
- End If
- Do While Rowjsq <= .Rows - 1
- If .ColHidden(Coljsq) Or (Not GridBoolean(Coljsq, 1)) Then
- Coljsq = Coljsq + 1
- If Coljsq > .Cols - 1 Then
- Rowjsq = Rowjsq + 1
- Coljsq = Qslz
- End If
- Else
- Exit Do
- End If
- Loop
- .Select Rowjsq, Coljsq
- End If
- Case Else
- End Select
- End With
- End Sub
- Private Sub ydtext_KeyPress(KeyAscii As Integer) '录入字符事中控制
- Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
- End Sub
- Private Sub ydtext_Change() '录入事中变化处理
- '防止程序改变但不进行处理
- If Wbkbhlock Then
- Exit Sub
- End If
- With WglrGrid
- '限制字段录入长度
- Wbkbhlock = True
- Call TextChangeLimit(Ydtext, GridInt(.Col, 1)) '去掉无效字符
- Select Case GridInt(.Col, 1)
- Case 8, 11 '金额型
- Call Sjgskz(Ydtext, Xtjezws - Xtjexsws - 1, Xtjexsws)
- Case 9, 12 '数量型
- Call Sjgskz(Ydtext, Xtslzws - Xtslxsws - 1, Xtslxsws)
- Case 10 '单价型
- Call Sjgskz(Ydtext, Xtdjzws - Xtdjxsws - 1, Xtdjxsws)
- Case Else '其他类型
- If GridInt(.Col, 3) <> 0 Or GridInt(.Col, 4) <> 0 Then
- Call Sjgskz(Ydtext, GridInt(.Col, 3), GridInt(.Col, 4))
- End If
- End Select
- Wbkbhlock = False
- End With
- End Sub
- Private Sub ydtext_LostFocus() '如果由于选中网格之外的控件而发生有效性判断(选中网格会先发生Rowcolchange事件置Valiock为TRUE)
- With WglrGrid
- If Not Valilock Then
- Call Lrsjhx
- If Not sjzdyxxpd(Dqlrwgh, Dqlrwgl) Then
- Exit Sub
- End If
- If Not Sjhzyxxpd(Dqlrwgh) Then
- Exit Sub
- End If
- End If
- End With
- End Sub
- Private Sub xswbk() '在当前选中单元显示文本框,列表框,帮助按钮(通用)
- On Error Resume Next
- Dim Wbkpy As Integer, Wbkpy1 As Integer '文本框偏移量
- '当某种条件成立时禁止文本框激活使单据处于录入状态
- If Not Fun_AllowInput Then
- Exit Sub
- End If
- '显示文本框前返回有效行列(解决滚动条问题)
- Call Xldqh
- Call Xldql
- '隐藏文本框,帮助按钮,列表组合框
- Call Ycwbk
- With WglrGrid
- Dqlrwgh = .Row
- Dqlrwgl = .Col
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
- Exit Sub
- End If
- 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
- Call Wbkcl
- If .ColHidden(.Col) = False Then
- Ydtext.Visible = True
- End If
- Ydtext.SetFocus
- End If
- Dqtoprow = .TopRow
- Dqleftcol = .LeftCol
- '重置锁值
- Valilock = False
- Wbkbhlock = False
- End With
- End Sub
- Private Function Fun_AllowInput() As Boolean '当某种条件成立时禁止文本框激活使单据处于录入状态
- '如果单据操作状态为浏览状态则不能显示录入载体(通用)
- If Trim(Lab_OperStatus.Caption) = "1" Then
- Exit Function
- End If
- '[>>
- '此处可以填写禁止文本框激活使单据处于录入状态的理由
- '<<]
- Fun_AllowInput = True
- End Function
- Private Sub 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 Lrsjhx() '文本框录入数据回写
- With WglrGrid
- If YdCombo.Visible Then
- .Text = Trim(YdCombo.Text)
- End If
- If Ydtext.Visible Then
- .Text = Trim(Ydtext.Text)
- End If
- '(如果字段录入内容发生变化,则打开有效性判断锁)
- If Zdlrqnr <> Trim(.Text) Then
- Yxxpdlock = False
- Hyxxpdlock = False
- End If
- '隐藏文本框,帮助按钮,列表组合框
- Call Ycwbk
- 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 vbKeyF2 '按F2键参照
- Call xswbk
- Call Lrzdbz
- End Select
- End Sub
- Private Sub WglrGrid_KeyPress(KeyAscii As Integer) '网格接受键盘录入
- '当某种条件成立时禁止文本框激活使单据处于录入状态
- If Not Fun_AllowInput Then
- Exit Sub
- End If
- 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)) Then
- Coljsq = Coljsq + 1
- If Coljsq > .Cols - 1 Then
- Rowjsq = Rowjsq + 1
- Coljsq = Qslz
- End If
- Else
- Exit Do
- End If
- Loop
- If Rowjsq <= .Rows - 1 Then
- .Select Rowjsq, Coljsq
- End If
- Exit Sub
- End If
- '接受用户录入
- Select Case KeyAscii
- Case 0 To 32 '用户输入KeyAscii为0-32的键 如空格
- '显示录入载体
- Call xswbk
- Case Else
- '防止非编辑字段SendKeys()出现死循环
- If Not GridBoolean(.Col, 1) Or .Row < .FixedRows Then
- Exit Sub
- End If
- '如果此字段为列表框录入则调入相应列表框
- If GridBoolean(.Col, 3) Then
- '列表框录入
- Call xswbk
- Else
- Ydtext.Text = ""
- '录入限制
- Call InputFieldLimit(Ydtext, GridInt(WglrGrid.Col, 1), KeyAscii)
- If KeyAscii = 0 Then
- Exit Sub
- End If
- Call xswbk
- Ydtext.Text = ""
- Valilock = True
- SendKeys Chr(KeyAscii), True
- DoEvents
- Valilock = False
- End If
- End Select
- End With
- End Sub
- Private Sub Qkwlzd(sjh As Long, Sjl As Long) '清空为零字段
- If Not GridBoolean(Sjl, 5) Then
- Exit Sub
- End If
- With WglrGrid
- If Val(Trim(.TextMatrix(sjh, Sjl))) = 0 Then
- .TextMatrix(sjh, Sjl) = ""
- End If
- End With
- End Sub
- Private Sub fhyxh() '返回录入数据有效行,同时让得到焦点网格可见
- With WglrGrid
- If .Row >= .FixedRows Then
- 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
- If .TopRow > 1 Then
- .TopRow = .TopRow - 1
- End If
- Loop
- End With
- End Sub
- Private Sub Xldql() '显露当前列
- Dim Leftcolte As Long
- With WglrGrid
- If .Col >= Qslz And .Col >= .FixedCols Then
- If .LeftCol > .Col Then
- .LeftCol = .Col
- End If
- Leftcolte = 0
- Do While .CellLeft + .CellWidth > .Width And .LeftCol <> Leftcolte
- Leftcolte = .LeftCol
- .LeftCol = .LeftCol + 1
- Loop
- End If
- End With
- End Sub
- Private Sub WglrGrid_BeforeMoveColumn(ByVal Col As Long, Position As Long) '网格列发生移动时自动交换网格索引信息
- Call FnBln_RefreshArray(Col, Position, GridStr(), GridInf())
- 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 = 2 '报 表 小 标 题 行 数
- 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
- Bbxbt(2) = "工资类别:" & Me.ImgCmb_Sort.Text
- 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