⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmduty.frm

📁 这是我们当时数据库课程设计的时候其他同学做的一个程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form 添加考勤信息 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "添加考勤信息"
   ClientHeight    =   5640
   ClientLeft      =   1095
   ClientTop       =   330
   ClientWidth     =   8280
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5640
   ScaleWidth      =   8280
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存"
      Height          =   495
      Left            =   1800
      TabIndex        =   26
      Top             =   5040
      Width           =   1335
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   495
      Left            =   5040
      TabIndex        =   25
      Top             =   5040
      Width           =   1215
   End
   Begin VB.Frame Frame2 
      Caption         =   "考勤信息"
      Height          =   4575
      Left            =   120
      TabIndex        =   0
      Top             =   240
      Width           =   7935
      Begin VB.TextBox txtFields 
         DataField       =   "年度"
         Height          =   285
         Index           =   0
         Left            =   1920
         TabIndex        =   12
         Top             =   540
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "月份"
         Height          =   285
         Index           =   1
         Left            =   5760
         TabIndex        =   11
         Top             =   540
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "部门"
         Height          =   285
         Index           =   2
         Left            =   1920
         TabIndex        =   10
         Top             =   1680
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "员工号"
         Height          =   285
         Index           =   3
         Left            =   1920
         TabIndex        =   9
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "姓名"
         Height          =   285
         Index           =   4
         Left            =   5760
         TabIndex        =   8
         Top             =   1080
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "全勤"
         Height          =   285
         Index           =   5
         Left            =   5760
         TabIndex        =   7
         Top             =   1680
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "病假"
         Height          =   285
         Index           =   6
         Left            =   1920
         TabIndex        =   6
         Top             =   2880
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "事假"
         Height          =   285
         Index           =   7
         Left            =   5760
         TabIndex        =   5
         Top             =   2280
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "其他假时间"
         Height          =   285
         Index           =   9
         Left            =   1920
         TabIndex        =   4
         Top             =   3480
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "旷工时间"
         Height          =   285
         Index           =   10
         Left            =   5760
         TabIndex        =   3
         Top             =   2880
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "迟到早退次数"
         Height          =   285
         Index           =   14
         Left            =   5760
         TabIndex        =   2
         Top             =   3480
         Width           =   1695
      End
      Begin VB.TextBox txtFields 
         DataField       =   "应出勤天数"
         Height          =   285
         Index           =   15
         Left            =   1920
         TabIndex        =   1
         Top             =   2280
         Width           =   1695
      End
      Begin VB.Label lblLabels 
         Caption         =   "年度:"
         Height          =   255
         Index           =   0
         Left            =   360
         TabIndex        =   24
         Top             =   540
         Width           =   855
      End
      Begin VB.Label lblLabels 
         Caption         =   "月份:"
         Height          =   255
         Index           =   1
         Left            =   4080
         TabIndex        =   23
         Top             =   540
         Width           =   615
      End
      Begin VB.Label lblLabels 
         Caption         =   "部门:"
         Height          =   255
         Index           =   2
         Left            =   360
         TabIndex        =   22
         Top             =   1680
         Width           =   615
      End
      Begin VB.Label lblLabels 
         Caption         =   "员工号:"
         Height          =   255
         Index           =   3
         Left            =   360
         TabIndex        =   21
         Top             =   1080
         Width           =   735
      End
      Begin VB.Label lblLabels 
         Caption         =   "姓名:"
         Height          =   255
         Index           =   4
         Left            =   4080
         TabIndex        =   20
         Top             =   1028
         Width           =   615
      End
      Begin VB.Label lblLabels 
         Caption         =   "全勤天数:"
         Height          =   255
         Index           =   5
         Left            =   4080
         TabIndex        =   19
         Top             =   1680
         Width           =   1215
      End
      Begin VB.Label lblLabels 
         Caption         =   "病假天数:"
         Height          =   255
         Index           =   6
         Left            =   360
         TabIndex        =   18
         Top             =   2880
         Width           =   975
      End
      Begin VB.Label lblLabels 
         Caption         =   "事假天数:"
         Height          =   255
         Index           =   7
         Left            =   4080
         TabIndex        =   17
         Top             =   2280
         Width           =   1095
      End
      Begin VB.Label lblLabels 
         Caption         =   "其他假天数:"
         Height          =   255
         Index           =   9
         Left            =   360
         TabIndex        =   16
         Top             =   3600
         Width           =   1215
      End
      Begin VB.Label lblLabels 
         Caption         =   "旷工天数:"
         Height          =   255
         Index           =   10
         Left            =   4080
         TabIndex        =   15
         Top             =   2880
         Width           =   975
      End
      Begin VB.Label lblLabels 
         Caption         =   "迟到早退次数:"
         Height          =   255
         Index           =   14
         Left            =   4080
         TabIndex        =   14
         Top             =   3480
         Width           =   1335
      End
      Begin VB.Label lblLabels 
         Caption         =   "应出勤天数:"
         Height          =   255
         Index           =   15
         Left            =   360
         TabIndex        =   13
         Top             =   2280
         Width           =   1095
      End
   End
End
Attribute VB_Name = "添加考勤信息"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False





Private Sub cmdExit_Click()
Unload Me
End Sub



Private Sub Form_Unload(Cancel As Integer)
  Screen.MousePointer = vbDefault
