Dim bd1 As New GroupTableBuilder("统计表1",DataTables("进货单"))
Dim dt1 As fxDataSource
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("型号") '
bd2.Totals.AddDef("数量","销售_数量") '
bd2.Totals.AddDef("金额","销售_金额") '
dt2 = bd2.BuildDataSource()
Dim bd3 As New GroupTableBuilder("统计表3",DataTables("退货单"))
Dim dt3 As fxDataSource
bd3.Groups.AddDef("型号") '
bd3.Totals.AddDef("数量","退货_数量") '
bd3.Totals.AddDef("金额","退货_金额") '
dt3 = bd3.BuildDataSource()
dt1.Combine("型号",dt2,"型号") '
dt1.Combine("型号",dt3,"型号") '
Tables("窗口1_Table1").DataSource = dt1 '
With DataTables("窗口1_Table1").DataCols '
.Add("库存_数量",Gettype(Integer), "IsNull([进货_数量],0) - ISNULL([销售_数量],0) - ISNULL([退货_数量],0)")
.Add("库存_金额",Gettype(Double), "[库存_数量] /[进货_数量] * [进货_金额]")
End With
上面代码是组合统计,如何添加一列,是上月的第一天或最后一天,比如现在是5月,就是要生成4月1日或4月31日的日期?