计算请假天数还是有难度的,我帮楼主写一下:
If e.DataCol.name="请假天数" Then
If e.DataRow.IsNull("开始日期") = False AndAlso e.DataRow.IsNull("请假天数")=False Then
Dim i As Integer=1
Dim d As Date=e.DataRow("开始日期")
Do While i<e.DataRow("请假天数")
d=d.adddays(1)
If DataTables("法定假期").Find("日期=#" & d & "#") Is Nothing Then
If DataTables("节假日调休").Find("日期=#" & d & "#") Is Nothing Then
If d.DayOfWeek <> 0 AndAlso d.DayOfWeek <> 6 Then
i=i+1
End If
End If
End If
Loop
e.DataRow("结束日期") = d
End If
ElseIf e.DataCol.name = "结束日期" Then
If e.DataRow.IsNull("开始日期") = False AndAlso e.DataRow.IsNull("结束日期")=False Then
Dim cnt As Integer = (e.DataRow("结束日期") - e.DataRow("开始日期")).Totaldays
Dim dys As Integer = 0
For i As Integer = 0 To cnt
Dim d As Date= e.DataRow("开始日期").Adddays(i)
If DataTables("法定假期").Find("日期=#" & d & "#") Is Nothing Then
If DataTables("节假日调休").Find("日期=#" & d & "#") Is Nothing Then
If d.DayOfWeek <> 0 AndAlso d.DayOfWeek <> 6 Then
dys=dys+1
End If
End If
End If
Next
e.DataRow("请假天数") = dys
End If
End If