📄 frm_kaoqihesuan.frm
字号:
For i = 0 To iCount '''''核算天数
'''''''''''''''''***************************************
'''''未进厂 或 已离职;
'''If .Fields("indate").Value > d Or (Not IsNull(.Fields("outdate").Value) And .Fields("indate").Value <= d) Then
If .Fields("indate").Value > d Or (Not IsNull(.Fields("outdate").Value) And .Fields("outdate").Value <= d) Then
'NE = NE + 1
GoTo Next1
End If
'''''''''''''''''***************************************
StatusBar1.Panels(5).Text = d
'Debug.Print adoPrimaryRS3.RecordCount
adoPrimaryRS3.Find "regualorder=" & ii, 0, adSearchForward, adBookmarkFirst
' adoPrimaryRS3.Find "regualorder=" & ii, 0, adSearchForward, adBookmarkFirst
bgnwktm1 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgnwktm1").Value, 11)
bgntm1 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgntm1").Value, 11)
endtm1 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endtm1").Value, 11)
endwktm1 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endwktm1").Value, 11)
bgnwktm2 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgnwktm2").Value, 11)
bgntm2 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgntm2").Value, 11)
endtm2 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endtm2").Value, 11)
endwktm2 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endwktm2").Value, 11)
bgnwktm3 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgnwktm3").Value, 11)
bgntm3 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("bgntm3").Value, 11)
endtm3 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endtm3").Value, 11)
endwktm3 = CStr(d) & " " & Mid(adoPrimaryRS3.Fields("endwktm3").Value, 11)
bgntm11 = DateAdd("n", 60, bgntm1)
bgntm22 = DateAdd("n", 60, bgntm2)
Dim bgntm111 As Date
bgntm111 = DateAdd("n", 180, bgntm1)
fromD = bgnwktm1
toD = DateAdd("d", 1, fromD)
' Debug.Print bgnwktm1
' Debug.Print bgntm1
' Debug.Print endtm1
' Debug.Print endwktm1
Dim Dtmp As Date
Dim iDtmp As Long
Dtmp = "00:00:00"
Maxid = Maxid + 1
adoPrimaryRS5.AddNew
adoPrimaryRS5.Fields("ID").Value = Maxid
adoPrimaryRS5.Fields("dptid").Value = .Fields("dptid").Value
adoPrimaryRS5.Fields("dptname").Value = .Fields("dptname").Value
adoPrimaryRS5.Fields("emplyid").Value = .Fields("emplyid").Value
adoPrimaryRS5.Fields("emplyname").Value = .Fields("emplyname").Value
adoPrimaryRS5.Fields("caldate").Value = d
adoPrimaryRS5.Fields("wktmid").Value = adoPrimaryRS3.Fields("wktmid").Value
adoPrimaryRS5.Fields("wktmname").Value = adoPrimaryRS3.Fields("wktmdecs").Value '''班次名称
adoPrimaryRS5.Fields("standwktm").Value = adoPrimaryRS3.Fields("hours").Value '''标准工时
adoPrimaryRS5.Fields("wktmbg1").Value = d '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg1").Value = "00:00:00" ''''上班刷卡
adoPrimaryRS5.Fields("latertime1").Value = 0 '''' 迟到时间
'adoPrimaryRS5.Fields("wktmbg1dec").Value = 上班描述
adoPrimaryRS5.Fields("wktmend1").Value = d ''''下班时间
adoPrimaryRS5.Fields("drawtmend1").Value = "00:00:00" '''下班刷卡
adoPrimaryRS5.Fields("earlytime1").Value = 0 '''' 早退时间
'adoPrimaryRS5.Fields("wktmend1dec").Value = 下班描述
adoPrimaryRS5.Fields("wktmbg2").Value = d '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg2").Value = "00:00:00" ''''上班刷卡
adoPrimaryRS5.Fields("latertime2").Value = 0 '''' 迟到时间
'adoPrimaryRS5.Fields("wktmbg2dec").Value = 上班描述
adoPrimaryRS5.Fields("wktmend2").Value = d ''''下班时间
adoPrimaryRS5.Fields("drawtmend2").Value = "00:00:00" '''下班刷卡
adoPrimaryRS5.Fields("earlytime2").Value = 0 '''' 早退时间
'adoPrimaryRS5.Fields("wktmend2dec").Value = 下班描述
adoPrimaryRS5.Fields("wktmbg3").Value = d '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg3").Value = "00:00:00" ''''上班刷卡
adoPrimaryRS5.Fields("latertime3").Value = 0 '''' 迟到时间
'adoPrimaryRS5.Fields("wktmbg3dec").Value = 上班描述
adoPrimaryRS5.Fields("wktmend3").Value = d ''''下班时间
adoPrimaryRS5.Fields("drawtmend3").Value = "00:00:00" '''下班刷卡
adoPrimaryRS5.Fields("earlytime3").Value = 0 '''' 早退时间
'adoPrimaryRS5.Fields("wktmend3dec").Value = 下班描述
adoPrimaryRS5.Fields("wktmbg4").Value = d '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg4").Value = "00:00:00" ''''上班刷卡
adoPrimaryRS5.Fields("latertime4").Value = 0 '''' 迟到时间
'adoPrimaryRS5.Fields("wktmbg4dec").Value = 上班描述
adoPrimaryRS5.Fields("wktmend4").Value = d ''''下班时间
adoPrimaryRS5.Fields("drawtmend4").Value = "00:00:00" '''下班刷卡
adoPrimaryRS5.Fields("earlytime4").Value = 0 '''' 早退时间
'adoPrimaryRS5.Fields("wktmend4dec").Value = 下班描述
adoPrimaryRS5.Fields("bgnovertime").Value = "00:00:00" ''''加班开始时间
adoPrimaryRS5.Fields("endovertime").Value = "00:00:00" ''''加班结束时间
adoprimaryRS4.Filter = "emplyid='" & .Fields("emplyid").Value & "' and cdatetime>'" & fromD & "' and cdatetime<'" & toD & "'"
Debug.Print adoprimaryRS4.RecordCount
If adoprimaryRS4.RecordCount Then '''''每人每天的刷卡记录数
'If adoprimaryRS4.Fields("emplyid").Value = "00101109" Then
'Debug.Print "ok"
'End If
iJS = adoprimaryRS4.RecordCount
n = 0
adoprimaryRS4.MoveFirst
For JJ = 0 To adoprimaryRS4.RecordCount - 1
Limited3:
iDtmp = DateDiff("n", Dtmp, adoprimaryRS4.Fields("cdatetime").Value)
'''If iDtmp < 3 Then n = n - 1
If iDtmp < 3 Then
Dtmp = adoprimaryRS4.Fields("cdatetime").Value
adoprimaryRS4.MoveNext
JJ = JJ + 1
If JJ > adoprimaryRS4.RecordCount - 1 Then Exit For
GoTo Limited3
'n = n - 1
End If
If iDtmp > iFen And iDtmp < 10 Then
'' If iDtmp > iFen And iDtmp < 10 Then
''n = n + 1
''GoTo Goto2
End If
' If iDtmp < 3 And n > 1 Then
' n = n - 2
' GoTo Goto2
' End If
n = n + 1
'Dim indexN As Integer
'Dim Dtime As Date
'If adoPrimaryRS4.Fields("cdatetime").Value > endtm1 And n = 1 Then
'n = 3
'End If
Dim b1 As Boolean '''''''有上午上班记录;
Dim t1 As Date
Dim b11 As Boolean '''''''上午上班迟到;
Dim b2 As Boolean
Dim t2 As Date
Dim b22 As Boolean
Dim b3 As Boolean
Dim t3 As Date
Dim b33 As Boolean
Dim b4 As Boolean
Dim b44 As Boolean
Dim b444 As Boolean ''''下午早退
Dim t444 As Date ''''用于记录实际早退的刷卡时间,以备纠正;
Dim b5 As Boolean
Dim b55 As Boolean
Dim b6 As Boolean
Dim b66 As Boolean
Dim tmpMemo As String
Dim bw1 As Boolean '''''''无上午上班记录;
Dim bw2 As Boolean '''''''无下午上班记录;
Dim bw23 As Boolean ''''早晚两次刷卡
Dim by As Boolean ''''中午和晚两次刷卡(因为早上无刷卡,中午(下班,下午上班)均记为上午下班;如果下午下班有刷卡,即记下午工时;)
Dim gs_ZG As Single
Dim gs_SJ As Single
Dim gs_SJJB As Single
Dim gs_ZGs As Single
Dim gs_SJs As Single
Dim iLaterT As Integer
Dim iEarlyT As Integer
GoTo1:
iLaterT = 0
iEarlyT = 0
'ChiDao:
Select Case n
'''''''''''''\\\\\\\\\\\\\\\******************/////////////////////////
'''''''''''''\\\\\\\\\\\\\\\******************/////////////////////////
Case 1
If adoprimaryRS4.Fields("cdatetime").Value > bgntm111 Then
n = n + 1
bw1 = True
b1 = False
tmpMemo = tmpMemo & "未刷1;"
GoTo GoTo1
End If
If adoprimaryRS4.Fields("cdatetime").Value <= bgntm1 Then
''''1
adoPrimaryRS5.Fields("wktmbg1").Value = bgntm1 '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg1").Value = adoprimaryRS4.Fields("cdatetime").Value ''''上班刷卡
adoPrimaryRS5.Fields("latertime1").Value = 0 '''' 迟到时间
'adoPrimaryRS5.Fields("wktmbg1dec").Value = 上班描述
'adoPrimaryRS5.Fields("wktmend1").Value = 下班时间
'adoPrimaryRS5.Fields("drawtmend1").Value = 下班刷卡
'adoPrimaryRS5.Fields("wktmend1dec").Value = 下班描述
'adoPrimaryRS5.Fields("earlytime1").Value = 早退时间
b1 = True
b11 = False
bw1 = False
''''2
''''3
ElseIf adoprimaryRS4.Fields("cdatetime").Value > bgntm1 And adoprimaryRS4.Fields("cdatetime").Value < endtm1 Then
adoPrimaryRS5.Fields("wktmbg1").Value = bgntm1 '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg1").Value = adoprimaryRS4.Fields("cdatetime").Value ''''上班刷卡
iLaterT = DateDiff("n", bgntm1, adoprimaryRS4.Fields("cdatetime").Value) '''' 迟到时间
If iLaterT > tChiDao Then
adoPrimaryRS5.Fields("latertime1").Value = iLaterT '''' DateDiff("n", bgntm1, adoprimaryRS4.Fields("cdatetime").Value) '''' 迟到时间
adoPrimaryRS5.Fields("wktmbg1dec").Value = "迟到"
b1 = True
b11 = True ''''迟到
Else
adoPrimaryRS5.Fields("latertime1").Value = 0 '''' 迟到时间
b1 = True
b11 = False ''''迟到
End If
bw1 = False
ElseIf adoprimaryRS4.Fields("cdatetime").Value > endtm1 Then
adoPrimaryRS5.Fields("wktmbg1").Value = bgntm1 '''' 上班时间
adoPrimaryRS5.Fields("drawtmbg1").Value = "00:00:00" ''''上班刷卡
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -