Dim sql As String = "Selec t 接单日期,{接单登记}.接单单号,客户名称,产品名称,规格型号,单位,单价,销售数量,发货数量 as 已发货数量,(销售数量 - 发货数量) AS 未发货数量 Fro m ({接单登记} Inner JOIN {接单明细} ON {接单明细}.[接单单号] = {接单登记}.[接单单号]) ORDER BY 接单日期"
Dim sqlf As String = "Selec t 发货日期,{发货表}.发货单号,{发货表}.接单单号,{发货表}.客户名称,产品名称,规格型号,单位,发货数量,接单日期 Fro m ({发货表} Inner JOIN {发货明细} ON {发货明细}.[发货单号] = {发货表}.[发货单号]) inner join {接单登记} on {接单登记}.接单单号 = {发货表}.接单单号 ORDER BY 发货日期"
Dim bd1 As New CrossTableBuilder("统计表1", sql,"sale")
Dim dt1 As fxDataSource
bd1.HGroups.AddDef("接单日期", DateGroupEnum.none)
bd1.HGroups.AddDef("接单单号")
bd1.HGroups.AddDef("客户名称")
bd1.HGroups.AddDef("产品名称") '添加客户列用于水平分组
bd1.HGroups.AddDef("规格型号") '添加客户列用于水平分组
bd1.HGroups.AddDef("单位") '添加客户列用于水平分组
bd1.HGroups.AddDef("销售数量")
bd1.HGroups.AddDef("已发货数量")
bd1.HGroups.AddDef("未发货数量")
dt1 = bd1.BuildDataSource()
Dim bd2 As New CrossTableBuilder("统计表2", sqlf,"sale")
Dim dt2 As fxDataSource
bd2.HGroups.AddDef("接单日期", DateGroupEnum.none)
bd2.HGroups.AddDef("接单单号")
bd2.HGroups.AddDef("客户名称")
bd2.HGroups.AddDef("产品名称") '添加客户列用于水平分组
bd2.HGroups.AddDef("规格型号") '添加客户列用于水平分组
bd2.HGroups.AddDef("单位") '添加客户列用于水平分组
bd2.VGroups.AddDef("发货日期", DateGroupEnum.none)
bd2.Totals.AddDef("发货数量")
dt2 = bd2.BuildDataSource()
Dim nms As String() = {"接单日期", "接单单号", "客户名称", "产品名称", "规格型号", "单位" }
dt1.Combine(nms, dt2, nms)
Tables("统计汇总_Table3").DataSource = dt1