📄 frmcheckkq.frm
字号:
VERSION 5.00
Begin VB.Form frmCheckKQ
Caption = "查询员工考勤信息"
ClientHeight = 4185
ClientLeft = 60
ClientTop = 345
ClientWidth = 5760
ControlBox = 0 'False
LinkTopic = "Form1"
ScaleHeight = 4185
ScaleWidth = 5760
StartUpPosition = 2 '屏幕中心
Begin VB.CheckBox Timechecked
Caption = "时间"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 15
Top = 960
Width = 1695
End
Begin VB.CommandButton cmdCancel
Caption = "取消"
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3600
TabIndex = 14
Top = 3480
Width = 1575
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Default = -1 'True
BeginProperty Font
Name = "楷体_GB2312"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 720
TabIndex = 13
Top = 3480
Width = 1575
End
Begin VB.Frame Frame1
Height = 1815
Left = 240
TabIndex = 2
Top = 1560
Width = 5055
Begin VB.ComboBox toMonth
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2880
TabIndex = 11
Top = 1080
Width = 1215
End
Begin VB.ComboBox toYear
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 840
TabIndex = 9
Top = 1080
Width = 1215
End
Begin VB.ComboBox FromMonth
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 2880
TabIndex = 6
Top = 360
Width = 1215
End
Begin VB.ComboBox fromYear
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 840
TabIndex = 4
Top = 360
Width = 1215
End
Begin VB.Label Label6
Caption = "月"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4320
TabIndex = 12
Top = 1080
Width = 495
End
Begin VB.Label Label5
Caption = "年"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2280
TabIndex = 10
Top = 1080
Width = 375
End
Begin VB.Label Label4
Caption = "到"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 8
Top = 1080
Width = 375
End
Begin VB.Label Label3
Caption = "月"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 4320
TabIndex = 7
Top = 480
Width = 495
End
Begin VB.Label Label2
Caption = "年"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2280
TabIndex = 5
Top = 480
Width = 375
End
Begin VB.Label Label1
Caption = "从"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 3
Top = 480
Width = 375
End
End
Begin VB.TextBox StuffID
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
TabIndex = 1
Top = 360
Width = 2535
End
Begin VB.CheckBox IDchecked
Caption = "员工编号"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 600
TabIndex = 0
Top = 360
Width = 1575
End
End
Attribute VB_Name = "frmCheckKQ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private querystring As String '保存查询出勤SQL语句
Private queryleave As String '保存查询请假SQL语句
Private queryovertime As String '保存查询加班SQL 语句
Private queryerrand As String '保存查询出差SQL语句
Private Sub cmdCancel_Click()
Unload Me
Exit Sub
End Sub
Private Sub setQuerystring()
Dim fromtime As String
Dim totime As String
fromtime = Me.FromYear & "-" & Me.FromMonth & "-1"
totime = Me.ToYear & "-" & Me.ToMonth & "-1"
MsgBox fromtime
MsgBox totime
If Me.IDchecked.Value = vbChecked And Me.Timechecked.Value = vbChecked Then
querystring = "select * from AttendanceInfo where AStuffID='" & Me.StuffID & "'"
querystring = querystring & " and ADate between #" & fromtime & "# and #" & totime & "#"
querystring = querystring & " order by ID"
queryleave = "select * from LeaveInfo where LStuffID='" & Me.StuffID & "'"
queryleave = queryleave & " and LFromDay between #" & fromtime & "# and #" & totime & "#"
queryleave = queryleave & " order by LID"
queryovertime = "select * from OvertimeInfo where OStuffID='" & Me.StuffID & "'"
queryovertime = queryovertime & " and OFromDay between #" & fromtime & "# and #" & totime & "#"
queryovertime = queryovertime & " order by OID"
queryerrand = "select * from ErrandInfo where EStuffID='" & Me.StuffID & "'"
queryerrand = queryerrand & " and EFromday between #" & fromtime & "# and #" & totime & "#"
queryerrand = queryerrand & " order by EID"
ElseIf Me.Timechecked.Value = vbChecked Then
querystring = "select * from AttendanceInfo where ADate between #" & fromtime
querystring = querystring & "# and #" & totime & "# order by AStuffID"
queryleave = "select * from LeaveInfo where LFromDay between #" & fromtime
queryleave = queryleave & "# and #" & totime & "# order by LStuffID"
queryovertime = "select * from OvertimeInfo where OFromDay between #" & fromtime
queryovertime = queryovertime & "# and #" & totime & "# order by OStuffID"
queryerrand = "select * from ErrandInfo where EFromday between #" & fromtime
queryerrand = queryerrand & "# and #" & totime & "# order by EStuffID"
ElseIf Me.IDchecked.Value = vbChecked Then
querystring = "select * from AttendanceInfo where AStuffID='" & Me.StuffID & "'"
querystring = querystring & " order by ID"
queryleave = "select * from LeaveInfo where LStuffID='" & Me.StuffID & "'"
queryleave = queryleave & " order by LID"
queryovertime = "select * from OvertimeInfo where OStuffID='" & Me.StuffID & "'"
queryovertime = queryovertime & " order by OID"
queryerrand = "select * from ErrandInfo where EStuffID='" & Me.StuffID & "'"
queryerrand = queryerrand & " order by EID"
Else
querystring = "select * from AttendanceInfo order by ID"
queryleave = "select * from LeaveInfo order by LID"
queryovertime = "select * from OvertimeInfo order by OID"
queryerrand = "select * from ErrandInfo order by EID"
End If
End Sub
Private Sub cmdOK_Click()
If Me.IDchecked.Value = vbChecked And Me.StuffID = "" Then
MsgBox "请输入员工编号!", vbOKOnly + vbExclamation, "警告!"
Me.StuffID.SetFocus
End If
Call setQuerystring
Call frmkqcheckresult.ATopic
Call frmkqcheckresult.ShowAResult(querystring)
Call frmkqcheckresult.LTopic
Call frmkqcheckresult.ShowLResult(queryleave)
Call frmkqcheckresult.OTopic
Call frmkqcheckresult.ShowOResult(queryovertime)
Call frmkqcheckresult.ETopic
Call frmkqcheckresult.ShowEReslut(queryerrand)
frmkqcheckresult.Show
frmkqcheckresult.ZOrder 0
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim SQL As String
Dim rs As New ADODB.Recordset
SQL = "select distinct ADate from AttendanceInfo"
Set rs = TransactSQL(SQL)
If Not rs.EOF Then
rs.MoveFirst
While Not rs.EOF
If Not IsNull(rs.Fields(0)) Then '设置年
Me.FromYear.AddItem Left(rs(0), 4)
Me.ToYear.AddItem Left(rs(0), 4)
End If
rs.MoveNext
Wend
rs.Close
Me.FromYear.ListIndex = 0
Me.ToYear.ListIndex = 0
End If
For i = 1 To 12 '设置月
Me.FromMonth.AddItem i
Me.ToMonth.AddItem i
Next i
Me.FromMonth.ListIndex = 0
Me.ToMonth.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -