应该是bug,懒得测试,自己计算截止值吧。
Dim b As New SQLCrossTableBuilder("损益总体比率","部门损益总账") '定义变量利润表附表,并从部门损益总账统计数据
b.AddTable("部门损益总账","部门名称","部门档案","部门名称") '添加统计表
b.AddTable("部门损益总账","科目编号","科目档案","科目编码") '添加统计表
b.HGroups.AddDef("所属日期", DateGroupEnum.Year, "年")
b.HGroups.AddDef("所属单位")
b.HGroups.AddDef("部门类型")
b.HGroups.AddDef("上级部门")
b.HGroups.AddDef("所属日期", "月")
b.VGroups.AddDef("一级科目")
b.Totals.AddDef("借方发生", "本月")
b.Totals.AddDef("借方发生", "累计", True)
b.Decimals = 0 '小数点取0位
b.Filter = "(零售终端 = True and 所属单位 = '温州分公司')"
b.Build '生成统计表
Dim t As Table = Tables("损益总体比率")
Dim drs As List(Of DataRow) = t.DataTable.Select("", "上级部门,年")
For Each c As Col In t.Cols
If c.Caption Like "*_累计" Then
Dim pdr As DataRow = Nothing
Dim by As String = c.name.Replace("_up", "")
For Each dr As DataRow In drs
If pdr Is Nothing OrElse dr("上级部门") <> pdr("上级部门") OrElse dr("年") <> pdr("年") Then
dr(c.name) = dr(by)
Else
dr(c.name) = dr(by) + pdr(by)
End If
pdr = dr
Next
End If
Next