📄 form16frm.frm
字号:
VERSION 5.00
Begin VB.Form Form15
Caption = "查询员工考勤信息"
ClientHeight = 9165
ClientLeft = 60
ClientTop = 345
ClientWidth = 8070
Icon = "Form16frm.frx":0000
LinkTopic = "Form15"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 9165
ScaleWidth = 8070
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 4800
TabIndex = 11
Top = 7920
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1080
TabIndex = 10
Top = 7920
Width = 1215
End
Begin VB.TextBox Text1
Height = 615
Left = 3120
TabIndex = 9
Top = 960
Width = 2175
End
Begin VB.Frame Frame1
Height = 3495
Left = 480
TabIndex = 2
Top = 4200
Width = 6855
Begin VB.ComboBox Combo2
Height = 300
Left = 1560
TabIndex = 15
Top = 600
Width = 1095
End
Begin VB.ComboBox Combo3
Height = 300
Left = 4320
TabIndex = 14
Top = 600
Width = 1095
End
Begin VB.ComboBox Combo4
Height = 300
Left = 1560
TabIndex = 13
Top = 1440
Width = 1095
End
Begin VB.ComboBox Combo5
Height = 300
Left = 4320
TabIndex = 12
Top = 1440
Width = 1095
End
Begin VB.Label Label3
Caption = "月"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 1
Left = 5640
TabIndex = 8
Top = 1560
Width = 1095
End
Begin VB.Label Label2
Caption = "年"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 1
Left = 3120
TabIndex = 7
Top = 1440
Width = 735
End
Begin VB.Label Label4
Caption = "到"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
TabIndex = 6
Top = 1560
Width = 735
End
Begin VB.Label Label3
Caption = "月"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Index = 0
Left = 5640
TabIndex = 5
Top = 600
Width = 1095
End
Begin VB.Label Label2
Caption = "年"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Index = 0
Left = 3120
TabIndex = 4
Top = 600
Width = 735
End
Begin VB.Label Label1
Caption = "从"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 3
Top = 600
Width = 855
End
End
Begin VB.CheckBox Check2
Caption = "时间"
BeginProperty Font
Name = "华文行楷"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800080&
Height = 375
Left = 840
TabIndex = 1
Top = 2280
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "员工编号"
BeginProperty Font
Name = "华文行楷"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800080&
Height = 735
Left = 720
TabIndex = 0
Top = 840
Width = 1455
End
Begin VB.Image Image1
Height = 4470
Left = 4920
Picture = "Form16frm.frx":08CA
Top = -120
Width = 1875
End
End
Attribute VB_Name = "Form15"
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 Combo5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub setQuerystring()
Dim fromtime As String
Dim totime As String
fromtime = Me.Combo2 & "-" & Me.Combo3 & "-1"
totime = Me.Combo4 & "-" & Me.Combo5 & "-1"
MsgBox fromtime
MsgBox totime
If Me.Check1.Value = vbChecked And Me.Check2.Value = vbChecked Then
querystring = "select * from test where astuffid='" & Me.Text1 & "'"
querystring = querystring & " and adate between #" & fromtime & "# and #" & totime & "#"
querystring = querystring & " order by ID"
queryleave = "select * from Ill where lstuffid='" & Me.Text1 & "'"
queryleave = queryleave & " and lfromday between #" & fromtime & "# and #" & totime & "#"
queryleave = queryleave & " order by lid"
queryovertime = "select * from OvertimeInfo where ostuffid='" & Me.Text1 & "'"
queryovertime = queryovertime & " and ofromday between #" & fromtime & "# and #" & totime & "#"
queryovertime = queryovertime & " order by oid"
queryerrand = "select * from errand where estuffid='" & Me.Text1 & "'"
queryerrand = queryerrand & " and efromday between #" & fromtime & "# and #" & totime & "#"
queryerrand = queryerrand & " order by eid"
ElseIf Me.Check2.Value = vbChecked Then
querystring = "select * from test where adate between #" & fromtime
querystring = querystring & "# and #" & totime & "# order by astuffid"
queryleave = "select * from Ill 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 errand where efromday between #" & fromtime
queryerrand = queryerrand & "# and #" & totime & "# order by estuffid"
ElseIf Me.Check1.Value = vbChecked Then
querystring = "select * from test where astuffid='" & Me.Text1 & "'"
querystring = querystring & " order by ID"
queryleave = "select * from Ill where lstuffid='" & Me.Text1 & "'"
queryleave = queryleave & " order by lid"
queryovertime = "select * from OvertimeInfo where ostuffid='" & Me.Text1 & "'"
queryovertime = queryovertime & " order by oid"
queryerrand = "select * from errand where estuffid='" & Me.Text1 & "'"
queryerrand = queryerrand & " order by eid"
Else
querystring = "select * from test order by ID"
queryleave = "select * from Ill order by lid"
queryovertime = "select * from OvertimeInfo order by oid"
queryerrand = "select * from errand order by eid"
End If
End Sub
Private Sub Command1_Click()
If Me.Check1.Value = vbChecked And Me.Text1 = "" Then
MsgBox "请输入员工编号!", vbOKOnly + vbExclamation, "警告!"
Me.Text1.SetFocus
End If
Call setQuerystring
Call form16.ATopic
Call form16.ShowAResult(querystring)
Call form16.LTopic
Call form16.ShowLResult(queryleave)
Call form16.OTopic
Call form16.ShowOResult(queryovertime)
Call form16.ETopic
Call form16.ShowEReslut(queryerrand)
form16.Show
form16.ZOrder 0
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
Exit Sub
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 test"
Set rs = TransactSQL(sql)
If Not rs.EOF Then
rs.MoveFirst
While Not rs.EOF
If Not IsNull(rs.Fields(0)) Then '设置年
Me.Combo2.AddItem Left(rs(0), 4)
Me.Combo4.AddItem Left(rs(0), 4)
End If
rs.MoveNext
Wend
rs.Close
Me.Combo2.ListIndex = 0
Me.Combo4.ListIndex = 0
End If
For i = 1 To 12 '设置月
Me.Combo3.AddItem i
Me.Combo5.AddItem i
Next i
Me.Combo3.ListIndex = 0
Me.Combo5.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -