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}月 小计"
g.DateGroup = DateGroupEnum.Month
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "日期"
g.TotalOn = "入库,出库,库存"
g.Caption = "{0}月 累计"
g.DateGroup = DateGroupEnum.Month
g.upto = True
t.SubtotalGroups.Add(g)
t.Subtotal()
Dim Sum As Integer
For i As Integer = 0 To CurrentTable.Rows.Count(True) - 1
Dim r As Row = CurrentTable.Rows(i,True)
If r.IsGroup
If r("日期").EndsWith("小计") Then
sum = sum + r("入库")- r("出库")
End If
r("库存") = sum
End If
Next