End Sub










Private Sub txtFields_LostFocus(Index As Integer)

Dim msgstr As String

If Index = 3 Then
  Dim Sql3 As String
  Sql3 = "select  distinct 部门,姓名 from 员工基本信息  where 员工号 = '" & txtFields(3).Text & "'"
  Set rs3 = ExecuteSQL(Sql3, msgstr)
  If Not rs3.BOF And Not rs3.EOF Then
     If Not IsNull(rs3("部门")) Then
       txtFields(2).Text = Trim(rs3("部门"))
     End If
     If Not IsNull(rs3("姓名")) Then
       txtFields(4).Text = Trim(rs3("姓名"))
     End If
  End If
End If


If Not IsNumeric(txtFields(0).Text) And (txtFields(0).Text <> "") Then
    MsgBox "请在“年度”中输入数字", vbExclamation + vbOKOnly, pTitle
    
     txtFields(0).SetFocus
     txtFields(0).SelLength = Len(txtFields(0))
     txtFields(0).SelStart = 0
End If
    

If Not IsNumeric(txtFields(1).Text) And (txtFields(1).Text <> "") Then
MsgBox "请在“月份”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(1).SetFocus
     txtFields(1).SelLength = Len(txtFields(1))
     txtFields(1).SelStart = 0
End If
If Not IsNumeric(txtFields(5).Text) And (txtFields(5).Text <> "") Then
    MsgBox "请在“全勤”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(5).SetFocus
     txtFields(5).SelLength = Len(txtFields(5))
     txtFields(5).SelStart = 0
End If
If Not IsNumeric(txtFields(6).Text) And (txtFields(6).Text <> "") Then
    MsgBox "请在“病假”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(6).SetFocus
     txtFields(6).SelLength = Len(txtFields(6))
     txtFields(6).SelStart = 0
End If
If Not IsNumeric(txtFields(7).Text) And (txtFields(7).Text <> "") Then
    MsgBox "请在“事假”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(7).SetFocus
     txtFields(7).SelLength = Len(txtFields(7))
     txtFields(7).SelStart = 0
End If
If Not IsNumeric(txtFields(10).Text) And (txtFields(10).Text <> "") Then
    MsgBox "请在“旷工时间”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(10).SetFocus
     txtFields(10).SelLength = Len(txtFields(10))
     txtFields(10).SelStart = 0
End If
If Not IsNumeric(txtFields(14).Text) And (txtFields(14).Text <> "") Then
    MsgBox "请在“迟到早退次数”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(14).SetFocus
     txtFields(14).SelLength = Len(txtFields(14))
     txtFields(14).SelStart = 0
End If
If Not IsNumeric(txtFields(15).Text) And (txtFields(15).Text <> "") Then
    MsgBox "请在“应出勤天数”中输入数字", vbExclamation + vbOKOnly, pTitle
     txtFields(15).SetFocus
     txtFields(15).SelLength = Len(txtFields(15))
     txtFields(15).SelStart = 0
End If
End Sub
Private Sub cmdSave_Click()
Dim adoshowrsJL As ADODB.Recordset
Dim msgstr As String
If txtFields(3).Text <> "" And IsNumeric(txtFields(0).Text) And IsNumeric(txtFields(1).Text) Then
SqlJL = "SELECT * From 考勤信息 Where 员工号  ='" & txtFields(3).Text & "' " & " and 年度 =  " & txtFields(0).Text & " and 月份 = " & txtFields(1).Text

Else
MsgBox "请输入正确的员工号、年度和月份信息!", vbExclamation + vbOKOnly, "信息框"
Exit Sub

End If
Set adoshowrsJL = ExecuteSQL(SqlJL, msgstr)
'adoshowrsJL.Open SqlJL, db, adOpenStatic, adLockOptimistic
'adoshowrsJL.Requery

If Not adoshowrsJL.BOF And Not adoshowrsJL.EOF Then
   MsgBox "此员工的本年月考勤已存在,请输入新的员工考勤!", vbExclamation + vbOKOnly, "信息框"
   Exit Sub

End If
Dim txtSQL As String
Dim mrcc As ADODB.Recordset
 txtSQL = "select * from 考勤信息"
    Set mrcc = ExecuteSQL(txtSQL, msgstr)
                mrcc.AddNew
                mrcc.Fields(1) = Val(txtFields(0).Text)
                mrcc.Fields(2) = Val(txtFields(1).Text)
                mrcc.Fields(3) = Trim(txtFields(2).Text)
                mrcc.Fields(4) = Trim(txtFields(3).Text)
                mrcc.Fields(5) = Trim(txtFields(4).Text)
                mrcc.Fields(6) = Val(txtFields(15).Text)
                mrcc.Fields(7) = Val(txtFields(5).Text)
                mrcc.Fields(8) = Val(txtFields(6).Text)
                mrcc.Fields(9) = Val(txtFields(7).Text)
                mrcc.Fields(10) = Val(txtFields(14).Text)
                mrcc.Fields(12) = Val(txtFields(9).Text)
                mrcc.Fields(13) = Val(txtFields(10).Text)
               
             
            
                mrcc.Update
                MsgBox "考勤信息添加成功!", vbOKOnly + vbExclamation, "添加考勤资料信息"
                mrcc.Close
           
     
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -