以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]统计中的表达式列  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=96213)

--  作者:lgj716330
--  发布时间:2017/2/15 15:01:00
--  [求助]统计中的表达式列
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

--  作者:lgj716330
--  发布时间:2017/2/15 15:02:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:22.png
图片点击可在新窗口打开查看

应该怎么写呢

--  作者:有点色
--  发布时间:2017/2/15 17:24:00
--  

试试

 

Dim bd2 As New GroupTableBuilder("销售统计1",DataTables("京东订单报表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("订单号")
bd2.Totals.AddDef("余额支付", AggregateEnum.max, "其他收款")
bd2.Totals.AddDef("应付金额", AggregateEnum.max, "应收货款")

dt2 = bd2.BuildDataSource()