Dim bd1 As New GroupTableBuilder("统计表B1",DataTables("pzk"))
Dim dt1 As fxDataSource '工程fa piao
bd1.Groups.AddDef("fa piao1_所属项目","项目分类")
bd1.Groups.AddDef("fa piao1_出piao方","结算平台名称")
bd1.Groups.AddDef("年月")
bd1.Totals.AddDef("fa piao1_税额","fa piao销项税")
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表B2",DataTables("pzk"))
Dim dt2 As fxDataSource '主材料fa piao
bd2.Groups.AddDef("fa piao_所属项目","项目分类")
bd2.Groups.AddDef("fa piao_平台","结算平台名称")
bd2.Groups.AddDef("年月")
bd2.Totals.AddDef("fa piao_税额","进项税_主材fa piao")
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表B3",DataTables("pzk"))
Dim dt3 As fxDataSource '劳务费fa piao
bd3.Groups.AddDef("成本1_所属项目","项目分类")
bd3.Groups.AddDef("成本1_收piao方","结算平台名称")
bd3.Groups.AddDef("年月")
bd3.Totals.AddDef("成本1_税额","进项税_劳务fa piao")
dt3 = bd3.BuildDataSource()
Dim bd4 As New GroupTableBuilder("统计表B4",DataTables("pzk"))
Dim dt4 As fxDataSource
bd4.Groups.AddDef("报销_所属项目","项目分类")
bd4.Groups.AddDef("报销_平台","结算平台名称")
bd4.Groups.AddDef("年月")
bd4.Totals.AddDef("报销_税额","进项税_报销fa piao")
dt4 = bd4.BuildDataSource()
Dim arr() As String = {"项目分类","结算平台名称","年月"}
dt1.Combine(arr,dt2,arr)
dt1.Combine(arr,dt3,arr)
dt1.Combine(arr,dt4,arr)
dt1.show("统计表B") '将统计结果绑定到Table
Dim t As Table = Tables("统计表B")
With t.DataTable.DataCols '用表达式列计算库存数据
.Add("进项税_小计",Gettype(Double), "IsNull([进项税_主材fa piao],0) + ISNULL([进项税_劳务fa piao],0)+ISNULL([进项税_报销fa piao],0)")
.Add("应交增值税",Gettype(Double), "IsNull([fa piao销项税],0) - ISNULL([进项税_小计],0)")
End With
With Tables("统计表B")
.MergeMode = MergeModeEnum.Standard
.MergeCols.Clear()
.MergeCols.Add("项目分类")
.MergeCols.Add("结算平台名称")
.MergeCols.Add("年月")
.MergeSort = "项目分类,结算平台名称,年月"
.AllowMerge = True
End With
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 = "fa piao销项税,进项税_主材fa piao,进项税_劳务fa piao,进项税_报销fa piao,进项税_小计,应交增值税"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "项目分类"
g.TotalOn = "fa piao销项税,进项税_主材fa piao,进项税_劳务fa piao,进项税_报销fa piao,进项税_小计,应交增值税"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
t.Subtotal()
MainTable = t
'以下显示格式
Tables("统计表B").cols("fa piao销项税").DataCol.setFormat("#,###.00")
Tables("统计表B").cols("进项税_主材fa piao").DataCol.setFormat("#,###.00")
Tables("统计表B").cols("进项税_劳务fa piao").DataCol.setFormat("#,###.00")
Tables("统计表B").cols("进项税_报销fa piao").DataCol.setFormat("#,###.00")
Tables("统计表B").cols("进项税_小计").DataCol.setFormat("#,###.00")
Tables("统计表B").cols("应交增值税").DataCol.setFormat("#,###.00")
Dim frm As WinForm.Form
frm = Forms("按项目应交增值税汇总窗口")
frm.Open()
MainTable = Tables("统计表B")
'结束
老师,以上代码正确无误,现在在第二分组“结算平台名称”合并列中有年月,请问小组的年月要按年月大小排序,如何加代码?