Dim bd1 As New GroupTableBuilder("统计表",DataTables("铝板到料记录"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("材质") '根据品名分组
bd1.Groups.AddDef("板厚") '根据型号分组
bd1.Groups.AddDef("宽") '根据品名分组
bd1.Groups.AddDef("长") '根据型号分组
bd1.Groups.AddDef("订料工程") '根据品名分组
bd1.Groups.AddDef("单片价格") '根据型号分组
bd1.Totals.AddDef("数量","到料") '对数量进行统计
dt1 = bd1.BuildDataSource()
bd1 = New GroupTableBuilder("统计表2",DataTables("铝板用料记录"))
Dim dt2 As fxDataSource
bd1.Groups.AddDef("材质") '根据品名分组
bd1.Groups.AddDef("板厚") '根据型号分组
bd1.Groups.AddDef("宽") '根据品名分组
bd1.Groups.AddDef("长") '根据型号分组
bd1.Groups.AddDef("订料工程") '根据品名分组
bd1.Groups.AddDef("单片价格") '根据型号分组
bd1.Totals.AddDef("数量","用料") '对数量进行统计
dt2 = bd1.BuildDataSource()
Dim nms As String() = {"材质","板厚","宽","长","订料工程","单片价格"} '指定连接列
dt1.Combine(nms,dt2,nms) '将销售统计数据组合到进货统计数据
Dim t1 As Table =Tables("窗口1_Table1")
t1.DataSource = dt1
t1.DataTable.DataCols.Add("剩料", Gettype(Double), "iif([到料] is Null,0,[到料])-iif([用料] is null,0,[用料])")