以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]设置5层,有季度的筛选树的问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=62078) |
-- 作者:ehomecd -- 发布时间:2014/12/25 8:07:00 -- [求助]设置5层,有季度的筛选树的问题 做一个带统计的筛选树(信息登记窗口/筛选树1),按照:年/季度/月/单位/拟稿人来分层,请教如何写代码。特别是季度如何生成筛选。 另外,如何生成:单位/拟稿人/季度;时间在后边的带统计的筛选树(信息登记窗口/筛选树2)
所有用户密码都是 888 [此贴子已经被作者于2014-12-25 15:10:57编辑过]
|
-- 作者:Bin -- 发布时间:2014/12/25 8:16:00 -- http://www.foxtable.com/help/topics/2741.htm |
-- 作者:ehomecd -- 发布时间:2014/12/25 9:55:00 -- 我是按照这个改的,但层太多,搞的有些晕,希望指点一下。 |
-- 作者:有点甜 -- 发布时间:2014/12/25 10:03:00 -- For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim jidu As Integer = nd.DataRow("季") Dim Month As Integer = nd.DataRow("月") Dim dwmc As String = nd.DataRow("单位名称") Dim zgr As String = nd.DataRow("撰稿人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条" & dt.Compute("Sum(奖金)","年 = " & Year) & "元)" Case 1 nd.Text = nd.text & "季(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu) & "元)" Case 2 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu & " And 月 = " & Month) & "元)" Case 3 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条)" & nd.DataRow("奖金") & "元)" End Select Next |
-- 作者:ehomecd -- 发布时间:2014/12/25 11:13:00 -- 谢谢,但第4层的统计数据不正确,我进行了修改,多加了一个“单位名称”的筛选条件,红色背景部分,但代码好像写的有错误,我不知道该怎么改? For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim jidu As Integer = nd.DataRow("季") Dim Month As Integer = nd.DataRow("月") Dim dwmc As String = nd.DataRow("单位名称") Dim zgr As String = nd.DataRow("撰稿人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条" & dt.Compute("Sum(奖金)","年 = " & Year) & "元)" Case 1 nd.Text = nd.text & "季(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu) & "元)" Case 2 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu & " And 月 = " & Month) & "元)" Case 3 nd.Text = nd.text & "(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month & " and 单位名称 = " & dwmc) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month & " and 单位名称 = " & dwmc) & "元)" Case 4 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条" & nd.DataRow("奖金") & "元)" End Select Next 此问题已解决 Case 3 nd.Text = nd.text & "(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季度 = " & jidu & " and 月 = " & Month & " and 单位名称 = \'" & dwmc & "\'") & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季度 = " & jidu & " and 月 = " & Month & " and 单位名称 = \'" & dwmc &"\'") & "元)" [此贴子已经被作者于2014-12-25 11:24:47编辑过]
|
-- 作者:有点甜 -- 发布时间:2014/12/25 11:30:00 -- Case 3 nd.Text = nd.text & "(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month & " and 单位名称 = \'" & dwmc & "\'") & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季 = " & jidu & " and 月 = " & Month & " and 单位名称 = \'" & dwmc & "\'") & "元)" |
-- 作者:ehomecd -- 发布时间:2014/12/25 11:34:00 -- 季度的筛选时间条件怎么写啊? 这里有年的和月的,季度的怎么写 Dim Filter As String = "" If e.node.Name <> "显示所有记录" Then Dim d1 As Date Dim d2 As Date Dim Year As Integer = e.note.DataRow("年") Dim jidu As Integer = e.note.DataRow("季度") Dim Month As Integer = e.note.DataRow("月") Dim dwmc As String = e.note.DataRow("单位名称") Dim zgr As String = e.note.DataRow("撰稿人") Select Case e.Node.Level Case 0 d1 = New Date(Year,1,1) \'取得该年的第一天 d2 = new Date(Year,12,31) \'取得该年的最后一天 Filter = "刊发日期 >= #" & d1 & "# And 刊发日期 <= #" & d2 & "#" Case 1 d1 = New Date(Year, Month, 1) \'取得该月的第一天 d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) \'取得该月的最后一天 Filter = "刊发日期 >= #" & d1 & "# And 刊发日期 <= #" & d2 & "#" Case 2 d1 = New Date(Year, Month, 1) \'取得该月的第一天 d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) \'取得该月的最后一天 Filter = "刊发日期 >= #" & d1 & "# And 刊发日期 <= #" & d2 & "# And 单位名称 = \'" & dwmc & "\'" End Select End If Tables("信息宣传").Filter = Filter |
-- 作者:有点甜 -- 发布时间:2014/12/25 11:39:00 -- 参考
http://www.foxtable.com/help/topics/2720.htm
|
-- 作者:ehomecd -- 发布时间:2014/12/25 13:45:00 -- 这个筛选的逻辑是这样,每个季度发一次奖金,每个季度之下是每个社区多少钱,然后是每个社区下每个月的详情和是谁发的稿 层次应该是 年/季度/社区/月/人 我的代码弄完之后,同一季度下社区名称出现了重复,请问代码应该如何修正 Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("信息宣传")) b.Groups.AddDef("刊发日期",DateGroupEnum.Year,"年") b.Groups.AddDef("刊发日期",DateGroupEnum.Quarter,"季度") b.Groups.AddDef("单位名称") b.Groups.AddDef("刊发日期",DateGroupEnum.Month,"月") b.Groups.AddDef("撰稿人") b.Totals.AddDef("刊发日期",AggregateEnum.count,"记录数") b.Totals.AddDef("奖金",AggregateEnum.sum,"奖金") \'根据客户列来统计记录数,也就是订单数 dt = b.Build(False) \'参数设置为False,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = Forms("信息登记").Controls("TreeView1") trv.BuildTree(dt, "年|季度|单位名称|月|撰稿人","","年 desc,季度 desc,月 desc") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim jidu As Integer = nd.DataRow("季度") Dim dwmc As String = nd.DataRow("单位名称") Dim Month As Integer = nd.DataRow("月") Dim zgr As String = nd.DataRow("撰稿人") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(记录数)","年 = " & Year) & "条" & dt.Compute("Sum(奖金)","年 = " & Year) & "元)" Case 1 nd.Text = nd.text & "季度(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季度 = " & jidu) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季度 = " & jidu) & "元)" Case 2 nd.Text = nd.text & "(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季度 = " & jidu & " and 单位名称 = \'" & dwmc & "\'") & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季度 = " & jidu & " And 单位名称 = \'" & dwmc & "\'") & "元)" Case 3 nd.Text = nd.text & "月(" & dt.Compute("Sum(记录数)","年 = " & Year & " And 季度 = " & jidu & " and 单位名称 = \'" & dwmc & "\' and 月 = " & Month) & "条" & dt.Compute("Sum(奖金)","年 = " & Year & " And 季度 = " & jidu & " and 单位名称 = \'" & dwmc &"\' And 月 = " & Month) & "元)" Case 4 nd.Text = nd.text & "(" & nd.DataRow("记录数") & "条" & nd.DataRow("奖金") & "元)" End Select Next trv.Nodes.Insert("显示所有记录","显示所有记录(" & dt.Compute("Sum(记录数)") & "条" & dt.Compute("Sum(奖金)") & "元)",0) trv.ResumeRedraw [此贴子已经被作者于2014-12-25 14:06:00编辑过]
|
-- 作者:ehomecd -- 发布时间:2014/12/25 14:15:00 -- trv.BuildTree(dt, "年|季度|单位名称|月|撰稿人","","年 desc,季度 desc) 解决了,排序问题,这样就ok了
|