Dim bd1 As New GroupTableBuilder("统计表1",DataTables("应收往来"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("客户") '根据客户分组
bd1.Totals.AddDef("发货金额","应收往来_发货金额") '对金额进行统计
bd1.Totals.AddDef("收款","应收往来_收款") '对金额进行统计
dt1 = bd1.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("客户"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("客户") '根据客户分组
bd3.Totals.AddDef("周转金","客户_周转金") '对金额进行统计
dt3 = bd3.BuildDataSource()
dt1.Combine("客户",dt3,"客户") '将销售统计数据组合到统计数据
Tables("应收余额_table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("应收余额_table1").DataCols '用表达式列计算库存数据
.Add("应收余额_金额",Gettype(Double), "IsNull([应收往来_发货金额],0) - ISNULL([应收往来_收款],0) -IsNull([客户_周转金],0)")
End With