-- 作者:有点甜
-- 发布时间:2018/1/12 11:09:00
--
Dim t As Table = Tables("订单") Dim g As Subtotalgroup t.SubtotalGroups.Clear() t.GroupAboveData = False t.TreeVisible = False g = New Subtotalgroup g.Aggregate = AggregateEnum.Sum g.GroupOn = "雇员" g.Caption = "{0}" t.SubtotalGroups.Add(g) g = New Subtotalgroup g.Aggregate = AggregateEnum.Sum g.GroupOn = "客户" g.Caption = "{0}" t.SubtotalGroups.Add(g) g = New Subtotalgroup g.Aggregate = AggregateEnum.Sum g.GroupOn = "产品" g.Caption = "{0}" t.SubtotalGroups.Add(g) t.Subtotal()
Dim r As Row For i As Integer = 0 To t.Rows.Count(True) - 1 r = t.Rows(i,True) If r.IsGroup \'如果是分组行 If r.Level = 0 Then Dim f As String = "产品 = \'" & r("产品") & "\'" Dim v As String = " 订单数:" & t.Compute("Count(日期)",f) v = v & " 订购数量:" & t.Compute("Sum(数量)",f) v = v & " 订购金额:" & t.Compute("Sum(金额)",f) r("产品") = r("产品") & ":" & v ElseIf r.Level = 1 Then Dim pr As Row = t.Rows(r.Index-2, True) Dim f As String = "产品 = \'" & pr("产品") & "\' and 客户 = \'" & pr("客户") & "\'" Dim v As String = " 订单数:" & t.Compute("Count(日期)",f) v = v & " 订购数量:" & t.Compute("Sum(数量)",f) v = v & " 订购金额:" & t.Compute("Sum(金额)",f) r("产品") = pr("产品") & "-" & pr("客户") & ":" & v ElseIf r.Level = 2 Then Dim pr As Row = t.Rows(r.Index-1, True) Dim f As String = "产品 = \'" & pr("产品") & "\' and 客户 = \'" & pr("客户") & "\' and 雇员 = \'" & pr("雇员") & "\'" Dim v As String = " 订单数:" & t.Compute("Count(日期)",f) v = v & " 订购数量:" & t.Compute("Sum(数量)",f) v = v & " 订购金额:" & t.Compute("Sum(金额)",f) r("产品") = pr("产品") & "-" & pr("客户") & "-" & pr("雇员") & ":" & v End If End If Next
|