想统计每个款不同颜色尺码的入库、出库、退货的明细记录(不是合计),应该是怎么改,下面这么改不行
Dim ddh As WinForm.ComboBox = e.Form.Controls("订单号")
Dim kh As WinForm.ComboBox = e.Form.Controls("款号")
Dim ys As WinForm.ComboBox = e.Form.Controls("颜色")
Dim cm As WinForm.ComboBox = e.Form.Controls("尺码")
Dim dtt1 As WinForm.DateTimePicker = e.Form.Controls("开始日期")
Dim dtt2 As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim filter As String = " _identify>0 "
If ddh.Text > "" Then
filter= filter & " and 订单号 = '" & ddh.Text & "'"
End If
If kh.Text > "" Then
filter= filter & " And 款号 = '" & kh.Text & "'"
End If
If ys.Text > "" Then
filter= filter & " And 颜色 = '" & ys.Text & "'"
End If
If cm.Text > "" Then
filter= filter & " And 尺码 = '" & cm.Text & "'"
End If
Dim filter1 As String
filter1= filter & " And 工序号 = 104 And 单据状态 = '已完成' "
Dim bd1 As New SQLGroupTableBuilder("统计表1","派发工序表")
bd1.C
Dim dt1 As fxDataSource
bd1.Groups.AddDef("订单号") '根据型号分组
bd1.Groups.AddDef("制单号") '根据型号分组
bd1.Groups.AddDef("款号") '根据型号分组
bd1.Groups.AddDef("颜色") '根据型号分组
bd1.Groups.AddDef("尺码") '根据型号分组
bd1.Groups.AddDef("成品入库") '根据型号分组
'bd1.Totals.AddDef("成品入库","入库_数量") '对数量进行统计
bd1.Filter = filter1
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.Totals.AddDef("发货数量","出库_数量") '对数量进行统计
bd2.Filter = filter
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.Filter = filter
dt3 = bd3.BuildDataSource()
Dim nms As String() = {"订单号","制单号","款号","颜色","尺码"}
dt1.Combine(nms,dt2,nms) '将销售统计数据组合到进货统计数据
Dim nmc As String() = {"订单号","制单号","款号","颜色","尺码"}
dt1.Combine(nmc,dt3,nmc) '将销售统计数据组合到进货统计数据
Tables("出入明细表_Table1").DataSource = dt1 '将统计结果绑定到Table
With DataTables("出入明细表_Table1").DataCols '用表达式列计算库存数据
.Add("库存数量",Gettype(Integer), "IsNull([成品入库],0) - ISNULL([发货数量],0) + ISNULL([退货数量],0) ")
End With
Tables("出入明细表_Table1").Cols("库存数量").GrandTotal = True '指定要合计的列
Tables("出入明细表_Table1").GrandTotal = True