Foxtable(狐表)用户栏目专家坐堂 → 两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢


  共有2406人关注过本帖树形打印复制链接

主题:两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢

美女呀,离线,留言给我吧!
lfz
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:49 积分:494 威望:0 精华:0 注册:2021/11/16 13:45:00
两个筛选按钮共用一个目录树,如何设置不同筛选树的doublelick呢  发帖心情 Post By:2023/6/29 9:43:00 [只看该作者]

两个筛选按钮共用一个目录树,如何设置不同筛选树的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

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110750 积分:563676 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2023/6/29 10:16:00 [只看该作者]

按钮都能做出来了,目录树点击的用法和按钮里【Select Case】的用法差不多呀,根据不同目录树和节点,设置不同的条件:http://www.foxtable.com/webhelp/topics/0917.htm

 回到顶部