以下内容为程序代码:
1 Dim bd1 As New SQLGroupTableBuilder("统计表1", "入库单明细")
2 Dim dt1 As fxDataSource
3 bd1.C
4 bd1.Groups.AddDef("生产批号") \'根据型号分组
5 bd1.Groups.AddDef("仓库")
6 bd1.Groups.AddDef("商品编号")
7 bd1.Groups.AddDef("规格")
8 bd1.Totals.AddDef("数量", "入库") \'对数量进行统计
9 bd1.Groups.AddDef("支数")
10 bd1.Groups.AddDef("生产人")
11 \'bd1.Groups.AddDef("备注")
12 bd1.Filter = " 未领用<>0 "
13 dt1 = bd1.BuildDataSource()
14
15 Dim bd2 As New SQLGroupTableBuilder("统计表2", "出库单明细")
16 Dim dt2 As fxDataSource
17 bd2.C
18 bd2.Groups.AddDef("生产批号") \'根据型号分组
19 bd2.Totals.AddDef("数量", "出库") \'对数量进行统计
20 dt2 = bd2.BuildDataSource()
21
22 dt1.Combine("生产批号", dt2, "生产批号") \'将销售统计数据组合到进货统计数据
23 \'dt1.Show("统计表1") \'显示统计结果
24
25 Tables("生产批号选择_Table1").DataSource = dt1
26 With DataTables("生产批号选择_Table1").DataCols
27 .Add("未领用", GetType(Integer), "IsNull([入库],0)-IsNull([出库],0)")
28 End With
29