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
Forms("采购订单查询").StopRedraw()
此主题相关图片如下:统计出错.bmp
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