老师 库存统计 请看下图
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("进货明细"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("颜色") '根据型号分组
bd1.Totals.AddDef("第一列","进货_S") '对数量进行统计
bd1.Totals.AddDef("第二列","进货_M") '对数量进行统计
bd1.Totals.AddDef("第三列","进货_L") '对数量进行统计
bd1.Totals.AddDef("第四列","进货_XL") '对数量进行统计
bd1.Totals.AddDef("第五列","进货_2XL") '对数量进行统计
bd1.Totals.AddDef("第六列","进货_3XL") '对数量进行统计
bd1.Totals.AddDef("第七列","进货_4XL") '对数量进行统计
bd1.Totals.AddDef("第八列","进货_5XL") '对数量进行统计
bd1.Totals.AddDef("第九列","进货_6XL") '对数量进行统计
bd1.Totals.AddDef("数量小计","进货_数量小计") '对数量进行统计
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("出库明细"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("颜色") '根据型号分组
bd2.Totals.AddDef("第一列","出库_S") '对数量进行统计
bd2.Totals.AddDef("第二列","出库_M") '对数量进行统计
bd2.Totals.AddDef("第三列","出库_L") '对数量进行统计
bd2.Totals.AddDef("第四列","出库_XL") '对数量进行统计
bd2.Totals.AddDef("第五列","出库_2XL") '对数量进行统计
bd2.Totals.AddDef("第六列","出库_3XL") '对数量进行统计
bd2.Totals.AddDef("第七列","出库_4XL") '对数量进行统计
bd2.Totals.AddDef("第八列","出库_5XL") '对数量进行统计
bd2.Totals.AddDef("第九列","出库_6XL") '对数量进行统计
bd2.Totals.AddDef("数量小计","出库_数量小计") '对数量进行统计
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("退货明细"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("颜色") '根据型号分组
bd3.Totals.AddDef("第一列","退货_S") '对数量进行统计
bd3.Totals.AddDef("第二列","退货_M") '对数量进行统计
bd3.Totals.AddDef("第三列","退货_L") '对数量进行统计
bd3.Totals.AddDef("第四列","退货_XL") '对数量进行统计
bd3.Totals.AddDef("第五列","退货_2XL") '对数量进行统计
bd3.Totals.AddDef("第六列","退货_3XL") '对数量进行统计
bd3.Totals.AddDef("第七列","退货_4XL") '对数量进行统计
bd3.Totals.AddDef("第八列","退货_5XL") '对数量进行统计
bd3.Totals.AddDef("第九列","退货_6XL") '对数量进行统计
bd3.Totals.AddDef("数量小计","退货_数量小计") '对数量进行统计
dt3 = bd3.BuildDataSource()
dt1.Combine("颜色",dt2,"颜色") '将销售统计数据组合到进货统计数据
dt1.Combine("颜色",dt3,"颜色") '将退货统计数据组合到进货统计数据
Tables("库存统计_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("库存统计_Table1").DataCols '用表达式列计算库存数据
.Add("库存_S",Gettype(Integer), "IsNull([进货_S],0) - ISNULL([出库_S],0) - ISNULL([退货_S],0)")
.Add("库存_M",Gettype(Integer), "IsNull([进货_M],0) - ISNULL([出库_M],0) - ISNULL([退货_M],0)")
.Add("库存_L",Gettype(Integer), "IsNull([进货_L],0) - ISNULL([出库_L],0) - ISNULL([退货_L],0)")
.Add("库存_XL",Gettype(Integer), "IsNull([进货_XL],0) - ISNULL([出库_XL],0) - ISNULL([退货_XL],0)")
.Add("库存_2XL",Gettype(Integer), "IsNull([进货_2XL],0) - ISNULL([出库_2XL],0) - ISNULL([退货_2XL],0)")
.Add("库存_3XL",Gettype(Integer), "IsNull([进货_3XL],0) - ISNULL([出库_3XL],0) - ISNULL([退货_3XL],0)")
.Add("库存_4XL",Gettype(Integer), "IsNull([进货_4XL],0) - ISNULL([出库_4XL],0) - ISNULL([退货_4XL],0)")
.Add("库存_5XL",Gettype(Integer), "IsNull([进货_5XL],0) - ISNULL([出库_5XL],0) - ISNULL([退货_5XL],0)")
.Add("库存_6XL",Gettype(Integer), "IsNull([进货_6XL],0) - ISNULL([出库_6XL],0) - ISNULL([退货_6XL],0)")
.Add("库存_数量小计",Gettype(Integer), "IsNull([进货_数量小计],0) - ISNULL([出库_数量小计],0) - ISNULL([退货_数量小计],0)")
End With
此主题相关图片如下:00.jpg