📄 frmcheckadd.frm
字号:
VERSION 5.00
Begin VB.Form frmCheckAdd
BorderStyle = 3 'Fixed Dialog
Caption = "增加考勤信息"
ClientHeight = 6825
ClientLeft = 45
ClientTop = 330
ClientWidth = 9510
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6825
ScaleWidth = 9510
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.TextBox txtCD
Alignment = 1 'Right Justify
Height = 375
Left = 6120
MaxLength = 10
TabIndex = 12
Top = 5160
Width = 2175
End
Begin VB.TextBox txtOS
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 10
TabIndex = 11
Top = 5160
Width = 2175
End
Begin VB.TextBox txtR
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 4
TabIndex = 7
Top = 4080
Width = 2175
End
Begin VB.TextBox txtO
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 4
TabIndex = 6
Top = 3480
Width = 2175
End
Begin VB.TextBox txtN
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 4
TabIndex = 5
Top = 2880
Width = 2175
End
Begin VB.TextBox txtH
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 4
TabIndex = 4
Top = 2280
Width = 2175
End
Begin VB.TextBox txtL
Alignment = 1 'Right Justify
Height = 375
Left = 6120
MaxLength = 2
TabIndex = 8
Top = 1680
Width = 2175
End
Begin VB.TextBox txtE
Alignment = 1 'Right Justify
Height = 375
Left = 6120
MaxLength = 2
TabIndex = 9
Top = 2280
Width = 2175
End
Begin VB.TextBox txtW
Alignment = 1 'Right Justify
Height = 375
Left = 2160
MaxLength = 4
TabIndex = 3
Top = 1680
Width = 2175
End
Begin VB.CommandButton cmdReturn
Caption = "返 回"
Height = 375
Left = 8040
TabIndex = 14
Top = 6120
Width = 975
End
Begin VB.CommandButton cmdAdd
Caption = "新 增"
Default = -1 'True
Height = 375
Left = 6480
TabIndex = 13
Top = 6120
Width = 975
End
Begin VB.Frame Frame3
Caption = "调整工资"
Height = 855
Left = 480
TabIndex = 30
Top = 4920
Width = 8535
Begin VB.Label Label14
Caption = "扣 款:"
Height = 255
Left = 4320
TabIndex = 15
Top = 360
Width = 975
End
Begin VB.Label Label13
Caption = "加班费:"
Height = 255
Left = 360
TabIndex = 31
Top = 360
Width = 975
End
End
Begin VB.Frame Frame2
Caption = "考勤基本信息"
Height = 3255
Left = 480
TabIndex = 21
Top = 1440
Width = 8535
Begin VB.TextBox txtDes
Height = 1215
Left = 4320
MaxLength = 255
MultiLine = -1 'True
TabIndex = 10
Top = 1800
Width = 3495
End
Begin VB.Label Label12
Caption = "备 注:"
Height = 255
Left = 4320
TabIndex = 29
Top = 1440
Width = 855
End
Begin VB.Label Label11
Caption = "早退次数:"
Height = 255
Left = 4320
TabIndex = 28
Top = 960
Width = 975
End
Begin VB.Label Label10
Caption = "迟到次数:"
Height = 255
Left = 4320
TabIndex = 27
Top = 360
Width = 975
End
Begin VB.Label Label9
Caption = "补休天数:"
Height = 255
Left = 360
TabIndex = 26
Top = 2760
Width = 975
End
Begin VB.Label Label8
Caption = "旷工天数:"
Height = 255
Left = 360
TabIndex = 25
Top = 1560
Width = 975
End
Begin VB.Label Label7
Caption = "加班天数:"
Height = 255
Left = 360
TabIndex = 24
Top = 2160
Width = 975
End
Begin VB.Label Label6
Caption = "请假天数:"
Height = 255
Left = 360
TabIndex = 23
Top = 960
Width = 975
End
Begin VB.Label Label5
Caption = "应出勤天数:"
Height = 255
Left = 360
TabIndex = 22
Top = 360
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "考勤对象及范围"
Height = 855
Left = 480
TabIndex = 16
Top = 360
Width = 8535
Begin VB.ComboBox cboCheckMonth
Height = 315
Left = 6720
Style = 2 'Dropdown List
TabIndex = 2
Top = 360
Width = 615
End
Begin VB.ComboBox cboCheckYear
Height = 315
Left = 5280
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 1095
End
Begin VB.ComboBox cboEmpInfo
Height = 300
Left = 1080
Style = 2 'Dropdown List
TabIndex = 0
Top = 360
Width = 2775
End
Begin VB.Label Label4
Caption = "月"
Height = 255
Left = 7440
TabIndex = 20
Top = 480
Width = 255
End
Begin VB.Label Label3
Caption = "年"
Height = 255
Left = 6480
TabIndex = 19
Top = 480
Width = 255
End
Begin VB.Label Label2
Caption = "考勤年月:"
Height = 255
Left = 4320
TabIndex = 18
Top = 480
Width = 1095
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "员 工:"
Height = 180
Left = 360
TabIndex = 17
Top = 480
Width = 720
End
End
End
Attribute VB_Name = "frmCheckAdd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As New ADODB.Recordset
Dim strSql As String
Function Bhbx(strBhb As String) As String
Dim intA As Integer
Dim intB As Integer
If Left(Trim(strBhb), 1) = "." Then
strBhb = "0" & strBhb
End If
intA = InStr(Trim(strBhb), ".")
If Trim(strBhb) = "" Then
strBhb = "0.00"
Else
If intA = 0 Then
strBhb = Trim(strBhb) & ".00"
Else
intB = Len(Trim(strBhb)) - intA
If intB = 1 Then
strBhb = Trim(strBhb) & "0"
Else
If intB = 0 Then
strBhb = Trim(strBhb) & "00"
Else
strBhb = Left(Trim(strBhb), intA + 2)
End If
End If
End If
End If
Bhbx = strBhb
End Function
Private Sub txtCD_LostFocus()
txtCD = Bhbx(txtCD)
End Sub
Private Sub txtOS_LostFocus()
txtOS = Bhbx(txtOS)
End Sub
Private Sub cboEmpInfo_Click()
tEmp_id = cboEmpInfo.ItemData(cboEmpInfo.ListIndex)
End Sub
Private Sub cmdAdd_Click()
On Error GoTo ERR_CONN
If Trim(txtDes.Text) = "" Then
txtDes.Text = " "
End If
If Trim(txtW.Text) = "" Then
MsgBox "应出勤天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtW.Text = ""
txtW.SetFocus
Exit Sub
End If
If Trim(txtH.Text) = "" Then
MsgBox "请假天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtH.Text = ""
txtH.SetFocus
Exit Sub
End If
If Trim(txtN.Text) = "" Then
MsgBox "旷工天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtN.Text = ""
txtN.SetFocus
Exit Sub
End If
If Trim(txtO.Text) = "" Then
MsgBox "加班天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtO.Text = ""
txtO.SetFocus
Exit Sub
End If
If Trim(txtR.Text) = "" Then
MsgBox "补休天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtR.Text = ""
txtR.SetFocus
Exit Sub
End If
If Trim(txtL.Text) = "" Then
MsgBox "迟到天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtL.Text = ""
txtL.SetFocus
Exit Sub
End If
If Trim(txtE.Text) = "" Then
MsgBox "早退天数不能为空!", vbOKOnly + vbExclamation, "警告"
txtE.Text = ""
txtE.SetFocus
Exit Sub
End If
If Trim(txtOS.Text) = "" Then
MsgBox "加班费不能为空!", vbOKOnly + vbExclamation, "警告"
txtOS.Text = ""
txtOS.SetFocus
Exit Sub
End If
If Trim(txtCD.Text) = "" Then
MsgBox "扣款不能为空!", vbOKOnly + vbExclamation, "警告"
txtCD.Text = ""
txtCD.SetFocus
Exit Sub
End If
tCheck_ym = cboCheckYear & cboCheckMonth
strSql = "select emp_id ,check_ym from checkin where emp_id =clng('" & tEmp_id & "')and check_ym='" & tCheck_ym & "'"
rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
If Not rs.EOF Then
MsgBox "此记录已存在!", vbOKOnly + vbExclamation, "警告"
cboEmpInfo.SetFocus
rs.Close
Exit Sub
End If
rs.Close
strSql = "Insert into checkin (emp_id,check_ym,w_days,l_nums,e_nums,h_days,n_days,o_days,r_days,overtime_s,d_check,check_des ) Values (" & _
"'" & tEmp_id & _
"','" & cboCheckYear & cboCheckMonth & _
"','" & Trim(txtW) & _
"','" & Trim(txtL) & _
"','" & Trim(txtE) & _
"'," & Trim(txtH) & _
"," & Trim(txtN) & _
"," & Trim(txtO) & _
"," & Trim(txtR) & _
",'" & Trim(txtOS) & _
"','" & Trim(txtCD) & _
"','" & txtDes & _
"')"
dbConn.Execute strSql
MsgBox "增加员工考勤成功!", vbOKOnly + vbInformation, "提示"
cmdReturn.SetFocus
Exit Sub
ERR_CONN:
MsgBox "请检查数据是否有效!", vbOKOnly + vbExclamation, "警告"
cboEmpInfo.SetFocus
End Sub
Private Sub cmdReturn_Click()
Set rs = Nothing
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
Me.Icon = LoadPicture(App.Path & "\Graph07.ico")
strSql = "Select a.emp_id,a.emp_name,b.dept_name from employee a,department b where a.dept_id=b.dept_id "
rs.Open strSql, dbConn, adOpenForwardOnly, adLockReadOnly
If rs.EOF Then
MsgBox "没有员工资料,请先输入资料!", vbOKOnly + vbExclamation, "警告"
rs.Close
cmdAdd.Enabled = False
Exit Sub
End If
Do While Not rs.EOF
cboEmpInfo.AddItem "[" & rs.Fields("dept_name").Value & "] " & rs.Fields("emp_name").Value
cboEmpInfo.ItemData(cboEmpInfo.NewIndex) = rs.Fields("emp_id").Value
rs.MoveNext
Loop
rs.Close
cboEmpInfo.ListIndex = 0
cboCheckYear.AddItem Year(Date)
cboCheckYear.AddItem Year(Date) - 1
cboCheckYear.ListIndex = 0
For i = 1 To 12
If i < 10 Then
cboCheckMonth.AddItem "0" & i
Else
cboCheckMonth.AddItem i
End If
If i = Month(Date) Then
cboCheckMonth.ListIndex = cboCheckMonth.NewIndex
End If
Next i
txtCD = Bhbx(txtCD)
txtOS = Bhbx(txtOS)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -