Select Case e.DataCol.Name
Case "单价","订单数量"
e.DataRow("金额")=e.DataRow("单价") * e.DataRow("订单数量")
Case "客户名称","订单编号","金额"
DataTables("订单主表").DataCols("订单编号").RaiseDataColChanged("客户名称='" & e.DataRow("客户名称") & "' and 订单编号='" & e.DataRow("订单编号") & "'")
End Select
Select Case e.DataCol.Name
Case "客户名称","物料编号","版本号"
e.DataRow("现有库存数量") = DataTables("入库主表").Compute("Sum(现有库存数量)","[客户名称] = '" & e.DataRow("客户名称") & "' and [物料编号]='" & e.DataRow("物料编号") & "' and [版本号]='" & e.DataRow("版本号") & "'")
End Select
Select Case e.DataCol.Name
Case "客户名称","物料编号","版本号","订单编号"
e.DataRow("已交数量") = DataTables("出库明细表").Compute("Sum(实交数量)","[客户名称] = '" & e.DataRow("客户名称") & "' and [物料编号]='" & e.DataRow("物料编号") & "' and [版本号]='" & e.DataRow("版本号") & "' and [订单编号]='" & e.DataRow("订单编号") & "'")
e.DataRow("未交数量") = e.DataRow("订单数量") - e.DataRow("已交数量")+DataTables("退货明细表").Compute("Sum(退货数量)","[客户名称] = '" & e.DataRow("客户名称") & "' and [物料编号]='" & e.DataRow("物料编号") & "' and [版本号]='" & e.DataRow("版本号") & "' and [订单编号]='" & e.DataRow("订单编号") & "'")
End Select