📄 frmhrd301.frm
字号:
VERSION 5.00
Object = "{C03AAB1E-221B-11D4-AB3A-00C04F09719C}#1.0#0"; "ISGrid2.dll"
Begin VB.Form frmhrd301
Caption = "考勤资料查询"
ClientHeight = 7905
ClientLeft = 60
ClientTop = 345
ClientWidth = 11745
LinkTopic = "Form1"
LockControls = -1 'True
MDIChild = -1 'True
ScaleHeight = 7905
ScaleWidth = 11745
WindowState = 2 'Maximized
Begin ISGRIDLibCtl.MSFlexGrid MSF3
Height = 3495
Left = 8640
TabIndex = 10
Top = 4080
Width = 2895
_ExtentX = 5106
_ExtentY = 6165
_Version = 393216
End
Begin ISGRIDLibCtl.MSFlexGrid MSF2
Height = 2895
Left = 8640
TabIndex = 9
Top = 720
Width = 2895
_ExtentX = 5106
_ExtentY = 5106
_Version = 393216
End
Begin ISGRIDLibCtl.MSFlexGrid MSF1
Height = 6855
Left = 0
TabIndex = 8
Top = 720
Width = 8415
_ExtentX = 14843
_ExtentY = 12091
_Version = 393216
End
Begin VB.CommandButton cmdPrt
Caption = "打印"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 7320
TabIndex = 7
Top = 120
Width = 1000
End
Begin VB.CommandButton cmdInq
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 400
Left = 6000
TabIndex = 6
Top = 120
Width = 1000
End
Begin VB.TextBox txtItem
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Index = 2
Left = 4790
MaxLength = 6
TabIndex = 5
Text = "999999"
Top = 160
Width = 1000
End
Begin VB.TextBox txtItem
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Index = 1
Left = 2815
MaxLength = 6
TabIndex = 4
Text = "000000"
Top = 160
Width = 1000
End
Begin VB.TextBox txtItem
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 375
Index = 0
Left = 840
MaxLength = 6
TabIndex = 3
Top = 160
Width = 1000
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "工号止"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3965
TabIndex = 2
Top = 240
Width = 675
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "工号起"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 1990
TabIndex = 1
Top = 240
Width = 675
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "月份"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 0
Top = 240
Width = 450
End
End
Attribute VB_Name = "frmhrd301"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim txtSql As String
Private Sub cmdInq_Click()
If Not check_hrd301 Then
Exit Sub
End If
'txtSql = "select * from dutdata where DealMonth='" & Trim(txtItem(0).Text) & "' and Id >='" & Trim(txtItem(1).Text) & "' and Id <='" & Trim(txtItem(2).Text) & "'"
Call ShowMSF1Title
Call ShowMSF1Data
End Sub
Private Sub Form_Load()
Me.Left = 0
Me.Top = 0
Call Init
End Sub
Private Sub Init()
txtItem(0).Text = Format(Date, "yyyymm")
End Sub
Private Sub ShowMSF1Data()
txtSql = "select * from dutdata where DealMonth='" & Trim(txtItem(0).Text) & "' and Id >='" & Trim(txtItem(1).Text) & "' and Id <='" & Trim(txtItem(2).Text) & "'"
Set mrc = Nothing
Set mrc = ExecuteSQL(txtSql)
If Not mrc.EOF Then
With MSF1
.Rows = 50
.Row = 1
Do While Not mrc.EOF
.Rows = .Rows + 1
For i = 1 To mrc.Fields.Count
If i = 2 Then
.TextMatrix(.Row, i) = findIdName(mrc.Fields(i - 2))
Else
.TextMatrix(.Row, i) = mrc.Fields(i - 1)
End If
Next i
.Row = .Row + 1
mrc.MoveNext
Loop
End With
End If
End Sub
Private Sub ShowMSF2Data()
Dim mrc2 As ADODB.Recordset
Dim txtSql2 As String
Dim tempId As String
Dim tempDate As String
tempDate = Left(Trim(txtItem(0).Text), 4) + "-" + Right(Trim(txtItem(0).Text), 2) + "-" + MSF1.TextMatrix(0, MSF1.Col)
tempId = MSF1.TextMatrix(MSF1.Row, 1)
txtSql2 = " select * from daydata where Id ='" & tempId & "' and BrushDate='" & tempDate & "'"
Set mrc2 = Nothing
Set mrc2 = ExecuteSQL(txtSql2)
If Not mrc2.EOF Then
With MSF2
.Rows = 10
.Row = 1
Do While Not mrc2.EOF
.Rows = .Rows + 1
.TextMatrix(.Row, 1) = mrc2.Fields(2).Value
.Row = .Row + 1
mrc2.MoveNext
Loop
End With
End If
End Sub
Private Sub ShowMSF2Title()
Dim i As Integer
MSF2.Clear
With MSF2
.Cols = 2
.TextMatrix(0, 1) = "刷卡时间"
.ColWidth(0) = 200
.ColWidth(1) = 1500
.FixedRows = 1
.ColAlignment(1) = 0
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Private Sub ShowMSF3Data()
Dim mrc3 As ADODB.Recordset
Dim txtSql3 As String
Dim tempId As String
Dim tempDate As String
tempDate = Left(Trim(txtItem(0).Text), 4) + "-" + Right(Trim(txtItem(0).Text), 2) + "-" + MSF1.TextMatrix(0, MSF1.Col)
tempId = MSF1.TextMatrix(MSF1.Row, 1)
txtSql3 = " select * from abnormity where Id ='" & tempId & "' and DealDate='" & tempDate & "'"
Set mrc3 = Nothing
Set mrc3 = ExecuteSQL(txtSql3)
If Not mrc3.EOF Then
With MSF3
.Rows = 10
.Row = 1
Do While Not mrc3.EOF
.Rows = .Rows + 1
.TextMatrix(.Row, 1) = findAbnormity(mrc3.Fields(2).Value)
.TextMatrix(.Row, 2) = mrc3.Fields(3).Value
.Row = .Row + 1
mrc3.MoveNext
Loop
End With
End If
End Sub
Private Function findAbnormity(ByVal vtId As String) As String
findAbnormity = ""
Select Case vtId
Case "01"
findAbnormity = "迟到"
Case "02"
findAbnormity = "早退"
Case "03"
findAbnormity = "旷工"
End Select
End Function
Private Sub ShowMSF3Title()
Dim i As Integer
MSF3.Clear
With MSF3
.Cols = 3
.TextMatrix(0, 1) = "异常原因"
.TextMatrix(0, 2) = "次数"
.ColWidth(0) = 200
.ColWidth(1) = 1200
.ColWidth(1) = 800
.FixedRows = 1
For i = 1 To 2
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Private Sub ShowMSF1Title()
MSF1.Clear
Dim i As Integer
With MSF1
.Cols = 34
.TextMatrix(0, 1) = "工号"
.TextMatrix(0, 2) = "姓名"
.TextMatrix(0, 3) = "01"
.TextMatrix(0, 4) = "02"
.TextMatrix(0, 5) = "03"
.TextMatrix(0, 6) = "04"
.TextMatrix(0, 7) = "05"
.TextMatrix(0, 8) = "06"
.TextMatrix(0, 9) = "07"
.TextMatrix(0, 10) = "08"
.TextMatrix(0, 11) = "09"
.TextMatrix(0, 12) = "10"
.TextMatrix(0, 13) = "11"
.TextMatrix(0, 14) = "12"
.TextMatrix(0, 15) = "13"
.TextMatrix(0, 16) = "14"
.TextMatrix(0, 17) = "15"
.TextMatrix(0, 18) = "16"
.TextMatrix(0, 19) = "17"
.TextMatrix(0, 20) = "18"
.TextMatrix(0, 21) = "19"
.TextMatrix(0, 22) = "20"
.TextMatrix(0, 23) = "21"
.TextMatrix(0, 24) = "22"
.TextMatrix(0, 25) = "23"
.TextMatrix(0, 26) = "24"
.TextMatrix(0, 27) = "25"
.TextMatrix(0, 28) = "26"
.TextMatrix(0, 29) = "27"
.TextMatrix(0, 30) = "28"
.TextMatrix(0, 31) = "29"
.TextMatrix(0, 32) = "30"
.TextMatrix(0, 33) = "31"
.ColWidth(0) = 200
.ColWidth(1) = 800
.ColWidth(2) = 1200
.ColWidth(3) = 400
.ColWidth(4) = 400
.ColWidth(5) = 400
.ColWidth(6) = 400
.ColWidth(7) = 400
.ColWidth(8) = 400
.ColWidth(9) = 400
.ColWidth(10) = 400
.ColWidth(11) = 400
.ColWidth(12) = 400
.ColWidth(13) = 400
.ColWidth(14) = 400
.ColWidth(15) = 400
.ColWidth(16) = 400
.ColWidth(17) = 400
.ColWidth(18) = 400
.ColWidth(19) = 400
.ColWidth(20) = 400
.ColWidth(21) = 400
.ColWidth(22) = 400
.ColWidth(23) = 400
.ColWidth(24) = 400
.ColWidth(25) = 400
.ColWidth(26) = 400
.ColWidth(27) = 400
.ColWidth(28) = 400
.ColWidth(29) = 400
.ColWidth(30) = 400
.ColWidth(31) = 400
.ColWidth(32) = 400
.ColWidth(33) = 400
.FixedRows = 1
For i = 1 To 33
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Private Function findIdName(ByVal vtId As String) As String
Dim mrcId As ADODB.Recordset
findIdName = ""
txtSql = "select Id,Name from employee where Id ='" & Trim(vtId) & "'"
Set mrcId = Nothing
Set mrcId = ExecuteSQL(txtSql)
If Not mrcId.EOF Then
findIdName = mrcId.Fields(1).Value
End If
Set mrcId = Nothing
End Function
Private Sub MSF1_Click()
If MSF1.Col >= 3 Then
Call ShowMSF2Title
Call ShowMSF2Data
Call ShowMSF3Title
Call ShowMSF3Data
End If
End Sub
Private Sub txtItem_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAsScii = 13 Then
If Index < 2 Then
txtItem(Index + 1).SetFocus
Else
cmdInq.SetFocus
End If
End If
End Sub
Private Function check_hrd301() As Boolean
Dim i As Integer
check_hrd301 = True
For i = 0 To 2
If txtItem(i).Text = "" Then
MsgBox "输入的数据不能为空", vbCritical + vbOKOnly, "错误提示:"
check_hrd301 = False
txtItem(0).SetFocus
Exit For
End If
Next i
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -