Select Case e.DataCol.Name Case "物品名称" e.DataRow("本月收入_数量") = DataTables("采购入库单明细").Compute("Sum(数量)","[物品名称] = '" & e.NewValue & "'") + DataTables("成品入库单明细").Compute("Sum(数量)","[物品名称] = '" & e.NewValue & "'") + DataTables("领用退回单明细").Compute("Sum(数量)","[物品名称] = '" & e.NewValue & "'") + DataTables("销售退货单明细").Compute("Sum(数量)","[物品名称] = '" & e.NewValue & "'") e.DataRow("本月发出_数量") = DataTables("领用出库单明细").Compute("Sum(数量)","[物料名称] = '" & e.NewValue & "'") + DataTables("成品出库单明细").Compute("Sum(数量)","[物料名称] = '" & e.NewValue & "'") + DataTables("销售出库单明细").Compute("Sum(数量)","[物料名称] = '" & e.NewValue & "'") + DataTables("采购退货单细").Compute("Sum(数量)","[物料名称] = '" & e.NewValue & "'") Case "期初库存_数量","本月收入_数量","本月发出_数量" Dim dr As DataRow = e.DataRow dr("期末结存_数量") = dr("期初库存_数量") + dr("本月收入_数量") - dr("本月发出_数量") End Select
|