以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 加载树语句修改 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=144068) |
-- 作者:qinlao666 -- 发布时间:2019/12/10 10:34:00 -- 加载树语句修改 麻烦老师帮忙修改一下,谢谢! Dim dt As DataTable Dim b As New GroupTableBuilder("统计表2",DataTables("成品出库")) b.Groups.AddDef("出库日期",DateGroupEnum.Year,"年") b.Groups.AddDef("出库方式") b.Groups.AddDef("系列") b.Totals.AddDef("数量",AggregateEnum.sum,"数量") \'根据主键列来统计记录数,也就是订单数 dt = b.Build(False) \'参数设置为False,生成一个临时表,不在主界面显示 \'然后根据统计表生成目录树 Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1") trv.BuildTree(dt, "年|出库方式|系列") trv.StopRedraw For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim M As String = nd.DataRow("出库方式") Dim Product As String = nd.DataRow("系列") Dim dr As DataRow Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(数量)","年 = " & Year) & "套)" Case 1 nd.Text = nd.text & "(" & dt.Compute("Sum(数量)"," [出库方式] = \'" & dr("出库方式") &"\'") & "套)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("数量") & ")" End Select Next trv.Nodes.Insert("加载所有订单","加载所有订单(" & dt.Compute("Sum(数量)") & "套)",0) trv.ResumeRedraw
[此贴子已经被作者于2019/12/10 10:35:01编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/12/10 10:39:00 -- dt = b.Build(true) \'参数设置为true,生成一个临时表,不在主界面显示 |
-- 作者:qinlao666 -- 发布时间:2019/12/10 12:01:00 -- 加载树语句修改 老师,后面的统计命令也有问题,麻烦帮忙一起改一下,谢谢 For Each nd As WinForm.TreeNode In trv.AllNodes Dim Year As Integer = nd.DataRow("年") Dim M As String = nd.DataRow("出库方式") Dim Product As String = nd.DataRow("系列") Dim dr As DataRow Select Case nd.Level Case 0 nd.Text = nd.text & "年(" & dt.Compute("Sum(数量)","年 = " & Year) & "套)" Case 1 nd.Text = nd.text & "(" & dt.Compute("Sum(数量)"," [出库方式] = \'" & dr("出库方式") &"\'") & "套)" Case 2 nd.Text = nd.text & "(" & nd.DataRow("数量") & ")" End Select Next trv.Nodes.Insert("加载所有订单","加载所有订单(" & dt.Compute("Sum(数量)") & "套)",0) trv.ResumeRedraw [此贴子已经被作者于2019/12/10 12:02:12编辑过]
|
-- 作者:有点蓝 -- 发布时间:2019/12/10 12:06:00 -- nd.Text = nd.text & "(" & dt.Compute("Sum(数量)","年 = " & Year & " and [出库方式] = \'" & M &"\'") & "套)" |