Dim kcbs As String = DataTables("库存表").getcomboliststring("入库编号")
kcbs = "('"& kcbs.replace("|","','") & "')"
Dim Ckbs As String = DataTables("出库表").getcomboliststring("入库编号","入库编号 in " & kcbs)
Ckbs = "('"& ckbs.replace("|","','") & "')"
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("入库表"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("品名大类") '根据品名大类分组
bd1.Totals.AddDef("重量","入库_重量") '对重量进行统计
bd1.Totals.AddDef("匹数","入库_匹数") '对匹数进行统计
bd1.fromserver = True
bd1.filter = "入库编号 In ('" & ckbs & "')"
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("库存表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("品名大类") '根据品名大类分组
bd2.Totals.AddDef("重量","库存_重量") '对重量进行统计
bd2.Totals.AddDef("匹数","库存_匹数") '对匹数进行统计
bd2.fromserver = True
bd2.filter = "入库编号 In ('" & ckbs & "')"
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("出库表"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("品名大类") '根据品名大类分组
bd3.Totals.AddDef("重量","出库_重量") '对重量进行统计
bd3.Totals.AddDef("匹数","出库_匹数") '对匹数进行统计
bd3.fromserver = True
bd3.filter = "入库编号 In ('" & ckbs & "')"
dt3 = bd3.BuildDataSource()
dt1.Combine("品名大类",dt2,"品名大类") '将库存统计数据组合到入库统计数据
dt1.Combine("品名大类",dt3,"品名大类") '将出库统计数据组合到入库统计数据
Tables("统计窗口_Table1").DataSource = dt1 '将统计结果绑定到Table
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()