afterload事件
'''=====================采购立项记录=================
Dim dtjl As DataTable
Dim g As New GroupTableBuilder("采购立项统计",DataTables("tblcgjl"))
g.Groups.AddDef("lxrq",DateGroupEnum.Year,"年")
g.Groups.AddDef("lxrq",DateGroupEnum.Month,"月")
g.Groups.AddDef("cgdw")
g.groups.AddDef("dwlb","单位类别")
g.Totals.AddDef("cgjlID",AggregateEnum.Count,"采购立项数") '根据客户列来统计记录数,也就是订单数
dtjl = g.Build(False) '参数设置为False,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv_cgjl As WinForm.TreeView = e.Form.Controls("trvcgjl")
trv_cgjl.BuildTree(dtjl,"年|月|单位类别|cgdw")
trv_cgjl.StopRedraw
For Each nd As WinForm.TreeNode In trv_cgjl.AllNodes
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim Product As String = nd.DataRow("cgdw")
Dim dwlbie As String=nd.DataRow("单位类别")
Select Case nd.Level
Case 0
nd.Text = nd.text & "年(" & dtjl.Compute("Sum(采购立项数)","年 = " & Year) & "项)"
Case 1
nd.Text = nd.text & "月(" & dtjl.Compute("Sum(采购立项数)","年 = " & Year & " And 月 = " & Month) & "项)"
Case 2
nd.Text = nd.text & "月(" & dtjl.Compute("Sum(采购立项数)","年 = " & Year & " And 月 = " & Month & " And 单位类别 = '" & dwlbie & "'" ) & "项)"
Case 3
nd.Text = nd.text & "(" & nd.DataRow("采购立项数") & "项)"
End Select
Next
trv_cgjl.Nodes.Insert("显示所有采购立项","显示所有采购立项(" & dtjl.Compute("Sum(采购立项数)") & "项)",0)
trv_cgjl.ResumeRedraw