有点甜老师 代码已经弄成如下,但是是否出现了一个逻辑错误。
运行效果如下啦

此主题相关图片如下:000.jpg

外来人员登记效果正常

此主题相关图片如下:111.jpg

单位职工登记效果不正常了 没有根据作息时间来判断咯
代码如下:
If e.DataCol.Name = "姓名" Then
e.DataRow("登记时间") =Date.now()
Else If e.DataCol.Name = "登记时间" Then
If e.NewValue <> Nothing Then
Dim lx As String
Dim sd As WinForm.TextBox = Forms("考勤与来访登记").Controls("TextBox4")
Dim sfzh As String = sd.Text
Dim dr1 As DataRow
Dim po As Integer
dr1 = DataTables("员工资料").Find("身份证号码 = '" & sfzh & "'")
po = Tables("员工资料").FindRow(dr1)
If po >= 0 Then '如果找到
Dim d As Date = new Date(1, 1, 1, e.NewValue.hour, e.newValue.minute, 0)
Dim fdr As DataRow = DataTables("作息时间表").Find("开始时间 < #" & d & "#", "开始时间 desc")
e.DataRow("登记事项") = fdr("作息类型") & "登记"
lx = fdr("作息类型")
Else
e.DataRow("登记事项") = "来访登记"
lx = "来访"
End If
Dim dr As DataRow = e.DataTable.Find("姓名 = '" & e.DataRow("姓名") & "' and _Identify < " & e.DataRow("_Identify"), "_Identify desc")
If dr Is Nothing Then
e.DataRow("登记状态") = lx & "签到"
Else
If dr("登记状态").Contains("签到") Then
e.DataRow("登记状态") = lx & "签退"
Else
e.DataRow("登记状态") = lx & "签到"
End If
End If
Else
e.DataRow("登记事项") = Nothing
e.DataRow("事项详情") = Nothing
End If
End If