以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]统计出错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=102603) |
-- 作者:liuyixin662 -- 发布时间:2017/6/22 19:48:00 -- [求助]统计出错 老师你好,出现错误,麻烦修改一下代码: Dim sd As WinForm.DateTimePicker Dim ed As WinForm.DateTimePicker sd = e.Form.Controls("开始日期3") ed = e.Form.Controls("结束日期3") If sd.text = Nothing OrElse ed.text = Nothing Then sd.text = Date.Today ed.text = Date.Today End If Dim bd1 As New SQLGroupTableBuilder("统计表1","采购订单明细表") bd1.C Dim dt1 As fxDataSource bd1.Groups.AddDef("交期",DateGroupEnum.None) bd1.Groups.AddDef("供应商首字符") bd1.Groups.AddDef("供应商名称") bd1.Groups.AddDef("采购订单明细号") \'根据型号分组 bd1.Groups.AddDef("材料名称") bd1.Groups.AddDef("规格型号") bd1.Groups.AddDef("材料编号") bd1.Groups.AddDef("供应商订单号") bd1.Groups.AddDef("材料_大类") bd1.Groups.AddDef("材料_中类") bd1.Groups.AddDef("材料_小类") bd1.Groups.AddDef("供应商编号") bd1.Groups.AddDef("录入日期",DateGroupEnum.None) bd1.FromServer = True dt1 = bd1.BuildDataSource() Dim bd2 As New SQLGroupTableBuilder("统计表2","采购订单明细表") bd2.C Dim dt2 As fxDataSource bd2.Groups.AddDef("采购订单明细号") \'根据型号分组 bd2.Groups.AddDef("供应商订单号") bd2.Groups.AddDef("供应商首字符") bd2.Groups.AddDef("材料名称") bd2.Groups.AddDef("规格型号") bd2.Groups.AddDef("材料编号") bd2.Groups.AddDef("供应商名称") bd2.Groups.AddDef("交期",DateGroupEnum.None) bd2.Totals.AddDef("采购_订单数量","本期订单_数量") \'对数量进行统计 bd2.Totals.AddDef("采购_订单数量米","本期订单_数量米") \'对金额进行统计 bd2.Totals.AddDef("含税金额","本期订单_含税金额") bd2.Totals.AddDef("不含税金额","本期订单_不含税金额") bd2.FromServer = True bd2.Filter = "录入日期 >= \'" & sd.text & "\' And 录入日期 <= \'" & ed.text & "\'" dt2 = bd2.BuildDataSource() Dim bd3 As New SqlGroupTableBuilder("统计表3","材料入库明细表") bd3.C 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("数量","本期入库_数量") \'对数量进行统计 bd3.Totals.AddDef("辅助数量米","本期入库_数量米") \'对金额进行统计 bd3.Totals.AddDef("含税金额","本期入库_含税金额") \'对金额进行统计 bd3.Totals.AddDef("不含税金额","本期入库_不含税金额") \'对金额进行统计 bd3.FromServer = True bd3.Filter = " 录入日期 >= \'" & sd.text & "\' and 录入日期 <= \'" & ed.text & "\' and 采购订单明细号 is not null " dt3 = bd3.BuildDataSource() Dim bd5 As New SQLGroupTableBuilder("统计表4","采购期初未交明细表") bd5.C Dim dt5 As fxDataSource bd5.Groups.AddDef("采购单号") \'根据型号分组 bd5.Groups.AddDef("采购订单明细号") \'根据型号分组 bd5.Groups.AddDef("供应商订单号") bd5.Groups.AddDef("供应商首字符") bd5.Groups.AddDef("材料名称") bd5.Groups.AddDef("规格型号") bd5.Groups.AddDef("材料编号") bd5.Groups.AddDef("期初未交订单_数量") bd5.Groups.AddDef("期初未交订单_数量米") bd5.Groups.AddDef("期初未交订单_含税金额") bd5.Groups.AddDef("期初未交订单_不含税金额") bd5.Groups.AddDef("供应商名称") bd5.Groups.AddDef("供应商编号") bd5.Groups.AddDef("交期",DateGroupEnum.None) bd5.Groups.AddDef("录入日期",DateGroupEnum.None,"初始未交订单_日期") bd5.Totals.AddDef("数量","初始未交订单_数量") \'对数量进行统计 bd5.Totals.AddDef("数量米","初始未交订单_数量米") \'对金额进行统计 bd5.Totals.AddDef("含税金额","初始未交订单_含税金额") bd5.Totals.AddDef("不含税金额","初始未交订单_不含税金额") bd5.FromServer = True dt5 = bd5.BuildDataSource() Dim nms As String() = {"交期","供应商首字符","供应商名称","采购订单明细号","材料名称","规格型号"} \'指定连接列 dt1.Combine(nms,dt2,nms) dt1.Combine(nms,dt3,nms) MessageBox.show(1) \' 到这一步出现了错误 dt1.Combine(nms,dt5,nms) \' Tables("采购订单查询_采购未交统计").DataSource = dt1 |
-- 作者:liuyixin662 -- 发布时间:2017/6/22 19:52:00 -- c 代表数据源 |
-- 作者:liuyixin662 -- 发布时间:2017/6/22 19:55:00 -- dt1.Combine(nms,dt2,nms) dt1.Combine(nms,dt3,nms) MessageBox.show(1) \' 到这一步出现了错误 dt1.Combine(nms,dt5,nms) \'
|
-- 作者:liuyixin662 -- 发布时间:2017/6/22 20:19:00 -- 老师你好,这段代码对吗? bd3.Filter = " 录入日期 >= \'" & sd.text & "\' and 录入日期 <= \'" & ed.text & "\' and 采购订单明细号 is not null " |
-- 作者:liuyixin662 -- 发布时间:2017/6/22 20:23:00 -- 过滤掉 没有 采购订单明细号 的数据 |
-- 作者:有点色 -- 发布时间:2017/6/23 0:12:00 -- 你的【交期】、【录入日期】都是日期列吗?不是日期列,不能用 DateGroupEnum.None
|
-- 作者:liuyixin662 -- 发布时间:2017/6/23 9:48:00 -- 老师你好,问题找到了 这句代码有错: bd3.Groups.AddDef("交期"),应改为bd3.Groups.AddDef("交期",DateGroupEnum.None),
谢谢老师
|