老师,下面这段代码怎么提示“无法设置库存数量表达式,原因是找不到分发数量列“。谢谢!
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("一类疫苗入库表"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("药品名称","药品名称")
bd1.Groups.AddDef("药品生产厂家","生产厂家")
bd1.Groups.AddDef("药品批号","药品批号")
bd1.Totals.AddDef("数量","入库数量")
bd1.Filter = "日期 <= '" & r1.Value & "'"
bd1.FromServer = True
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("一类疫苗出库表"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("疫苗药品名称","药品名称")
bd2.Groups.AddDef("药品生产厂家","生产厂家")
bd2.Groups.AddDef("药品批号","药品批号")
bd2.Totals.AddDef("数量","分发数量")
bd2.Totals.AddDef("下级退回")
bd2.Totals.AddDef("损耗数量")
bd2.Totals.AddDef("退回上级")
bd2.Filter = "日期 <= '" & r1.Value & "'"
bd2.FromServer = True
dt2 = bd2.BuildDataSource()
Dim nms As String() = {"药品名称","生产厂家","药品批号"}
dt1.Combine(nms,dt2,nms)
Tables("一类疫苗查询统计_Table1").DataSource = dt1
With DataTables("一类疫苗查询统计_Table1").DataCols '用表达式列计算库存数据
.Add("库存数量",Gettype(Integer), "IsNull([入库数量],0) - ISNULL([分发数量],0) - ISNULL([损耗数量],0) - ISNULL([下级退回],0) - ISNULL([退回上级],0)")
End With