Select Case e.DataCol.Name
Case "订货数量","已发货数量"
e.DataRow("未发货数量")= e.DataRow("订货数量")-e.DataRow("已发货数量")
Case "发货数量","单价"
e.DataRow("发货金额")= e.DataRow("单价")*e.DataRow("发货数量")
Case "销售合同编码","产品编码"
Dim Filter2 As String = "[产品编码] = '" & e.DataRow("产品编码") & "' and [销售合同编码] = '" & e.DataRow("销售合同编码") & "'"
e.DataRow("已发货数量") = DataTables("发货明细表").Compute("Sum(发货数量)", Filter2)
End Select
Select Case e.DataCol.name
Case "发货数量","订货数量","已发货数量"
If e.DataRow.IsNull("已发货数量") = False AndAlso e.DataRow("已发货数量") > e.DataRow("订货数量")
MessageBox.Show("总发货数量已超过订货数量!")
e.DataRow(e.DataCol.name) = e.OldValue
End If
If e.DataRow.IsNull("已发货数量") = True AndAlso e.DataRow("发货数量")> e.DataRow("订货数量")
MessageBox.Show("发货数量已超过订货数量!")
e.DataRow(e.DataCol.name) = e.OldValue
End If
End Select