Dim dr As DataRow = e.DataRow
Select Case e.DataCol.name
Case "客户","地方","数量"
If dr.Isnull("客户") OrElse dr.Isnull("地方") OrElse dr.Isnull("数量") Then
dr("单价") = Nothing
Else
Dim pr As DataRow
pr = DataTables("单价").find("客户 = '" & dr("客户") & "' and 地方 = '" & dr("地方") & "' and 期初数量 <= " & dr("数量") & " and 限定数量 > " & dr("数量"))
If pr IsNot Nothing Then
dr("单价") = pr("单价")
else
dr("单价") = Nothing
End If
End If
End Select
[此贴子已经被作者于2017/11/20 21:30:42编辑过]