-- 作者:nbsugu_z
-- 发布时间:2018/6/16 12:51:00
-- 分组统计出现问题
Case "项目工程款结算汇总表" Dim bd1 As New GroupTableBuilder("统计表A1",DataTables("项目名称")) Dim dt1 As fxDataSource bd1.Groups.AddDef("项目分类") bd1.Groups.AddDef("业主全称","业主名称") bd1.Groups.AddDef("挂靠单位名称") bd1.Totals.AddDef("合同产值") \'bd1.Totals.AddDef("发票数量","已开票_数量") dt1 = bd1.BuildDataSource() Dim bd2 As New GroupTableBuilder("统计表A2",DataTables("工程款发票录入")) Dim dt2 As fxDataSource bd2.Groups.AddDef("项目分类") bd2.Groups.AddDef("收票方","业主名称") bd2.Groups.AddDef("开票方","挂靠单位名称") bd2.Totals.AddDef("价税合计","已开工程款发票") dt2 = bd2.BuildDataSource() Dim bd3 As New GroupTableBuilder("统计表A3",DataTables("收款明细表")) Dim dt3 As fxDataSource bd3.Groups.AddDef("项目分类") bd3.Groups.AddDef("付款单位","业主名称") bd3.Groups.AddDef("收款单位","挂靠单位名称") bd3.Totals.AddDef("收款金额","已付工程款") dt3 = bd3.BuildDataSource() Dim bd4 As New GroupTableBuilder("统计表A4",DataTables("付款明细表")) Dim dt4 As fxDataSource bd4.Groups.AddDef("项目分类") bd4.Groups.AddDef("业主全称","业主名称") bd4.Groups.AddDef("付款单位","挂靠单位名称") bd4.Totals.AddDef("付款金额","挂靠单位转付材料款") dt4 = bd4.BuildDataSource()
Dim arr() As String = {"项目分类","业主名称","挂靠单位名称"} dt1.Combine(arr,dt2,arr) dt1.Combine(arr,dt3,arr) dt1.Combine(arr,dt4,arr)
dt1.show("统计表A") \'将统计结果绑定到Table Dim t As Table = Tables("统计表A") With Tables("统计表A") .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 = "合同产值,已开工程款发票,已付工程款,挂靠单位转付材料款" g.Caption = "总计" t.SubtotalGroups.Add(g) t.Subtotal() MainTable = t End Select
老师,以上代码分组统计出来表格后数据乱了,有什么问题吗?
我是4个表汇总的,分组名 项目类型、业主名称、挂靠单位名称是唯一对应关系的。可是表格出来后项目名称和业主名称倒是分得对的,可以里面出来其它挂靠单位名字了。
|