Dim bd1 As New GroupTableBuilder("统计表1",DataTables("出库"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("产品") '根据型号分组
bd1.Totals.AddDef("数量","出库数量") '对数量进行统计
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("入库"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("产品") '根据型号分组
bd2.Totals.AddDef("数量","入库数量") '对数量进行统计
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("期初"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("产品") '根据型号分组
bd3.Totals.AddDef("数量","期初数量") '对数量进行统计
dt3 = bd3.BuildDataSource()
dt1.Combine("产品",dt2,"产品") '将销售统计数据组合到进货统计数据
dt1.Combine("产品",dt3,"产品") '将退货统计数据组合到进货统计数据
Tables("窗口1_Table1").DataSource = dt1 '将统计结果绑定到Table
For Each r As Row In Tables("窗口1_Table1").Rows
For Each c As col In Tables("窗口1_Table1").Cols
If c.DataCol.IsNumeric AndAlso r.IsNull(c.name) Then
r(c.name) = 0
End If
Next
Next