密码是1234
具体修改见红色字体部分,目的只要是收发类型为“调拨入库”,不管业务单号开头是R还是D其他字母,我一律计算到店铺_调拨入库,但就是不行,只是把以R开头的业务单号且收发类型为“调拨入库”计算了,而已D或其他字母开头的业务单号,收发类型为“调拨入库”则没计算出来,请各位高手帮忙看下,谢谢!
Dim dt3 As DataTable
Dim bd1 As GroupTableBuilder
Dim fxdts(8) As fxDataSource
Dim nms(),Ymds(),Bts() As String
Dim Filter,s2,s3 ,flt1,ep1,ep2,ep3 As String
Dim nms1 As String() = {"编码","名称","颜色","尺码","年份","季节","零售价"} '分組列1
Dim nms2 As String() = {"编码","名称","颜色","尺码","年份","季节"} '分組列2
Dim t3 As Table = e.Form.Controls("库存报表").Table
Ymds="D@F@T@R@R@@@@".split("@")
Bts= "库房_调拨出库@库房_收货入库@库房_返货出库@店铺_调拨出库@店铺_调拨入库@店铺_零售出库@店铺_零退入库@店铺_库调@店铺_退货入库".split("@") '統計標題
ep1 = "IsNull([库房_收货入库],0) +IsNull([库房_返货出库],0)+IsNull([库房_调拨出库],0)+IsNull([店铺_退货入库],0)-Isnull([店铺_库调],0)"
ep2 = "IsNull([店铺_库调],0) +IsNull([店铺_调拨入库],0)+IsNull([店铺_调拨出库],0)+IsNull([店铺_零退入库],0)"
ep2+="-Isnull([店铺_零售出库],0)-Isnull([店铺_退货入库],0)"
ep3 = "IsNull([合计_库房],0) +IsNull([合计_店铺],0)"
s3 ="品牌,门店,年份,季节,开始日期,截止日期"
For Each s2 In s3.split(",")
With e.Form.Controls(s2)
If .Value IsNot Nothing Then
If Filter > "" Then
Filter+ = " And "
End If
If s2 = "开始日期" Then
Filter+ = "单据日期 >= #" & .Value & "#"
ElseIf s2 = "截止日期" Then
Filter+ = "单据日期 <= #" & .Value & "#"
Else
Filter+ = s2 & " = '" & .Value & "'"
End If
End If
End With
Next
If Filter > "" Then
Tables("出入库明细").Filter = Filter
For n1 As Integer = 0 To 8
If n1 > 6 Then
dt3 = DataTables("库调明细表_主表")
Else
dt3 = DataTables("出入库明细")
End If
bd1 = New GroupTableBuilder("报表",dt3)
For Each s2 In nms1
If dt3.DataCols.Contains(s2) Then
bd1.Groups.AddDef(s2) '分组
End If
Next
bd1.Totals.AddDef("数量",Bts(n1)) '对数量进行统计
flt1= "收发类型= '" & Bts(n1).split("_")(1) & "'"
If flt1="调拨入库" Then
flt1+=""
Else
If Ymds(n1) > "" Then
flt1+= " And 业务单号首位 = '" & Ymds(n1) & "'"
End If
End If
bd1.Filter = flt1 & " and " & Filter
fxdts(n1) = bd1.BuildDataSource()
nms = iif(n1 < 7,nms1,nms2)
If n1 > 0 Then fxdts(0).Combine(nms,fxdts(n1),nms)
Next
t3.StopRedraw
t3.DataSource = fxdts(0)
With t3.DataTable.DataCols
.Add("合计_库房", Gettype(Integer),ep1)
.Add("合计_店铺", Gettype(Integer),ep2)
.Add("合计_店库", Gettype(Integer),ep3)
End With
t3.AutoSizeCols
t3.ResumeRedraw
End If