以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 筛选树列示年月日之目录树代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=147340) |
-- 作者:15666282205 -- 发布时间:2020/3/14 15:15:00 -- 筛选树列示年月日之目录树代码 老师,我设计的筛选树是统计年、月、日和生产工段等,设置统计筛选成功了,点击目录树代码我根据帮助写了年、月,再往下的日和生产工段我不会写,请指导。 \'-----------------------------------新的代码--------------------------------------- Dim Filter As String = "" If e.node.Name <> "显示所有行" Then \'要用Name属性,不能用Text属性 Dim d1 As Date Dim d2 As Date Dim Year As Integer = e.Node.DataRow("年") Dim Month As Integer = e.Node.DataRow("月") Dim Product As String = e.Node.DataRow("日") Dim Product1 As String = e.Node.DataRow("生产工段") Dim Product2 As String = e.Node.DataRow("考勤班组") Dim Product3 As String = e.Node.DataRow("考勤员") Dim Product4 As String = e.Node.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 生产工段 = \'" & Product1 & "\'" End Select End If Tables("工时表").Filter = Filter |
-- 作者:有点蓝 -- 发布时间:2020/3/14 15:26:00 -- 生成筛选树的代码发上来看看 |
-- 作者:15666282205 -- 发布时间:2020/3/14 16:10:00 -- \'\'---------------------------------试验工时表筛选树-------------------------------------------- \'首先生成统计表 Dim dt8 As DataTable Dim b8 As New sqlGroupTableBuilder("统计表工时表1","工时表") b8.C b8.Groups.AddDef("日期",DateGroupEnum.Year,"年") b8.Groups.AddDef("日期",DateGroupEnum.Month,"月") b8.Groups.AddDef("日期",DateGroupEnum.day,"日") b8.Groups.AddDef("生产工段") b8.Groups.AddDef("考勤班组") b8.Groups.AddDef("考勤员") b8.Groups.AddDef("零件序号") b8.Groups.AddDef("操作人") b8.Groups.AddDef("商品全名") b8.Totals.AddDef("零件序号",AggregateEnum.Count,"次数") \'根据客户列来统计记录数,也就是订单数 dt8 = b8.Build(True) \'参数设置为True,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv8 As WinForm.TreeView = e.Form.Controls("TreeView5") trv8.BuildTree(dt8, "年|月|日|生产工段|考勤班组|考勤员|操作人|商品全名") trv8.StopRedraw For Each nd As WinForm.TreeNode In trv8.AllNodes Dim Year As Integer = nd.DataRow("年") Dim Month As Integer = nd.DataRow("月") Dim Day As Integer = nd.DataRow("日") Dim Product8 As String = nd.DataRow("生产工段") Dim Product9 As String = nd.DataRow("零件序号") Dim Product10 As String = nd.DataRow("操作人") Dim Product11 As String = nd.DataRow("考勤班组") Dim Product12 As String = nd.DataRow("考勤员") Dim Product13 As String = nd.DataRow("商品全名") Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt8.Compute("Count(零件序号)","年 = " & Year) & " )" Case 1 nd.Text = nd.text & "月(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month) & " )" Case 2 nd.Text = nd.text & "日(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month & " And 日= " & day) & " )" Case 3 nd.Text = nd.text & "(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month & " And 日= " & day & " And 生产工段 = \'" & Product8 & "\'") & ")" Case 4 nd.Text = nd.text & "(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month & " And 日= " & day & " And 生产工段 = \'" & Product8 & "\'And 考勤班组= \'" & Product11 & "\'") & ")" Case 5 nd.Text = nd.text & "(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month & " And 日= " & day & " And 生产工段 = \'" & Product8 & "\'And 考勤班组= \'" & Product11 & "\'And 考勤员= \'" & Product12 & "\'") & ")" Case 6 nd.Text = nd.text & "(" & dt8.Compute("Count(零件序号)","年 = " & Year & " And 月 = " & Month & " And 日= " & day & " And 生产工段 = \'" & Product8 & "\'And 考勤班组= \'" & Product11 & "\'And 考勤员= \'" & Product12 & "\'And 操作人= \'" & Product10 & "\'") & ")" End Select Next trv8.Nodes.Insert("显示所有行","显示所有行(" & dt8.Compute("Count(次数)") & ")",0) trv8.ResumeRedraw [此贴子已经被作者于2020/3/14 16:13:45编辑过]
|
-- 作者:15666282205 -- 发布时间:2020/3/14 16:15:00 -- 老师,第三行一粘贴就没有了,奇怪。b8.C |
-- 作者:15666282205 -- 发布时间:2020/3/14 16:15:00 -- 这里也粘贴不上,是定义数据库的 |
-- 作者:有点蓝 -- 发布时间:2020/3/14 16:23:00 -- 目录树的点击事件的case xx也要和生成代码时的节点一一对应呀 case 2 是日的筛选 d1 = New Date(Year, Month, Product) \'取得该月的第一天 Filter = "日期 = #" & d1 & "#" case 3 才开始有生产工段 d1 = New Date(Year, Month, Product) \'取得该月的第一天 Filter = "日期 = #" & d1 & "# And 生产工段 = \'" & Product1 & "\'" |
-- 作者:15666282205 -- 发布时间:2020/3/19 8:43:00 -- 。 [此贴子已经被作者于2020/3/19 9:07:21编辑过]
|
-- 作者:有点蓝 -- 发布时间:2020/3/19 9:04:00 -- 看看:http://www.foxtable.com/webhelp/topics/2343.htm |