修改后
bd1.Totals.AddDef("交piao",AggregateEnum.Count(“交piao = true”),"交piao单数","订砖发货_交piao单数")
不能保存,出错,请老师赐教
DataTables("客户发砖总表").LoadFilter =""
DataTables("客户发砖总表").Load
DataTables("赊销销砖总表").LoadFilter =""
DataTables("赊销销砖总表").Load
Dim bd1 As New GroupTableBuilder("统计表1", DataTables("客户发砖总表"))
Dim fz As fxDataSource
bd1.Groups.AddDef("日期",DateGroupEnum.Year,"年") '添加日期列用于分组,并用"年"代替原名称
bd1.Groups.AddDef("日期","月")
bd1.Groups.AddDef("司机")
bd1.Totals.AddDef("本次运费","订砖发货_运费")
bd1.Totals.AddDef("已发数量","订砖发货_数量")
bd1.Totals.AddDef("日期",AggregateEnum.Count,"单数","订砖发货_单数")
bd1.Totals.AddDef("交piao",AggregateEnum.Count,"交piao单数","订砖发货_交piao单数")
bd1.Subtotal = True '开启垂直汇总模式
bd1.SubtotalLevel = 0 '只生成总计行
fz=bd1.BuildDataSource
Dim bd2 As New GroupTableBuilder("统计表1", DataTables("赊销销砖总表"))
Dim lx As fxDataSource
bd2.Groups.AddDef("日期",DateGroupEnum.Year,"年") '添加日期列用于分组,并用"年"代替原名称
bd2.Groups.AddDef("日期","月")
bd2.Groups.AddDef("司机")
bd2.Totals.AddDef("本次运费","赊销销砖_运费")
bd2.Totals.AddDef("赊砖数量","赊销销砖_数量")
bd2.Totals.AddDef("日期",AggregateEnum.Count,"单数","赊销销砖_单数")
bd2.Totals.AddDef("交piao",AggregateEnum.Count,"交piao单数","赊销销砖_交piao单数")
lx=bd2.BuildDataSource
Dim nms As String() = {"年","月","司机"} '指定连接列
fz.Combine(nms,lx,nms)
Tables("司机运费月报表_Table1").DataSource =fz
With DataTables("司机运费月报表_Table1").DataCols '用表达式计算合计
.Add("总运费",Gettype(Integer),"IsNull([订砖发货_运费],0)+IsNull([赊销销砖_运费],0)")
.Add("总数量",Gettype(Double),"IsNull([订砖发货_数量],0)+IsNull([赊销销砖_数量],0)")
End With
Dim t As Table = Tables("司机运费月报表_Table1")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "订砖发货_运费,订砖发货_数量,赊销销砖_运费,赊销销砖_数量,总运费,总数量"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()