VB+access人事档案管理系统毕业论文(开题报告+源程序) 第6页

VB+access人事档案管理系统毕业论文(开题报告+源程序) 第6页
  第五章 各功能的实现
5.1系统安全及权限的实现
为了确保系统的安全,对数据库进行加密处理,采用了用户和组管理,并记录用户登录信息。拥有高级权限的用户,可以创建不同的组,并可将全部或部分权限分配给创建的组。可以创建用户,使其属于自于及下级用户创建的组。
比如A用户创建了一个人事档案组,给予了使用人事档案的权限,并创建了B用户,使其属于人事档案组。B用户登录后就只能使用人事档案管理。当然B用户也可以创建相应的组和用户,给予自身具有的权限。
为了实现该功能,系统采用了递归方式,使高一级别的用户可以管理低级用户,最高权限属于管理员。
具体描述如下:
5.2登录窗口的实现
5.3员工考勤信息的实现
5.3.1设置员工上下班时间
  在该窗体中输入相应的上下班信息,具体如图所示,相应部分代码如下:
 
Private Sub cmdOK_Click()                      '设置上下班时间
  Dim sql As String
  Dim rs As New ADODB.Recordset
  Dim strMsg As String
  sql = "delete * from TimeSetting"
  Set rs = ExecuteSQL(sql, strMsg)  ' 查找数据库,读取记录              
If  dtpBT.Value >= DTPicker1.Value Then ' 判断下班时间大于上班时间
        MsgBox "请正确的输入时间", vbOKOnly + vbExclamation, "警告!"
        Me.dtpBT.SetFocus    '设置焦点
        Exit Sub
  End If
  If dtpBT2.Value >= DTPicker2.Value Or dtpBT2.Value <= DTPicker1.Value Or dtpBT2.Value <= dtpBT.Value  Then   '判断下班时间大于上班时间
            MsgBox "请正确的输入时间", vbOKOnly + vbExclamation, "警告!"
        Me.dtpBT2.SetFocus    '设置焦点
        Exit Sub
  End If
  sql = "select * from TimeSetting"
  Set rs = ExecuteSQL(sql, strMsg)
  rs.AddNew
         rs.Fields("上午上班时间") = CDate(dtpBT.Hour & ":" & dtpBT.Minute & ":" & dtpBT.Second)
         rs.Fields("上午下班时间") = CDate(DTPicker1.Hour & ":" & DTPicker1.Minute & ":" & DTPicker1.Second)
         rs.Fields("下午上班时间") = CDate(dtpBT2.Hour & ":" & dtpBT2.Minute & ":" & dtpBT2.Second)
          rs.Fields("下午下班时间") = CDate(DTPicker2.Hour & ":" & DTPicker2.Minute & ":" & DTPicker2.Second)
          rs.Update
          rs.Close
          MsgBox "时间已经设置", vbOKOnly + vbInformation, "设置结果!"
            Unload Me
End Sub
Private Sub Form_Load()
    Dim sql As String
    Dim rs As New ADODB.Recordset
    Dim strMsg As String
    sql = "select * from TimeSetting"
    Set rs = ExecuteSQL(sql, strMsg)
    If rs.EOF Then Exit Sub
        dtpBT.Value = rs.Fields("上午上班时间")
        DTPicker1.Value = rs.Fields("上午下班时间")
        dtpBT2.Value = rs.Fields("下午上班时间")
        DTPicker2.Value = rs.Fields("下午下班时间")
End Sub5.3.2添加员工考勤信息
5.3.2.1添加上下班信息
窗体如图所示,填入相应的信息,部分代码如下:
 
'添加上下班信息
Private Sub cmdOK_Click()
     Dim sql As String
     Dim sql2 As String
     Dim rs As New ADODB.Recordset
     Dim strMsg As String
     Dim strmsg2 As String
     Dim rsTime As New ADODB.Recordset
     Dim tmsetswsb, tmsetswxb, tmsetxwsb, tmsetxwxb As Date
     Dim tmsb1, tmxb1 As Date
     sql = "select * from AttendanceInfo  order by ID desc"
     sql2 = "select * from TimeSetting"
     Set rs = ExecuteSQL(sql, strMsg)
     Set rsTime = ExecuteSQL(sql2, strmsg2)

     If InFlag = False And OutFlag = False Then
            MsgBox "请选择上下班", vbOKOnly + vbExclamation, "警告!"
     End If
     '添加上班信息        
     If InFlag = True Then
         If txtID.Text = "" Or txtName.Text = "" Then
                MsgBox "要添加上班信息,员工编号与姓名不能为空,请输入", vbOKOnly, "提示"
                Exit Sub
         End If        
        '判断上下午上班时间是否迟到
        tmsb1 = dtpBT.Value
                  h = Hour(tmsb1)
                  m = Minute(tmsb1)
                  s = Second(tmsb1)
        tmsb1 = CDate(h & ":" & m & ":" & s)
        tmsetswsb = CDate(rsTime.Fields("上午上班时间"))
        tmsetswxb = CDate(rsTime.Fields("上午下班时间"))
        tmsetxwsb = CDate(rsTime.Fields("下午上班时间"))
           
           '判断上午上班时间是否迟到
             If tmsb1 < tmsetswxb Then
                  If tmsb1 > tmsetswsb Then
                        ilate = 1
                        MsgBox "迟到"
                  Else
                        ilate = 0
                        MsgBox "正常上班"
                  End If
           '判断下午上班时间是否迟到
             Else
  
                 If tmsb1 > tmsetxwsb Then
                        ilate = 1
                        MsgBox "迟到"
                  Else
                        ilate = 0
                        MsgBox "正常上班"
                 End If
                
             End If                     
    aflag = "入"
    rs.AddNew
            rs.Fields("工号") = txtID.Text
            rs.Fields("姓名") = txtName.Text
            rs.Fields("当前日期") = dtpET.Value
            rs.Fields("上班时间") = dtpBT.Hour & ":" & dtpBT.Minute & ":" & dtpBT.Second
            rs.Fields("出入标志") = aflag
            rs.Fields("迟到次数") = ilate
            rs.Update
            rs.Close
            MsgBox "已完成添加上班信息", vbOKOnly + vbInformation, "添加结果!"
            Unload Me
            Exit Sub

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有