试试,报错,就上传具体例子。
Dim d1 As Date
Dim d2 As Date
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "下单日期 >= '" & d1 & "' And 下单日期 <= '" & d2 & "'"
Dim bd1a As New GroupTableBuilder("统计表1a",DataTables("加工费记录_table1"))
Dim dt1a As fxDataSource
bd1a.Groups.AddDef("下单日期",DateGroupEnum.Year ,"年") '根据下单日期分组
bd1a.Groups.AddDef("下单日期",DateGroupEnum.Month ,"月") '根据下单日期分组
bd1a.Groups.AddDef("下单日期",DateGroupEnum.Day ,"日") '根据下单日期分组
bd1a.Totals.AddDef("加工单编号",AggregateEnum.Count,"下单_单数") '对订单数进行统计
bd1a.Totals.AddDef("金额","下单_金额") '对金额进行统计
dt1a = bd1a.BuildDataSource()
Dim bd2a As New GroupTableBuilder("统计表2a",DataTables("加工费记录_table1"))
Dim dt2a As fxDataSource
bd2a.Filter = "完工日期 is not null"
bd2a.Groups.AddDef("完工日期",DateGroupEnum.Year,"年" ) '根据完工日期分组
bd2a.Groups.AddDef("完工日期",DateGroupEnum.Month,"月" ) '根据完工日期分组
bd2a.Groups.AddDef("完工日期",DateGroupEnum.Day,"日" ) '根据完工日期分组
bd2a.Totals.AddDef("加工单编号",AggregateEnum.Count,"完工_单数") '对订单数进行统计
bd2a.Totals.AddDef("金额","完工_金额") '对金额进行统计
dt2a = bd2a.BuildDataSource()
Dim bd3a As New GroupTableBuilder("统计表3a",DataTables("加工费记录_table1"))
Dim dt3a As fxDataSource
bd3a.Filter = "完工日期 is null and 加工单编号 is not null and 门市 is not null and 地址 is not null"
bd3a.Groups.AddDef("下单日期",DateGroupEnum.Year,"年") '根据下单日期分组
bd3a.Groups.AddDef("下单日期",DateGroupEnum.Month,"月") '根据下单日期分组
bd3a.Groups.AddDef("下单日期",DateGroupEnum.Day,"日") '根据下单日期分组
bd3a.Totals.AddDef("加工单编号",AggregateEnum.Count,"未完工_单数") '对订单数进行统计
bd3a.Totals.AddDef("金额","未完工_金额") '对金额进行统计
dt3a = bd3a.BuildDataSource()
Dim nms As String() = {"年","月","日"} '指定连接列
dt1a.Combine(nms ,dt2a,nms )
dt1a.Combine(nms ,dt3a,nms )
Tables("加工费记录_Table3").DataSource = dt1a '将统计结果绑定到Table