两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢
不同筛选按钮代码如下
筛选按钮1
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
trv2.Visible = False
trv1.Visible = True
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表1","进项fa piao")
b.C
b.Groups.AddDef("fa piao类型")
b.Groups.AddDef("开piao单位简称")
b.Groups.AddDef("认证年份")
b.Groups.AddDef("认证月份")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Day,"日")
b.Totals.AddDef("认证年份",AggregateEnum.Count,"份数") '根据客户列来统计记录数,也就是订单数
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt, "fa piao类型|开piao单位简称|认证年份|认证月份|年|月|日","","fa piao类型,开piao单位简称,认证年份,认证月份,年,月,日")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim dm As String = nd.DataRow("fa piao类型")
Dim nm As String = nd.DataRow("开piao单位简称")
Dim Y As String = nd.DataRow("认证年份")
Dim M As String = nd.DataRow("认证月份")
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim day As Integer = nd.DataRow("日")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '"& dm & "'") & "份)"
Case 1
nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & dm & "' And 开piao单位简称 = '"& nm & "'") & "份)"
Case 2
nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & dm & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = '" & y & "'") & "份)"
Case 3
nd.Text = nd.text & "(" & dt.Compute("sum(份数)","fa piao类型 = '" & dm & "' And 开piao单位简称 = '" & nm & "' And 认证年份 = '" & y & "'and 认证月份 = '"& m & "'") & "份)"
Case 4
Dim Filter As String = " fa piao类型 = '" & dm & "' And 开piao单位简称 = '" & nm & "' and 认证年份 = '" & y & "' and 认证月份 = '" & m & "' And 年 = '" & year &"' "
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
Case 5
Dim Filter As String = "fa piao类型 = '" & dm & "' And 开piao单位简称 = '" & nm & "' and 认证年份 = '" & y & "' and 认证月份 = '" & m & "' And 年 = '" & year &"' And 月 = '"& month & "'"
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
Case 6
Dim Filter As String = "fa piao类型 = '" & dm & "' And 开piao单位简称 = '" & nm & "' and 认证年份 = '" & y & "' and 认证月份 = '" & m & "' And 年 = '" & year &"' And 月 = '"& month & "'and 日 = '"& day & "'"
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
End Select
Next
trv.Nodes.Insert("加载所有fa piao","加载所有fa piao(" & dt.Compute("Sum(份数)") & "条)",0)
trv.ResumeRedraw
筛选按钮2
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2")
trv1.Visible = False
trv2.Visible = True
Dim dt As DataTable
Dim b As New SQLGroupTableBuilder("统计表2","进项fa piao")
b.C
b.Groups.AddDef("做账月份")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("fa piao日期",DateGroupEnum.Day,"日")
b.Totals.AddDef("认证年份",AggregateEnum.Count,"份数") '根据客户列来统计记录数,也就是订单数
dt = b.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
trv2.BuildTree(dt, "做账月份|年|月|日","","做账月份,年,月,日")
trv2.StopRedraw
For Each nd As WinForm.TreeNode In trv2.AllNodes
Dim nm As String = nd.DataRow("做账月份")
Dim Year As Integer = nd.DataRow("年")
Dim Month As Integer = nd.DataRow("月")
Dim day As Integer = nd.DataRow("日")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & dt.Compute("sum(份数)","做账月份 = '"& nm & "'") & "份)"
Case 1
Dim Filter As String = " 做账月份 = '" & nm & "'And 年 = '" & year &"' "
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
Case 2
Dim Filter As String = " 做账月份 = '" & nm & "' And 年 = '" & year &"' And 月 = '"& month & "'"
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
Case 3
Dim Filter As String = " 做账月份 = '" & nm & "' And 年 = '" & year &"' And 月 = '"& month & "'and 日 = '"& day & "'"
nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
End Select
Next
trv2.Nodes.Insert("加载所有行","加载所有行(" & dt.Compute("Sum(份数)") & "条)",0)
trv2.ResumeRedraw