For Each frm As WinForm.Form In Forms \'关闭本表其他窗口
If frm.TableName = e.Form.TableName AndAlso frm.Opened Then
If frm.Name <> "导航" AndAlso frm.Name <> e.Form.Name Then
frm.Close
End If
End If
Next
Dim t As Table = Tables("进销存")
Dim g As Subtotalgroup
t.StopRedraw()
t.SubtotalGroups.Clear()
t.GroupAboveData = False
t.TreeVisible = False
t.Filter = "日期 >= #9/1/2015# And 日期 <= #12/28/2015#"
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 \'如果是分组行
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
End If
Next
t.ResumeRedraw()
t.ShowCell(t.Rows.Count(True) - 1, 0) \'显示最后一行