If e.DataCol.Name = "订单号" Then
If e.NewValue Is Nothing Then
'e.DataRow("收款金额") = Nothing
Else
e.DataRow("收款金额") = DataTables("收款").Compute("sum(金额)","[订单编号] = '" & e.NewValue & "'")
End If
End If
If e.DataCol.Name = "订单号" Then
If e.NewValue Is Nothing Then
e.DataRow("发货日") = Nothing
e.DataRow("手机号") = Nothing
e.DataRow("系统订单号") = Nothing
e.DataRow("状态") = Nothing
Else
Dim cy As DataRow
cy = DataTables("系统").Find("[平台订单号] = '" & e.NewValue & "'")
If cy IsNot Nothing Then '如果找到了同名的产品行,也就是dr不是Nothing
e.DataRow("发货日") = cy("开始日期")
e.DataRow("手机号") = cy("联系电话")
e.DataRow("系统订单号") = cy("订单号")
e.DataRow("状态") = cy("订单状态")
Else
e.DataRow("发货日") = Nothing
e.DataRow("手机号") = Nothing
e.DataRow("系统订单号") = Nothing
e.DataRow("状态") = Nothing
End If
End If
End If
If e.DataCol.Name = "系统订单号" Then
If e.NewValue Is Nothing Then
e.DataRow("是否发货") = Nothing
Else
Dim dh As String
Dim cr As DataRow
cr = DataTables("第二次发货").Find("[系统订单号] = '" & e.NewValue & "'")
If cr IsNot Nothing Then
dh = cr("第二次发货单号")
End If
cr = DataTables("销售直接发货").Find("[系统订单号] = '" & e.NewValue & "'and 直接发货订单号 <> '" & e.NewValue & "'")
If cr IsNot Nothing Then '
dh = dh & "," & cr("直接发货订单号")
End If
e.DataRow("是否发货") = dh
End If
End If
If e.DataCol.Name = "订单号" Then
If e.NewValue Is Nothing Then
e.DataRow("供应商") = Nothing
Else
Dim br As DataRow
br = DataTables("A").Find("[订单号] = '" & e.NewValue & "'")
If br IsNot Nothing Then
e.DataRow("供应商") = br("供应商")
Else
If e.NewValue Is Nothing Then
e.DataRow("供应商") = Nothing
Else
Dim bl As DataRow
bl = DataTables("B").Find("[订单号] = '" & e.NewValue & "'")
If bl IsNot Nothing Then
e.DataRow("供应商") = bl("供应商")
Else
If e.NewValue Is Nothing Then
e.DataRow("供应商") = Nothing
Else
Dim bc As DataRow
bc = DataTables("C").Find("[订单号] = '" & e.NewValue & "'")
If bc IsNot Nothing Then
e.DataRow("供应商") = bc("供应商")
End If
End If
End If
End If
End If
End If
End If