Dim s As Integer
Dim Filter As String
If e.Form.Controls("TextBox2").Value IsNot Nothing Then
s = e.Form.Controls("TextBox2").Value
Else
s = 20
End If
If user.Type = UserTypeEnum.User Then
If Functions.Execute("sq","调解机构管理","调解机构审核") Then
Filter = ""
Else
Filter = "主管单位 = '" & user.Group & "'"
End If
Else
Filter = ""
End If
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表1","调解机构表")
b.C
b.Groups.AddDef("主管单位")
b.Filter = Filter
b.Totals.AddDef("_Identify",AggregateEnum.Count,"人数") '根据主键列来统计记录数,也就是订单数
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "主管单位")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim dw As String = nd.DataRow("主管单位")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & dt.Compute("Sum(人数)","主管单位 = '" & dw & "'") & "条)"
End Select
Next
trv.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(人数)") & "条)",0)
trv.ResumeRedraw
With DataTables("调解机构表")
.LoadFilter = Filter '设置加载条件
.LoadPage = 0 '加载第一页
.LoadTop = s '每页5行
.Load()
e.Form.Controls("TextBox1").Value = 1 & "/" & .TotalPages
End With