-- 作者:青丘狐
-- 发布时间:2020/12/8 15:35:00
--
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("入库明细表")) Dim dt1 As fxDataSource bd1.Groups.AddDef("仓库") \'根据型号分组 bd1.Groups.AddDef("产地") \'根据型号分组 bd1.Groups.AddDef("货物名称") \'根据品名分组 bd1.Groups.AddDef("规格型号") \'根据型号分组 bd1.Totals.AddDef("数量","入库_数量") \'对数量进行统计 bd1.Totals.AddDef("重量","入库_重量") \'对金额进行统计 dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("出库明细表")) Dim dt2 As fxDataSource bd2.Groups.AddDef("仓库") \'根据型号分组 bd2.Groups.AddDef("产地") \'根据型号分组 bd2.Groups.AddDef("货物名称") \'根据品名分组 bd2.Groups.AddDef("规格型号") \'根据型号分组 bd2.Totals.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.Groups.AddDef("货物名称") \'根据品名分组 bd3.Groups.AddDef("规格型号") \'根据型号分组 bd3.Totals.AddDef("数量","退货_数量") \'对数量进行统计 bd3.Totals.AddDef("重量","退货_重量") \'对金额进行统计 dt3 = bd3.BuildDataSource()
Dim nms As String() = {"仓库","产地","货物名称","规格型号"} \'指定连接列 dt1.Combine(nms,dt2,nms) \'将销售统计数据组合到进货统计数据 dt1.Combine(nms,dt3,nms) \'将退货统计数据组合到进货统计数据 \'dt1.Show("统计表1") \'显示统计结果
Tables("销售提单登记_Table2").DataSource = dt1 \'将统计结果绑定到Table With DataTables("销售提单登记_Table2").DataCols \'用表达式列计算库存数据 .Add("库存_数量",Gettype(Integer), "IsNull([入库_数量],0) - ISNULL([出库_数量],0) - ISNULL([退货_数量],0)") .Add("库存_重量",Gettype(Double), "IsNull([入库_重量],0) - ISNULL([出库_重量],0) - ISNULL([退货_重量],0)") End With
With Tables("销售提单登记_Table2") .Cols("库存_数量").GrandTotal = True .Cols("库存_重量").GrandTotal = True .GrandTotal = True End With
可以按入库日期入库日期排下序吗?
[此贴子已经被作者于2020/12/8 15:35:24编辑过]
|
-- 作者:青丘狐
-- 发布时间:2020/12/8 16:18:00
--
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("期初库存")) Dim dt1 As fxDataSource
bd1.Groups.AddDef("仓库") \'根据型号分组 bd1.Groups.AddDef("产地") \'根据型号分组 bd1.Groups.AddDef("货物名称") \'根据品名分组 bd1.Groups.AddDef("规格型号") \'根据型号分组 bd1.Totals.AddDef("数量","期初_数量") \'对数量进行统计 bd1.Totals.AddDef("重量","期初_重量") \'对金额进行统计 dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("入库明细表")) Dim dt2 As fxDataSource
bd2.Groups.AddDef("仓库") \'根据型号分组 bd2.Groups.AddDef("产地") \'根据型号分组 bd2.Groups.AddDef("货物名称") \'根据品名分组 bd2.Groups.AddDef("规格型号") \'根据型号分组 bd2.Totals.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.Groups.AddDef("货物名称") \'根据品名分组 bd3.Groups.AddDef("规格型号") \'根据型号分组 bd3.Totals.AddDef("数量","出库_数量") \'对数量进行统计 bd3.Totals.AddDef("重量","出库_重量") \'对金额进行统计 dt3 = bd3.BuildDataSource()
Dim bd4 As New GroupTableBuilder("统计表4",DataTables("退货明细表")) Dim dt4 As fxDataSource bd4.Groups.AddDef("仓库") \'根据型号分组 bd4.Groups.AddDef("产地") \'根据型号分组 bd4.Groups.AddDef("货物名称") \'根据品名分组 bd4.Groups.AddDef("规格型号") \'根据型号分组 bd4.Totals.AddDef("数量","退货_数量") \'对数量进行统计 bd4.Totals.AddDef("重量","退货_重量") \'对金额进行统计 dt4 = bd4.BuildDataSource()
Dim nms As String() = {"仓库","产地","货物名称","规格型号"} \'指定连接列 dt1.Combine(nms,dt2,nms) \'将销售统计数据组合到进货统计数据 dt1.Combine(nms,dt3,nms) \'将退货统计数据组合到进货统计数据 dt1.Combine(nms,dt4,nms)
Tables("销售提单登记_Table2").DataSource = dt1 \'将统计结果绑定到Table With DataTables("销售提单登记_Table2").DataCols \'用表达式列计算库存数据 .Add("库存_数量",Gettype(Integer), "IsNull([期初_数量],0) + IsNull([入库_数量],0) - ISNULL([出库_数量],0) - ISNULL([退货_数量],0)") .Add("库存_重量",Gettype(Double), "IsNull([期初_重量],0) + IsNull([入库_数量],0) - ISNULL([出库_重量],0) - ISNULL([退货_重量],0)") End With
With Tables("销售提单登记_Table2") .Cols("库存_数量").GrandTotal = True .Cols("库存_重量").GrandTotal = True .GrandTotal = True End With
要隐藏 期初数量和退货数量 可以吗?请问要怎样写代码?
|