Select Case e.DataCol.name Case "货号", "颜色", "仓库" Dim filter As String = "货号='" & e.DataRow("货号") & "' and 颜色='" & e.DataRow("颜色") & "' and 仓库='" & e.DataRow("仓库") & "'" For Each dc As DataCol In e.DataTable.DataCols If dc.name.StartsWith("尺码_") Then Dim sum1 = DataTables("入库明细").Compute("sum(" & dc.name & ")", filter) Dim sum2 = DataTables("出库明细").Compute("sum(" & dc.name & ")", filter) Dim sum3 = DataTables("销售明细").Compute("sum(" & dc.name & ")", filter) e.DataRow(dc.name) = sum1-sum2-sum3 End If Next End Select
|