Dim bd1 As New GroupTableBuilder("统计表1",DataTables("成本fa piao录入"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("项目分类")
bd1.Groups.AddDef("材料供应商")
bd1.Totals.AddDef("购进金额","已开piao_金额")
bd1.Totals.AddDef("fa piao数量","已开piao_数量")
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("付款明细表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("项目分类")
bd2.Groups.AddDef("材料供应商")
bd2.Totals.AddDef("付款金额","已付金额")
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("材料入库登记"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("项目分类")
bd3.Groups.AddDef("材料供应商")
bd3.Totals.AddDef("数量","收料结算_数量")
bd3.Totals.AddDef("金额","收料结算_金额")
dt3 = bd3.BuildDataSource()
Dim arr() As String = {"项目分类","材料供应商"}
dt1.Combine(arr,dt2,arr)
dt1.Combine(arr,dt3,arr)
dt1.show("统计表") '将统计结果绑定到Table
Dim t As Table = Tables("统计表")
With t.DataTable.DataCols '用表达式列计算库存数据
.Add("按fa piao未付款金额",Gettype(Integer), "IsNull([已开piao_金额],0) - ISNULL([已付金额],0)")
.Add("未开piao金额",Gettype(Integer), "IsNull([收料结算_金额],0) - ISNULL([已开piao_金额],0)")
.Add("按收料未付款金额",Gettype(Integer), "IsNull([收料结算_金额],0) - ISNULL([已付金额],0)")
End With
With Tables("统计表")
.MergeMode = MergeModeEnum.Standard
.MergeCols.Clear()
.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 = "收料结算_数量,收料结算_金额,已开piao_金额,已开piao_数量,已付金额,按fa piao未付款金额,按收料未付款金额"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
MainTable = t
以上运行没问题的,我想在统计表中加最后一列,“说明”,是文本列,不是备注列。数据取“成本fa piao录入”表中的“说明”中的内容。是某客户第一次发生时的数据,因为以后发生的就不重复写了。这个内容要加到统计表中的最后一列中去,代码如何修改? 或者以后发生时此列不填,为空也可以!
[此贴子已经被作者于2018/6/20 11:51:25编辑过]