怎么数据都是0.
Dim bd1 As New GroupTableBuilder("统计表1",DataTables("配件入库明细"))
Dim dt1 As fxDataSource
bd1.Groups.AddDef("配件名称") '根据配件名称分组
bd1.Groups.AddDef("配件代码") '根据配件名称分组
bd1.Totals.AddDef("数量","入库良品数量") '对数量进行统计
bd1.Totals.AddDef("不良品数","入库不良品数") '对金额进行统计
dt1 = bd1.BuildDataSource()
Dim bd2 As New GroupTableBuilder("统计表2",DataTables("配件出库明细"))
Dim dt2 As fxDataSource
bd2.Groups.AddDef("配件名称") '根据配件名称分组
bd1.Groups.AddDef("配件代码") '根据配件名称分组
bd2.Totals.AddDef("出库数量","出库良品数量") '对数量进行统计
bd2.Totals.AddDef("出库不良品数","出库不良品数") '对金额进行统计
dt2 = bd2.BuildDataSource()
dt1.Combine("配件名称",dt2,"配件名称") '将销售统计数据组合到进货统计数据
Tables("配件管理_Table_kcgl").DataSource = dt1 '将统计结果绑定到Table
With DataTables("配件管理_Table_kcgl").DataCols '用表达式列计算库存数据
.Add("库存良品数量",Gettype(Double), "IsNull([入库良品数量],0) - ISNULL([出库良品数量],0)")
.Add("库存不良品数量",Gettype(Double), "IsNull([入库不良品数],0) - ISNULL([出库不良品数],0)")
End With