以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]多表合计出现无合计数  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=160965)

--  作者:xuxd76
--  发布时间:2021/2/27 20:37:00
--  [求助]多表合计出现无合计数

图片点击可在新窗口打开查看此主题相关图片如下:本年累计无合计.png
图片点击可在新窗口打开查看


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


代码是这样的,但最后显示出来时,"本年累计"无合计数

--  作者:有点蓝
--  发布时间:2021/2/28 20:41:00
--  
不要在统计里合计,统计表生成后在使用这种方式设置合计:http://www.foxtable.com/webhelp/topics/2750.htm