Dim d1 As Date = e.Form.Controls("统计开始日期").Value
Dim d2 As Date = e.Form.Controls("统计结束日期").Value
Dim d3 As Date = e.Form.Controls("年度期初").Value
Dim d4 As Date = e.Form.Controls("上年年末").Value
If d1 = Nothing Or d2 = Nothing Then
MessageBox.Show("起始或结束日期都不能为空!","友情提醒",MessageBoxButtons.OK,MessageBoxIcon.Warning)
End If
Dim g1 As New GroupTableBuilder("入库月计", DataTables("入库")) '客户查询 为Click按钮名称
g1.Filter = "日期>=#" & d1 & "# and 日期<=#" & d2 & "#"
Dim bb1 As fxDataSource
g1.Groups.AddDef("名称")
g1.Totals.AddDef("数量","入库_本月小计")
g1.VerticalTotal = True
g1.SubTotal = True
g1.Decimals = 2
g1.FromServer = True
g1.Build()
bb1 = g1.BuildDataSource()
Dim g2 As New GroupTableBuilder("入库累计", DataTables("入库")) '客户查询 为Click按钮名称
g2.Filter = "日期>=#" & d3 & "# and 日期<=#" & d2 & "#"
Dim bb2 As fxDataSource
g2.Groups.AddDef("名称")
g2.Totals.AddDef("数量","入库_本年累计")
g2.VerticalTotal = True
g2.SubTotal = True
g2.Decimals = 2
g2.FromServer = True
g2.Build()
bb2 = g2.BuildDataSource()
Dim nms As String() = {"名称","名称"} '指定连接列
bb1.Combine(nms,bb2,nms)
Tables("业务管理_统计表").DataSource = bb1
e.Form.Controls("统计表").Visible = True
代码是这样的,但最后显示出来时,"本年累计"无合计数