我设了,是三个表都设吗?
入库表: If e.DataCol.name="期初入库数量" Then If e.DataRow.IsNull("物品名称")=False AndAlso e.DataRow.IsNull("规格")=False Then Dim dr As DataRow = DataTables("库存数量").Find("物品名称='" & e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'") If dr IsNot Nothing Then dr("期初入库数量")=e.DataTable.Compute("sum(期初入库数量)","物品名称='" & e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'") If e.DataRow.IsNull("规格")=Ture Then dr("期初入库数量")=e.DataTable.Compute("sum(期初入库数量)","物品名称='" &
e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'")
End If End If End If End If
领用表: If e.DataCol.name="领用数量" Then If e.DataRow.IsNull("物品名称")=False AndAlso e.DataRow.IsNull("规格")=False Then Dim dr As DataRow = DataTables("库存数量").Find("物品名称='" & e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'") If dr IsNot Nothing Then dr("领用数量")=e.DataTable.Compute("sum(领用数量)","物品名称='" & e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'") If e.DataRow.IsNull("规格")=Ture Then
dr("期初入库数量")=e.DataTable.Compute("sum(期初入库数量)","物品名称='" &
e.DataRow("物品名称") & "' and 规格 = '" & e.DataRow("规格") & "'")
End If
End If End If End If
库存数量表: Select Case e.DataCol.Name Case "物品名称" Dim Filter As String = "物品名称 = " & e.DataRow("物品名称") e.DataRow("期初入库数量") = DataTables("入库表").Compute("Sum(期初入库数量)", Filter) e.DataRow("领用数量") = e.DataRow("领用表") - e.DataRow("领用数量") Case "规格" If e.DataRow.IsNull("规格")=Ture Then e.DataRow("期初入库数量") = DataTables("入库表").Compute("Sum(期初入库数量)", Filter) e.DataRow("领用数量") = e.DataRow("领用表") - e.DataRow("领用数量")
End Select
|