Foxtable(狐表)用户栏目专家坐堂 → 筛选树目录列示到年月日


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

主题:筛选树目录列示到年月日

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


加好友 发短信
等级:超级版主 帖子:107896 积分:548849 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/2/21 11:29:00 [显示全部帖子]

Dim dt2 As DataTable
Dim b2 As New sqlGroupTableBuilder("统计表生产计划表","生产计划表")
b2.C
b2.Groups.AddDef("日期",DateGroupEnum.Year,"年")
b2.Groups.AddDef("日期",DateGroupEnum.Month,"月")
b2.Groups.AddDef("日期",DateGroupEnum.day,"日")
b2.Groups.AddDef("提交人")
b2.Groups.AddDef("序号")
b2.Totals.AddDef("序号",AggregateEnum.Count,"次数") '根据客户列来统计记录数,也就是订单数
dt2 = b2.Build(True) '参数设置为True,生成一个临时表,不在主界面显示
'然后根据统计表生成目录树
Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView3")
trv2.BuildTree(dt2, "提交人|年|月|日")
trv2.StopRedraw
For Each nd As WinForm.TreeNode In trv2.AllNodes
    Dim Year As Integer = nd.DataRow("年")
    Dim Month As Integer = nd.DataRow("月")
    Dim d As Integer = nd.DataRow("日")
    Dim Product4 As String = nd.DataRow("提交人")
    Dim Product5 As String = nd.DataRow("序号")
    Select Case nd.Level
        Case 0
            nd.Text = nd.text & "(" & dt2.Compute("Sum(次数)","提交人 = '" & Product4 & "'") & ")"
        Case 1
            nd.Text = nd.text & "年(" & dt2.Compute("Sum(次数)","年 = " & Year) & ")"
        Case 2
            nd.Text = nd.text & "月(" & dt2.Compute("Sum(次数)","年 = " & Year & " And 月 = " & Month) & ")"
        Case 3
            nd.Text = nd.text & "日(" & dt2.Compute("Sum(次数)","年 = " & Year & " And 月 = " & Month) & " and 日= " & d & ")"
    End Select
Next
trv2.Nodes.Insert("显示所有行","显示所有行(" & dt2.Compute("Sum(次数)") & ")",0)
trv2.ResumeRedraw


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


加好友 发短信
等级:超级版主 帖子:107896 积分:548849 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/2/21 15:18:00 [显示全部帖子]

Select Case nd.Level
        Case 0
            nd.Text = nd.text & "(" & dt2.Compute("Sum(次数)","提交人 = '" & Product4 & "'") & ")"
        Case 1
            nd.Text = nd.text & "(" & dt2.Compute("Sum(次数)","购买单位 = '" & Product6 & "'") & ")"
        Case 2
            nd.Text = nd.text & "(" & dt2.Compute("Sum(次数)","提交人 = '" & Product4 & " And 购买单位 = '" & Product6 & "' And 年 = " & Year) & ")"
        Case 3
            nd.Text = nd.text & "月(" & dt2.Compute("Sum(次数)","提交人 = '" & Product4 & " And 购买单位 = '" & Product6 & "' And 年 = " & Year and 月 = " & Month) & ")"
        Case 4
            nd.Text = nd.text & "日(" & dt2.Compute("Sum(次数)","提交人 = '" & Product4 & " And 购买单位 = '" & Product6 & "' And 年 = " & Year & " And 月 = " & Month & " and 日= " & day) & ")"
    End Select

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


加好友 发短信
等级:超级版主 帖子:107896 积分:548849 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/2/22 9:38:00 [显示全部帖子]

提交人 = '" & Product4 & "' And 购买单位 = '" & Product6 & "' 

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


加好友 发短信
等级:超级版主 帖子:107896 积分:548849 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2020/2/22 11:42:00 [显示全部帖子]

多了个单引号

Filter = "[提交人] = '" & e.Node.DataRow("提交人") & "' And 购买单位 = '" & Product & "' and Year(日期) = " & Year & " And  ....

 回到顶部