参考
Dim t As Table = Tables("仓库入库明细")
Dim g As Subtotalgroup
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.SpillNode = True
If e.Form.Controls("年_复选框").checked Then
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "入库时间"
g.TotalOn = "重量,重量审核"
g.Caption = "{0}年 小计"
g.DateGroup = DateGroupEnum.Year
t.SubtotalGroups.Add(g)
End If
If e.Form.Controls("月_复选框").checked Then
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "入库时间"
g.TotalOn = "重量,重量审核"
g.Caption = "{0}月 小计"
g.DateGroup = DateGroupEnum.Month
t.SubtotalGroups.Add(g)
End If
If e.Form.Controls("品种_复选框").checked Then
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "品种"
g.TotalOn = "重量,重量审核"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
End If
If e.Form.Controls("钢种_复选框").checked Then
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "钢种"
g.TotalOn = "重量,重量审核"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
End If
If e.Form.Controls("规格_复选框").checked Then
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "规格"
g.TotalOn = "重量,重量审核"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
End If
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "*"
g.TotalOn = "重量,重量审核"
g.Caption = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()