Foxtable(狐表)用户栏目专家坐堂 → 考勤报表


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

主题:考勤报表

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


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/6/7 17:41:00 [显示全部帖子]

1.周末可以通过时间计算,节假日需要自己用一个表格存储


Select Case e.Col.Name
    Case "日期"
        If e.Row.IsNull("日期") = False Then
            Dim d As Date = e.Row("日期")
            If d.DayOfWeek = 0 OrElse d.DayOfWeek = 6 Then
                e.Style="样式1"
            End If
        End If
End Select

3.时间计算参考

DataColChanged事件

Select Case e.DataCol.Name
    Case "签到时间"
        If e.DataRow.IsNull(e.DataCol.Name) = False AndAlso e.DataRow.IsNull("上班时间") Then
            Dim ts As TimeSpan = e.DataRow(e.DataCol.Name) - e.DataRow("上班时间")
            If ts.TotalMinutes > 0 Then  e.DataRow("迟到时间") = ts.TotalMinutes
        End If
    Case "签退时间"
        If e.DataRow.IsNull(e.DataCol.Name) = False Then
            Dim ts As TimeSpan
            If e.DataRow.IsNull("下班时间") Then
                ts = e.DataRow(e.DataCol.Name) - e.DataRow("下班时间")
                If ts.TotalMinutes < 0 Then  e.DataRow("早退时间") = ts.TotalMinutes
            End If
            Dim d As Date = #18:30#
            ts = Cdate(e.DataRow(e.DataCol.Name)) - d
            If ts.TotalMinutes > 0 Then  e.DataRow("加班时间") = ts.TotalMinutes
        End If
End Select

有了时间费用计算完全是小学数学,就不说了

 回到顶部
帅哥哟,离线,有人找我吗?
Hyphen
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:5015 积分:25363 威望:0 精华:0 注册:2015/8/18 9:21:00
  发帖心情 Post By:2016/6/8 8:53:00 [显示全部帖子]

模板增加一个标记<加班>,去掉BuildGroupHeader事件


BeforeBuild事件


Select e.Book.TempLate
    Case "考勤"
        e.Book.Marks.Add("加班时间",Nothing)
        e.Book.Marks.Add("加班",Nothing)
End Select

BuildDetail事件

Select Case e.Book.TempLate
    Case "考勤"
        If e.DataRow IsNot Nothing Then
            Dim t As Boolean
            Dim d As Date = e.DataRow("日期")
            If d.DayOfWeek = 0 OrElse d.DayOfWeek = 6 Then
                t = True
                e.Book.Marks("加班时间") = "全天"
            Else
                e.Book.Marks("加班时间") = "18:30:00"
            End If
            If e.DataRow.IsNull("签到时间") = False AndAlso e.DataRow.IsNull("签退时间") = False Then
                d = #18:30#
                Dim ts As TimeSpan
                If t Then
                    ts = e.DataRow("签退时间") - e.DataRow("签到时间")
                    e.Book.Marks("加班") = ts.Hours & ":" & ts.Minutes & ":00"
                Else
                    ts = Cdate(e.DataRow("签退时间")) - d
                    If ts.TotalMinutes > 0 Then
                        e.Book.Marks("加班") = ts.Hours & ":" & ts.Minutes & ":00"
                    Else
                        e.Book.Marks("加班") = ""
                    End If
                End If
            Else
                e.Book.Marks("加班") = ""
            End If
        End If
End Select

 回到顶部