-- 作者:xywl
-- 发布时间:2017/6/5 17:47:00
--
我尝试了查询表,反应速度有点慢,另外我想请教,我有一张出入明细表,里面记录了出库,入库,移出,移入等操作类型,用查询表可以多表查询,但怎样在统计列并排显示不同的统计数据,就比如 [(编号) (商品名称) (商品规格) (出库数) (入库数)] 此主题相关图片如下:@n30@_a8`0_$f_gzlift{8.jpg
想要这种效果:
此主题相关图片如下:tc3a3z`~xu(j3e4dwxx1n0w.png
按钮代码是:
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("商品库存")) Dim dt1 As fxDataSource bd1.Groups.AddDef("Item") \'根据型号分组 bd1.Groups.AddDef("EnglishDescription") \'根据型号分组 bd1.Groups.AddDef("ChineseDescription") \'根据型号分组 bd1.Groups.AddDef("EnglishBrand") \'根据型号分组 bd1.Groups.AddDef("ChineseBrand") \'根据型号分组 bd1.Groups.AddDef("ItemCategory") \'根据型号分组 \'bd1.Totals.AddDef("数量","进货_数量") \'对数量进行统计 \'bd1.Totals.AddDef("金额","进货_金额") \'对金额进行统计 dt1 = bd1.BuildDataSource() Dim bd2 As New GroupTableBuilder("统计表2",DataTables("出入记录")) bd2.Filter = "[作业时间] >= # " & lbl3.value & "# and [作业时间] <= # " & lbl4.value & " # and 操作类型 = \'入库\'" Dim dt2 As fxDataSource bd2.Groups.AddDef("货品编号") \'根据型号分组 \'bd2.Groups.AddDef("英文描述") \'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("出入记录")) bd3.Filter = "[作业时间] >= # " & lbl3.value & "# and [作业时间] <= # " & lbl4.value & " # and 操作类型 = \'出库\'" Dim dt3 As fxDataSource bd3.Groups.AddDef("货品编号") \'根据型号分组 \'bd3.Groups.AddDef("英文描述") \'bd3.Groups.AddDef("中文描述") \'bd3.Groups.AddDef("英文名称") \'bd3.Groups.AddDef("中文名称") \'bd3.Groups.AddDef("商品类型") bd3.Totals.AddDef("数量","出库_数量") \'对数量进行统计 \'bd2.Totals.AddDef("金额","销售_金额") \'对金额进行统计 dt3 = bd3.BuildDataSource() \'Dim nms As String() = {"Item","EnglishDescription","ChineseDescription","EnglishBrand","ChineseBrand","ItemCategory"} \'Dim nmn As String() = {"货品编号","英文描述","中文描述","英文名称","中文名称","商品类型"} \'Dim mnm As String() = {"货品编号","英文描述","中文描述","英文名称","中文名称","商品类型"} dt1.Combine("Item",dt2,"货品编号") \'将销售统计数据组合到进货统计数据 dt1.Combine("Item",dt3,"货品编号") \'将退货统计数据组合到进货统计数据
Tables("报表统计_Table1").DataSource = dt1 \'将统计结果绑定到Table
|
-- 作者:有点色
-- 发布时间:2017/6/5 18:13:00
--
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("商品库存")) Dim dt1 As fxDataSource bd1.Groups.AddDef("Item") \'根据型号分组 bd1.Totals.AddDef("EnglishDescription", AggregateEnum.max, "英文描述") \'根据型号分组 bd1.Totals.AddDef("ChineseDescription", AggregateEnum.max) \'根据型号分组 bd1.Totals.AddDef("EnglishBrand", AggregateEnum.max) \'根据型号分组 bd1.Totals.AddDef("ChineseBrand", AggregateEnum.max) \'根据型号分组 bd1.Totals.AddDef("ItemCategory", AggregateEnum.max) \'根据型号分组 dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("出入记录")) bd2.Filter = "[作业时间] >= # " & lbl3.value & "# and [作业时间] <= # " & lbl4.value & " # and 操作类型 = \'入库\'" Dim dt2 As fxDataSource bd2.Groups.AddDef("货品编号") \'根据型号分组 bd2.Totals.AddDef("数量","入库_数量") \'对数量进行统计 dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("出入记录")) bd3.Filter = "[作业时间] >= # " & lbl3.value & "# and [作业时间] <= # " & lbl4.value & " # and 操作类型 = \'出库\'" Dim dt3 As fxDataSource bd3.Groups.AddDef("货品编号") \'根据型号分组 bd3.Totals.AddDef("数量","出库_数量") \'对数量进行统计 dt3 = bd3.BuildDataSource()
dt1.Combine("Item",dt2,"货品编号") \'将销售统计数据组合到进货统计数据 dt1.Combine("Item",dt3,"货品编号") \'将退货统计数据组合到进货统计数据
Tables("报表统计_Table1").DataSource = dt1 \'将统计结果绑定到Table
|
-- 作者:xywl
-- 发布时间:2017/6/7 15:36:00
--
再请教个问题 统计表的数值怎样前面加"-"号又不影响计算
此主题相关图片如下:3eabl3k2w$8m)c6f}$w_h2.png
图中移出的想显示为"-加数值"
这是生成的代码:
Dim lbl3,lbl4 As WinForm.DateTimePicker lbl3 = e.Form.Controls("DateTimePicker3") lbl4 = e.Form.Controls("DateTimePicker4") Dim g As New GroupTableBuilder("库位调整", DataTables("出入记录")) g.Groups.AddDef("作业时间", DateGroupEnum.None) g.Groups.AddDef("货品编号") g.Groups.AddDef("中文描述") g.Groups.AddDef("批号") g.Groups.AddDef("状态") g.Groups.AddDef("位置") g.Groups.AddDef("箱含量") g.Groups.AddDef("单位") g.Groups.AddDef("中文名称") g.Groups.AddDef("商品类型") g.Groups.AddDef("操作类型") g.Totals.AddDef("数量") g.Totals.AddDef("体积") g.Totals.AddDef("重量", AggregateEnum.Count) g.Filter = "[操作类型] = \'移出\' or [操作类型] = \'移入\'and [作业时间] >= # " & lbl3.value & "# and [作业时间] <= # " & lbl4.value & " # " g.Build() Tables("报表统计_Table1").DataSource = g.BuildDataSource()
|
-- 作者:xywl
-- 发布时间:2017/6/7 16:34:00
--
还有一个问题是 我在数据库设定了自动备份,在每天晚上的12点执行,在报表中有两个报表分别是取得月初的库存明细和月末的库存明细,那么我是否只能在备份数据中去找(比如5月1日当天的库存明细和5月31日的库存明细),因为我的备份是压缩的格式,那么就算是使用备份数据也要经过处理才能读取,有没有怎么方式能在每天十二点时自动记录下前一分钟的库存,(我们没有夜班,在这个时间段没有客户端在线)
|