Dim Cols1() As String = {"姓名","部门","日期","时间"}
Dim Cols2() As String = {"姓名","部门","考勤日期","上午签到","上午签退","下午签到","下午签退"}
For Each dr1 As DataRow In DataTables("原始记录2").Select("")
Dim dr2 As DataRow = DataTables("考勤报表").AddNew()
For i As Integer = 0 To Cols1.Length -1
If i = 3 Then
If dr1(Cols1(3)) <> "" Then
Dim Values() As String
Values = dr1(Cols1(3)).split(" ")
Select Case Values.Length
Case 1
dr2(Cols2(3)) = Values(0)
Case 2
dr2(Cols2(3)) = Values(0)
dr2(Cols2(4)) = Values(1)
Case 3
dr2(Cols2(3)) = Values(0)
dr2(Cols2(4)) = Values(1)
dr2(Cols2(5)) = Values(2)
Case 4
dr2(Cols2(3)) = Values(0)
dr2(Cols2(4)) = Values(1)
dr2(Cols2(5)) = Values(2)
dr2(Cols2(6)) = Values(3)
End Select
End If
Else
dr2(Cols2(i)) = dr1(Cols1(i))
End If
Next
Next