以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=187182)

--  作者:lfz
--  发布时间:2023/6/29 9:43:00
--  两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢

两个筛选按钮共用一个目录树,如何设置不同筛选树的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","进项发票")
b.C
b.Groups.AddDef("发票类型")
b.Groups.AddDef("开票单位简称")
b.Groups.AddDef("认证年份")
b.Groups.AddDef("认证月份")
b.Groups.AddDef("发票日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("发票日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("发票日期",DateGroupEnum.Day,"日")
b.Totals.AddDef("认证年份",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 dm As String = nd.DataRow("发票类型")
    Dim nm As String = nd.DataRow("开票单位简称")
    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(份数)","发票类型 = \'"& dm & "\'") & "份)"
        Case 1
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","发票类型 = \'" & dm & "\' And 开票单位简称 = \'"& nm & "\'") & "份)"
        Case 2
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","发票类型 = \'" & dm & "\' And 开票单位简称 = \'" & nm & "\' And 认证年份 = \'" & y & "\'") & "份)"
        Case 3
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)","发票类型 = \'" & dm & "\' And 开票单位简称 = \'" & nm & "\' And 认证年份 = \'" & y & "\'and 认证月份 = \'"& m & "\'") & "份)"
        Case 4
            Dim Filter As String = " 发票类型 = \'" & dm & "\' And 开票单位简称 = \'" & nm & "\' and 认证年份 = \'" & y & "\' and 认证月份 = \'" & m & "\' And 年 = \'" & year &"\' "
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 5
            Dim Filter As String  = "发票类型 = \'" & dm & "\' And 开票单位简称 = \'" & nm & "\' and 认证年份 = \'" & y & "\' and 认证月份 = \'" & m & "\' And 年 = \'" & year &"\' And 月 = \'"& month & "\'"
            nd.Text = nd.text & "(" & dt.Compute("sum(份数)",filter) & "份)"
        Case 6
            Dim Filter As String = "发票类型 = \'" & dm & "\' And 开票单位简称 = \'" & 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("加载所有发票","加载所有发票(" & 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","进项发票")
b.C
b.Groups.AddDef("做账月份")
b.Groups.AddDef("发票日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("发票日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("发票日期",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

 

 


--  作者:有点蓝
--  发布时间:2023/6/29 10:16:00
--  
按钮都能做出来了,目录树点击的用法和按钮里【Select Case】的用法差不多呀,根据不同目录树和节点,设置不同的条件:http://www.foxtable.com/webhelp/topics/0917.htm