--
Dim filter=""
filter="日期>=\'"& e.Form.Controls("DateTimePicker1").text &"\' And 日期<=\'"& e.Form.Controls("DateTimePicker2").text &"\' AND 生產單位 in (\'" & e.Form.Controls("CheckedComboBox1").Text.Replace(",", "\',\'") & "\')"
DataTables("P生產日報").loadfilter=filter
DataTables("P生產日報").load
Dim g As New GroupTableBuilder("統計表5", DataTables("P生產日報"))
Dim dt2 As fxDataSource
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("實際工時")
g.Build()
dt2 = g.BuildDataSource()
Dim a="p入庫單子檔"
Dim a1="P生產日報"
Dim b As New SQLGroupTableBuilder("統計表3",a)
Dim dt3 As fxDataSource
b.ConnectionName =_conn
b.Filter="旗標=1"
b.Groups.AddDef("來源") \'根据製令單號分组
b.Groups.AddDef("入庫母件") \'根据製令單號分组
b.Totals.AddDef("良品入庫數量") \'对数量进行统计
b.Build \'生成统计表
dt3 = b.BuildDataSource()
Dim nms As String() = {"指令單號","產品編號"} \'指定连接列
Dim nms1 As String() = {"來源","入庫母件"} \'指定连接列
dt2.Combine(nms,dt3,nms1)