If e.DataCol.Name = "日期" Then
If e.NewValue = Nothing Then
e.DataRow("星期") = Nothing
Else
e.DataRow("星期") = Format(e.DataRow("日期"), "dddd")
CurrentTable.AddNew(10)
End If
End If
If e.DataCol.Name = "时间" Then
If e.NewValue = Nothing Then
e.DataRow("排序时间") = Nothing
Else
e.DataRow("排序时间") = e.DataRow("时间").Substring(3)
End If
End If
If e.DataCol.Name = "日期" Then
If e.NewValue = Nothing Then
e.DataRow("星期") = Nothing
Else
e.DataRow("星期") = Format(e.DataRow("日期"), "dddd")
End If
Else If e.DataRow.IsNull("星期") = False AndAlso (e.DataCol.Name = "星期" OrElse e.DataCol.Name = "新老客户" AndAlso e.DataRow("新老客户")="老客户") Then
Dim i As Integer = 0
Dim dr As DataRow
SystemReady = False
For Each fdr As DataRow In DataTables("客户数据").Select("固定时间 = '" & e.DataRow("星期") & "'", "固定排序,排序时间")
If i = 0 Then
dr = e.DataRow
Else
dr = e.DataTable.AddNew
End If
dr("日期") = e.DataRow("日期")
dr("星期") = e.DataRow("星期")
dr("新老客户") = e.DataRow("新老客户")
dr("客户信息") = fdr("综合信息")
dr("时间") = fdr("时间")
dr("支付方式") = fdr("支付方式")
dr("备注") = fdr("备注")
dr("排序时间") = fdr("时间").Substring(3)
dr("单价") = fdr("单价")
dr("签约终止日") = Iif(fdr.IsNull("签约终止日"), Nothing, fdr("签约终止日"))
i += 1
Next
e.DataTable.DeleteFor("日期 is Null")
SystemReady = True
Tables("派工表").sort = "日期,排序时间"
CurrentTable.AddNew(15)
With Tables("派工表")
.Position = .Rows.Count - 1
End With
End If
If e.DataCol.Name = "客户信息" Then
Dim dr As DataRow
dr = DataTables("客户数据").Find("综合信息 = '" & e.DataRow("客户信息") & "'" )
If dr IsNot Nothing '如果找到, 则设置各列内容
systemready = False
e.DataRow("新老客户") = dr("新老客户")
systemready = True
e.DataRow("时间")= dr("时间")
e.DataRow("支付方式")= dr("支付方式")
e.DataRow("备注")= dr("备注")
e.DataRow("签约终止日") = dr("签约终止日")
e.DataRow("单价") = dr("单价")
End If
End If
If e.DataCol.Name = "休息"
systemready = False
For Each dr As DataRow In DataTables("派工表").Select("日期 = #" & e.DataRow("日期") & "#")
dr("休息") = e.DataRow("休息")
Next
systemready = True
End If
Select Case e.DataCol.name
Case "单价","保洁员"
If e.DataRow.IsNull("单价") OrElse e.DataRow.IsNull("保洁员") Then
e.DataRow("人均价") = Nothing
Else
Dim nms As String = e.DataRow("保洁员")
If e.DataRow("新老客户") = "老客户" OrElse e.DataRow("服务内容") ="全室保洁"
e.DataRow("人均价") = e.DataRow("单价") *2 / nms.Split(",").length
Else If e.DataRow("新老客户") = "老客户" OrElse e.DataRow("服务内容") ="日常保洁"
e.DataRow("人均价") = e.DataRow("单价") / nms.Split(",").length
Else If e.DataRow("新老客户") = "新客户" OrElse e.DataRow("服务内容") ="全室保洁" AndAlso e.DataRow("开荒")
e.DataRow("人均价") = e.DataRow("单价") / nms.Split(",").length
End If
End If
End Select