Dim dr As DataRow = e.DataRow
Select Case e.DataCol.Name
Case "重量","单价","折扣"
If dr.IsNull("重量") Then
dr("金额") = Nothing
Else
dr("金额") = dr("重量") * dr("单价") * dr("折扣")
End If
End Select
If e.DataCol.Name = "货物名称" Then
If e.NewValue Is Nothing Then
e.DataRow("单价2") = Nothing
Else
Dim fdr As DataRow
fdr = DataTables("货物名称").Find("[货物名称] = '" & e.NewValue & "'")
If fdr IsNot Nothing Then
e.DataRow("单价2") = fdr("单价2")
End If
End If
End If
If e.DataCol.Name = "公司名称" Then
If e.NewValue Is Nothing Then
e.DataRow("起运地") = Nothing
e.DataRow("仓库") = Nothing
e.DataRow("折扣") = Nothing
Else
Dim fdr As DataRow
fdr = DataTables("客户").Find("[公司名称] = '" & e.NewValue & "'")
If fdr IsNot Nothing Then
e.DataRow("起运地") = fdr("起运地")
e.DataRow("仓库") = fdr("仓库")
e.DataRow("折扣") = fdr("折扣")
End If
End If
End If