VB+access人事档案管理系统毕业论文(开题报告+源程序) 第7页
'添加下班信息
If OutFlag = True Then
If txtID.Text = "" Or txtName.Text = "" Then
MsgBox "要添加下班信息,员工编号与姓名不能为空,请输入", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'判断上下午下班时间是否早退
tmxb1 = DTPicker1.Value
h = Hour(tmxb1)
m = Minute(tmxb1)
s = Second(tmxb1)
tmxb1 = CDate(h & ":" & m & ":" & s)
tmsetxwsb = CDate(rsTime.Fields("下午上班时间"))
tmsetswxb = CDate(rsTime.Fields("上午下班时间"))
tmsetxwxb = CDate(rsTime.Fields("下午下班时间"))
'判断上午下班时间
If tmxb1 < tmsetxwsb Then
If tmxb1 < tmsetswxb Then
iearly = 1
MsgBox "早退"
Else
iearly = 0
MsgBox "正常下班"
End If
'判断下午下班时间
Else
If tmxb1 < tmsetxwxb Then
iearly = 1
MsgBox "早退"
Else
iearly = 0
MsgBox "正常下班"
End If
End If
aflag = "出"
rs.AddNew
rs.Fields("工号") = txtID.Text
rs.Fields("姓名") = txtName.Text
rs.Fields("当前日期") = dtpET.Value
rs.Fields("下班时间") = DTPicker1.Hour & ":" & DTPicker1.Minute & ":" & DTPicker1.Second
rs.Fields("出入标志") = aflag
rs.Fields("早退次数") = iearly
rs.Update
rs.Close
MsgBox "已完成添加下班信息", vbOKOnly + vbInformation, "添加结果!"
Unload Me
Exit Sub
End If
End Sub
Private Sub Form_Load()
dtpET.Value = Date '初始化为当天时间
End SubPrivate Sub txtName_Validate(Cancel As Boolean) 'Validate 表示失去焦点之前发生的事件
Dim sql As String
Dim rs As New ADODB.Recordset
Dim strMsg As String
sql = "select * from t_br where 姓名= '" & txtName & "'"
Set rs = ExecuteSQL(sql, strMsg)
If rs.BOF Or rs.EOF Then
MsgBox "无记录或此姓名不存在", vbOKOnly + vbExclamation, "警告"
txtID.Text = ""
txtName.Text = ""
txtName.SetFocus
Exit Sub
Else
txtID.Text = rs.Fields("工号")
txtName.Text = rs.Fields("姓名") End If
End Sub
Private Sub txtID_Validate(Cancel As Boolean) 'Validate 表示失去焦点之前发生的事件
Dim sql As String
Dim rs As New ADODB.Recordset
Dim strMsg As String
sql = "select * from t_br where 工号= '" & txtID & "'"
Set rs = ExecuteSQL(sql, strMsg)
If rs.BOF Or rs.EOF Then
MsgBox "无记录或此工号不存在", vbOKOnly + vbExclamation, "警告"
txtID.Text = ""
'txtName.Text = ""
txtID.SetFocus
Exit Sub
Else
txtID.Text = rs.Fields("工号")
txtName.Text = rs.Fields("姓名")
End If
End Sub
6.3.2.2.2添加员工加班信息
6.3.2.2.3添加员工出差信息
6.3.2.2添加其它考勤信息
6.3.2.2.1添加员工请假信息
在该窗体上填入相应的信息,窗体如下,部分代码如下:
Private Sub cmdOK_Click()
Dim sql As String
Dim rs As New ADODB.Recordset
Dim strMsg As String
sql = "select * from LeaveInfo"
Set rs = ExecuteSQL(sql, strMsg)
If IsNumeric(PLeave.Text) = False Then
MsgBox "输入的事假天数须为整数!", vbOKOnly + vbExclamation, "警告"
PLeave.Text = ""
PLeave.SetFocus
Exit Sub
End If
If IsNumeric(Ileave.Text) = False Then
MsgBox "输入的病假天数须为整数!", vbOKOnly + vbExclamation, "警告"
Ileave.Text = ""
Ileave.SetFocus
Exit Sub
End If
rs.AddNew
rs.Fields("工号") = txtID.Text
rs.Fields("姓名") = Trim(txtName.Text)
rs.Fields("病假天数") = Trim(Ileave.Text)
rs.Fields("事假天数") = Trim(PLeave.Text)
rs.Fields("假期开始时间") = dtpET.Value
rs.Update
rs.Close
MsgBox "员工请假信息添加已完成", vbOKOnly + vbInformation, "添加结果!"
Unload Me
Exit Sub
End Sub
5.3.3修改员工考勤信息
修改员工考勤信息,当考勤信息出现错误需要修改的时候,可以从这里修改相应的记录。
5.3.3.1修改上下班信息
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页