Dim bd1 As New GroupTableBuilder("销售统计",DataTables("管家销售明细账"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("原始单号")
bd1.Totals.AddDef("数量","出库数量")
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("销售统计1",DataTables("京东订单报表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("订单号")
bd2.Totals.AddExp("余额支付","","其他收款",AggregateEnum.max)
bd2.Totals.AddExp("应付金额","","应收货款",AggregateEnum.max)
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("京东结算2"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("订单编号")
bd3.Totals.AddDef("货款")
bd3.Totals.AddDef("佣金")
bd3.Totals.AddDef("店铺东券金额")
dt3 = bd3.BuildDataSource()
dt1.Combine("原始单号",dt2,"订单号")
dt1.Combine("原始单号",dt3,"订单编号")
dt1.Show("销售统计") '显示统计结果
Tables("销售统计").Filter = "[货款] Is not Null"
With DataTables("销售统计").DataCols
.Add("收款差异",Gettype(Double), "isnull([货款],0)-[应收货款]-[其他收款]")
End With