Foxtable(狐表)用户栏目专家坐堂 → 求助:考勤报表产生


  共有2369人关注过本帖树形打印复制链接

主题:求助:考勤报表产生

帅哥哟,离线,有人找我吗?
有点青
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:573 积分:2961 威望:0 精华:0 注册:2016/10/27 14:33:00
  发帖心情 Post By:2016/11/16 9:31:00 [显示全部帖子]

Dim dt1 As Date = #11/14/2016#
Dim dt2 As Date = #11/14/2016#
Dim dtb As New DataTableBuilder("统计表1")
dtb.AddDef("name", Gettype(String), 32)
dtb.AddDef("cardno", Gettype(String), 32)
dtb.AddDef("date", Gettype(Date))
dtb.AddDef("t1", Gettype(String))
dtb.AddDef("t2", Gettype(String))
dtb.Build
For Each dr1 As DataRow In DataTables("AtdRecord88").DataRows
    For i As Integer = 0 To (dt2 - dt1).TotalDays
        Dim dr2 As DataRow = DataTables("统计表1").find("CardNo = '" & dr1("CardNo") & "'And date >= #" & dr1("time") & "# And date < #" & dr1("time").AddDays(1) & "# ")
        If dr2 IsNot Nothing Then
            dr2 = DataTables("统计表1").Addnew
            dr2("name") = dr1("recName")
            dr2("CardNo") = dr1("CardNo")
            dr2("date") = dt1.AddDays(i)
            Dim drs As List(of DataRow) =  DataTables("AtdRecord88").Select("CardNo = '" & dr2("CardNo") & "'And Time >= #" & dr2("Date") & "# And Time < #" & dr2("Date").AddDays(1) & "# ")
            For n As Integer = 0 To drs.count -1
                Dim t As String = Format(drs(n)("Time"),"HH:mm")
                If t <= "12:00" Then
                    dr2("t1") = t
                Else
                    dr2("t2") = t
                End If
                Exit For
            Next
        End If
    Next
Next

 回到顶部