--
修改后出错,哪里改错了?
If e.DataCol.Name = "本次数量" Then
If e.DataRow.IsNull("中标工程名称") = False AndAlso e.DataRow.IsNull("SubString([产品编号],0,6)") = False _
AndAlso e.DataRow.IsNull("本次数量") = False AndAlso e.DataRow.IsNull("第几次采购") = False Then
Dim sum As Double = e.DataTable.Compute("Sum(本次数量)","中标工程名称 = \'" & e.DataRow("中标工程名称") & "\' And SubString([产品编号],0,6) = \'" & _
e.DataRow("SubString([产品编号],0,6)") & "\' And 第几次采购 <= \'" & e.DataRow("第几次采购") & "\'")
e.DataRow("剩余数量") = e.DataRow("成本预算数量") - sum
End If
End If
If e.DataCol.Name = "SubString([产品编号],0,6)" Then
Dim fdr As DataRow = DataTables("材料费预算表").Find("中标工程名称 = \'" & e.DataRow("中标工程名称") & "\' and SubString([产品编号],0,6) = \'" & e.NewValue & "\'")
If fdr IsNot Nothing Then
e.DataRow("成本预算数量") = fdr("数量")
e.DataRow("成本预算单价") = fdr("单价")
Else
fdr = DataTables("产品价格库").Find("SubString([产品编号],0,6) = \'" & e.NewValue & "\'")
e.DataRow("成本预算数量") = 0
If fdr IsNot Nothing Then
e.DataRow("成本预算单价") = fdr("单价")
End If
End If
End If