窗口2,AfterLoad事件代码,红色代码的空格自己去除
Dim tb1 As WinForm.Table = e.Form.Controls("Table1")
Dim tb2 As WinForm.Table = e.Form.Controls("Table2")
Dim filter As String = "公司 = '" & Forms("窗口1").Controls("Table1").Table.Current("公司") & "'"
tb1.Table.Fill("select * f rom {发货台账} where " & filter, True)
tb2.Table.Fill("select * f rom {收款台帐} where " & filter, True)
Dim t As Table = tb1.Table
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 = "总计"
t.SubtotalGroups.Add(g)
g = New Subtotalgroup
g.Aggregate = AggregateEnum.Sum
g.GroupOn = "合同号"
g.TotalOn = "重量,金额"
g.Caption = "{0} 小计"
t.SubtotalGroups.Add(g)
t.Subtotal()
t = tb2.Table
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 = "总计"
t.SubtotalGroups.Add(g)
t.Subtotal()