放在 DataColChanged 里,
栏 Norm_time(正常工时), x15_time(加班工时), x2_time(假日加班工时), Manday(人数), Total_hrs(总工时)
不知为何 重启后设有将 Total_hrs(总工时) 写入表内 ?
Select Case e.DataCol.Name
Case "norm_time","x15_time","x2_time","MANDAY"
Dim st1 As String = e.DataRow("norm_time")
Dim t11 As New timespan(val(mid(st1,1,2)),val(Mid(st1,4,2)),0)
Dim t12 As new TimeSpan(val(Mid(st1,7,2)),val(Mid(st1,10,2)),0)
Dim st2 As String = e.DataRow("x15_time")
Dim t21 As New timespan(val(mid(st2,1,2)),val(Mid(st2,4,2)),0)
Dim t22 As new TimeSpan(val(Mid(st2,7,2)),val(Mid(st2,10,2)),0)
Dim st3 As String = e.DataRow("x2_time")
Dim t31 As New timespan(val(mid(st3,1,2)),val(Mid(st3,4,2)),0)
Dim t32 As new TimeSpan(val(Mid(st3,7,2)),val(Mid(st3,10,2)),0)
Dim t1,t2,t3 As TimeSpan
t1 = t12.Subtract(t11) 't3等于t2减去t1
t2 = t22.Subtract(t21) 't3等于t2减去t1
t3 = t32.Subtract(t31) 't3等于t2减去t1
' messagebox.Show(t3.Days & "天" & t3.Hours & "小时'" & t3.Minutes & "分" & t3.Seconds & "秒")
e.DataRow("Total_hrs") = (t1.TotalHours()+t2.TotalHours()+t3.totalHours()) * e.DataRow("manday")
' Case "E列", "F列"
'代码五
End Select