模板增加一个标记<加班>,去掉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