以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [求助]关于出勤记录(需求内详) (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=117765) |
||||
-- 作者:ymjr2011 -- 发布时间:2018/4/18 21:23:00 -- [求助]关于出勤记录(需求内详)
遍历人员表,查到对应时段内的考勤情况并插入到出勤记录表,未找到则异常(内详)
|
||||
-- 作者:有点甜 -- 发布时间:2018/4/18 21:38:00 -- Dim sdate As Date = "2018-04-15" Dim edate As Date = "2018-04-18" Dim d As Date = sdate DataTables("出勤明细表").Datarows.Clear Do While d <= edate For Each dr As DataRow In DataTables("人员名单").Select("状态=\'在职\'") Dim drs = DataTables("kq").Select("pin like \'%" & dr("工号") & "\' and checktime >= #" & d & "# and checktime < #" & d.AddDays(1) & "#", "checktime") Dim ndr As DataRow = Nothing \'DataTables("出勤明细表").find("工号=\'" & dr("工号") & "\' and 日期=#" & d & "#") If ndr Is Nothing Then ndr = DataTables("出勤明细表").AddNew ndr("工号") = dr("工号") ndr("姓名") = dr("姓名") ndr("日期") = d If drs.count >= 1 Then ndr("考勤1") = cstr(drs(0)("checktime")).split(" ")(1) End If If drs.count >= 2 Then ndr("考勤2") = cstr(drs(drs.count-1)("checktime")).split(" ")(1) ndr("状态") = Nothing Else ndr("状态") = "异常" End If Next d = d.AddDays(1) Loop |
||||
-- 作者:ymjr2011 -- 发布时间:2018/4/19 15:21:00 -- 谢谢,完美解决 |