If e.Form.Controls("rbtnWWJ").Checked Then
DataTables("TabPOSettlementTotal").LoadFilter = "ShipingQty - SettlementQty > 0 or SettlementQty is null"
Else If e.Form.Controls("rbtnYWJ").Checked
DataTables("TabPOSettlementTotal").LoadFilter = "ShipingQty - SettlementQty <= 0"
End If
DataTables("TabPOSettlementTotal").load
\'首先生成统计表
Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("TabPOSettlementTotal"))
b.Groups.AddDef("CustomerName")
b.Totals.AddDef("CustomerName",AggregateEnum.Count,"订单数") \'根据客户列来统计记录数,也就是订单数
dt = b.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示
\'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "CustomerName")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim Product As String = nd.DataRow("CustomerName")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & nd.DataRow("订单数") & "条)"
End Select
Next
trv.Nodes.Insert("显示所有数据","显示所有数据(" & dt.Compute("Sum(订单数)") & "条)",0)
trv.ResumeRedraw