这段代码在原来的版本下运行没有问题,现在一运行后无法显示汇总,并且项目就无响应,只有启动任务管理器结束项目。因此只好暂时换回老版本。
Dim de As Date =Date.Today()
Dim gg As New GroupTableBuilder("财务对帐", DataTables("收费"))
gg.Groups.AddDef("交款日期", "缴款月份")
gg.Groups.AddDef("缴款序号")
gg.Groups.AddDef("缴款回单")
gg.Groups.AddDef("交款人")
gg.Totals.AddDef("收费金额", "收费金额")
gg.Filter = "[任务年度]=" & de.year & "And [交款日期]<> #0001-01-01#"
gg.FromServer = True
gg.Build()
MainTable = Tables("财务对帐")
With Tables("财务对帐") '合计统计
.MergeMode = MergeModeEnum.Standard '标准合并模式
.MergeCols.Clear() '清除原来的合并列
.MergeCols.Add("缴款月份") '加入要合并的列
.AllowMerge = True '启用合并模式
End With
Tables("财务对帐").Cols("缴款月份").Width = 109
Tables("财务对帐").Cols("缴款序号").Width = 109
Dim fnt As New Font(CurrentTable.Font.Name, 12, CurrentTable.Font.Style) '设置当前表的字体大小
CurrentTable.Font = fnt
'汇总
Dim t As Table = Tables("财务对帐")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "缴款月份"
g.TotalOn = "收费金额"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "收费金额"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()
[此贴子已经被作者于2010-11-5 20:14:36编辑过]