以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 包含季度的目录树设计 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101209) |
||||
-- 作者:地瓜 -- 发布时间:2017/5/26 16:33:00 -- 包含季度的目录树设计 在“采购立项统计”窗体中,设计包含“季度”的目录树,但是当点击目录树时没有实现效果。谢谢!
密码:1234
|
||||
-- 作者:有点蓝 -- 发布时间:2017/5/26 17:35:00 -- \'====================生成政府采购立项目录树====================== \'首先生成统计表 Dim dt_cglx As DataTable Dim b_cglx As New GroupTableBuilder("统计表1",DataTables("tblcglx")) b_cglx.Groups.AddDef("rq",DateGroupEnum.Year,"年") b_cglx.Groups.AddDef("rq",DateGroupEnum.Quarter,"季") b_cglx.Groups.AddDef("rq",DateGroupEnum.Month,"月") b_cglx.groups.AddDef("dwlb","立项类别") b_cglx.Groups.AddDef("cgdw","立项单位") b_cglx.Totals.AddDef("lxID",AggregateEnum.Count,"立项数") \'根据客户列来统计记录数,也就是订单数 dt_cglx = b_cglx.Build(False) \'参数设置为False,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 \'Dim trv_cglx As WinForm.TreeView = e.Form.Controls("trv_cglx") Dim trv_cglx As WinForm.TreeView = Forms("采购立项").Controls("trv_cglx") trv_cglx.BuildTree(dt_cglx, "年|季|月|立项类别|立项单位") trv_cglx.StopRedraw For Each nd_cglx As WinForm.TreeNode In trv_cglx.AllNodes Dim nflx As Integer = nd_cglx.DataRow("年") Dim yflx As Integer = nd_cglx.DataRow("月") Dim jidu As Integer = nd_cglx.DataRow("季") Dim badwlx As String = nd_cglx.DataRow("立项单位") Dim badwlblx As String=nd_cglx.DataRow("立项类别") Select Case nd_cglx.Level Case 0 nd_cglx.Text = nd_cglx.text & "年( " & dt_cglx.Compute("Sum(立项数)","年 = " & nflx) & " )项" Case 1 nd_cglx.Text = nd_cglx.text & "季( " & dt_cglx.Compute("Sum(立项数)","年 = " & nflx & " And 季 = " & jidu) & " )项" Case 2 nd_cglx.Text = nd_cglx.text & "月( " & dt_cglx.Compute("Sum(立项数)","年 = " & nflx & " And 季 = " & jidu & " And 月 = " & yflx) & " )项" Case 3 nd_cglx.Text = nd_cglx.text & "( " & dt_cglx.Compute("Sum(立项数)","年 = " & nflx & " And 季 = " & jidu & " And 月 = " & yflx & " And 立项类别 = \'" & badwlblx & "\'") & " )项" Case 4 nd_cglx.Text = nd_cglx.text & "( " & nd_cglx.DataRow("立项数") & " )项" End Select Next trv_cglx.Nodes.Insert("显示所有采购立项","显示所有采购立项( " & dt_cglx.Compute("Sum(立项数)") & " )项",0) trv_cglx.ResumeRedraw Tables("tblcglx").Filter=""
|
||||
-- 作者:有点蓝 -- 发布时间:2017/5/26 17:36:00 -- 采购立项窗体筛选目录树NodeMouseClick事件 Dim e As Object = Args(0) Dim Filter As String = "" Dim trv As WinForm.TreeView = e.Form.Controls("trv_cglx") Dim node As WinForm.TreeNode=trv.SelectedNode If node.Name <> "显示所有采购立项" Then \'要用Name属性,不能用Text属性 Dim d1 As Date Dim d2 As Date Dim Year As Integer = node.DataRow("年") Dim Month As Integer = node.DataRow("月") Dim Product As String = node.DataRow("立项类别") Dim pric As String=node.DataRow("立项单位") Select Case node.Level Case 0 d1 = New Date(Year,1,1) \'取得该年的第一天 d2 = new Date(Year,12,31) \'取得该年的最后一天 Filter = "rq >= #" & d1 & "# And rq <= #" & d2 & "#" Case 1 Dim q As Integer = (Month- 1) \\ 3 + 1 \'计算现在是第几个季度 d1 = New Date(Year, 3 * (q - 1) + 1, 1) \'获取本季度的第一天 d2 = New Date(Year, 3 * q, Date.DaysInMonth(Year,3 * q)) \'获取本季度的最后一天 Filter = "rq >= #" & d1 & "# And rq <= #" & d2 & "#" Case 2 d1 = New Date(Year, Month, 1) \'取得该月的第一天 d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) \'取得该月的最后一天 Filter = "rq >= #" & d1 & "# And rq <= #" & d2 & "#" Case 3 d1 = New Date(Year, Month, 1) \'取得该月的第一天 d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) \'取得该月的最后一天 Filter = "rq >= #" & d1 & "# And rq <= #" & d2 & "# And dwlb = \'" & Product & "\'" Case 4 d1 = New Date(Year, Month, 1) \'取得该月的第一天 d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) \'取得该月的最后一天 Filter = "rq >= #" & d1 & "# And rq <= #" & d2 & "# And dwlb = \'" & Product & "\' and cgdw = \'" & pric & "\'" End Select End If Tables("tblcglx").Filter=Filter
|
||||
-- 作者:地瓜 -- 发布时间:2017/5/27 9:14:00 -- 谢谢! |