VB+SQL Server IC卡考勤管理系统 第5页
图11 员工管理界面
以下是员工管理的部分代码:
Public Sub cmdEdit_Click(Index As Integer) ‘ 员工管理按钮的编辑
Dim strTmp As String
Select Case Index
Case gCMDAPPEND ‘ 添加按钮编辑
Dim blnIsToGo As Boolean
blnIsToGo = True
If Not mblnIsAdd Then
strTmp = gSTRCANCEL
AddAction
If MsgBox("您确定不保存吗?", vbQuestion + _
vbYesNo + vbDefaultButton2, gTitle) _
= vbNo Then
blnIsToGo = False
End If
End If
If blnIsToGo Then
strTmp = gSTRAPPEND
InitxtEmp
ChangeColor False
mblnIsNeedSave = False
RefreshButton cmdEdit, gCMDEDITCANCEL
Else
strTmp = gSTRCANCEL
End If
End If
strTmp = strTmp & "(&A)"
cmdEdit(gCMDAPPEND).Caption = strTmp
If blnIsToGo Then
mblnIsAdd = Not mblnIsAdd
End If
Case gCMDSAVE ‘保存按钮编辑
If AddToDataBase Then
AfterSave
strTmp = gSTRMODIFY & "&M"
cmdEdit(gCMDEDIT).Caption = strTmp
mnuEditModify.Caption = strTmp
End If
Case gCMDEDIT ‘ 修改按钮编辑
f Not mblnIsModify Then
strTmp = gSTRRESET
ToModify
Else
strTmp = gSTRMODIFY
AfterSave
End If
需要完整内容的请联系QQ3249114,本文免费,转发请注明源于www.751com.cn
' DeleteForEmployee msfGrid, 1, "您确定要删除此名员工的信息?", _
' gDataBase, "Employee", "WorkNo"
If DeleteForEmployee Then
If Not txtEmp(mName).Locked Then InitxtEmp
RefreshButton cmdEdit, gCMDEDITNORMAL
End If
Case gCMDQUERY ‘查询按钮编辑
frmEmpFind.Show vbModal
If mblnIsToCloseColor Then
mblnIsToCloseColor = False
CloseColor msfGrid
ChgcmdCloseColor
End If
If mcolWorkno.Count > 0 Then ShowQueryMan
Case gCMDRETURN ‘ 返回按钮编辑
Unload Me
End Select
End Sub
为了编程方便,也为了使代码简洁、易懂,本系统把系统中相关的按钮组成控件数组;为了系统界面简练、大方,不杂乱无章,系统把按钮设置成双向按钮,比如添加按钮,当点击添加按钮时,按钮的标题(caption)由“添加”变为“取消”。图10是当添加按钮被点击时的状态。添加员工信息时,添加按钮变成取消按钮,保存按钮被激活,编辑区(文本框部分)呈可编辑状态,修改、删除、查询等按钮处在失活状态;当用户点击员工表的某条记录时,修改、删除、查询按钮被激活,当点击修改按钮时,修改按钮变成还原按钮,同时编辑区被激活,表中记录的信息被显示在编辑区,删除、查询按钮失活。员工管理系模块中,管理员可以对员工持卡情况进行管理,如缺卡、丢失、有卡等等。
4.5 报表功能的实现
报表功能在本系统中可以说是最关键的。考勤系统之所以能够支持管理者的决策,是因为他能够及时地给管理者提供员工的考勤报表,使管理者能够及时准确地分析出公司员工的工作情况和工作态度,并能够及时地对员工做出正确的领导管理,从而促进员工的工作积极性,提高工作效率。本系统主要实现了日常动态考勤报表,打卡流水报表,考勤明细报表,考勤月报表的报表功能。报表功能主要分为两个部分:一、查询,二、打印。
1)日考勤动态报表的查询功能的实现:
Private Sub FindFlow()
Dim StartDate As String
Dim EndDate As String
Dim intDept As Integer
Dim strDept As String
Dim strWorkNo As String
Dim Sql As String
On Error GoTo FindErr
StartDate = Trim(txtDate(0))
' EndDate = Trim(txtDate(1))
getItemData cboDept, intDept
strDept = Trim(cboDept.Text)
strWorkNo = Trim(txtEmp)
Qry.Parameters(0) = StartDate
Set Rst = Qry.OpenRecordset(dbOpenSnapshot)
Else
Sql = " Select * from QryKqHistory "
Sql = Sql & " where format(KqDate,'yyyy-mm-dd')='" _
& StartDate & "'"
If optSel(mLATE).Value Then Sql = Sql & " and format(KqTime,'hh:mm')>'" _
& gLATETIME & "' "
需要完整内容的请联系QQ3249114,本文免费,转发请注明源于www.751com.cn
Dim strIn As String
Dim intRows As Integer
Dim intCols As Integer
If Rst.RecordCount > 0 Then
Do While Not Rst.EOF
intRows = intRows + 1
With Rst
'If IsKq Then
strIn = strIn & !WorkNo & vbTab _
& !Name & vbTab & !Sex & vbTab _
& !DeptName & vbTab & !TitleName & vbTab _
& !KqTime
'End If
需要完整内容的请联系QQ3249114,本文免费,转发请注明源于www.751com.cn
End If
intRows = intRows
intCols = 6
Dim i As Integer
With msfGrid
'.Rows = .FixedRows
ClipToGrid msfGrid, strIn, intRows + 1, intCols
.MergeCells = flexMergeRestrictRows
For i = 0 To .Cols - 2
.MergeCol(i) = True
Next
End With
Exit Sub
FindErr:
MsgBox "查询未成功!" & vbCrLf & Err.Description, vbExclamation, gTitle
Err.Clear
Me.Enabled = True
Me.MousePointer = 0
End Sub
2)日动态考勤报表的打印功能的实现:
Private Sub PrintFlow(objPrint As Printer)
Dim CurX As Single
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页