以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 目录树统计 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=129126) |
-- 作者:outcat -- 发布时间:2018/12/21 23:57:00 -- 目录树统计 \'按年月 DataTables("进货单总表").LoadFilter = "" DataTables("进货单总表").Load \'首先生成统计表 Dim dt As DataTable Dim b As New GroupTableBuilder("统计表1",DataTables("进货单总表")) b.Groups.AddDef("供应商名称","供应商名称") b.Groups.AddDef("仓库名称","仓库名称") b.Groups.AddDef("日期",DateGroupEnum.Year,"年") b.Groups.AddDef("日期",DateGroupEnum.Month,"月") b.Totals.AddDef("供应商名称",AggregateEnum.Count,"订单数") \'根据客户列来统计记录数,也就是订单数 dt = b.Build() Dim trv2 As WinForm.TreeView = e.Form.Controls("TreeView2") trv2.BuildTree(dt, "年|月|供应商名称|仓库名称") trv2.StopRedraw For Each nd1 As WinForm.TreeNode In trv2.AllNodes Dim Year1 As Integer = nd1.DataRow("年") Dim Month1 As Integer = nd1.DataRow("月") Dim Product1 As String = nd1.DataRow("供应商名称") Dim ck1 As String = nd1.DataRow("仓库名称") Select Case nd1.Level Case 0 nd1.Text = nd1.text & "年(" & dt.Compute("Sum(订单数)","年 = " & Year1) & "条)" Case 1 nd1.Text = nd1.text & "月(" & dt.Compute("Sum(订单数)","年 = " & Year1 & " And 月 = " & Month1 ) & "条)" \'Case 2 \'nd1.Text = nd1.text & "供应商名称(" & dt.Compute("Sum(订单数)","年 = " & Year1 & " And 月 = " & Month1 & " and 供应商名称 = " & Product1 ) & "条)" Case 3 nd1.Text = nd1.text & "(" & nd1.DataRow("订单数") & "条)" End Select Next trv2.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(订单数)") & "条)",0) trv2.ResumeRedraw 老师,我要实现目录树 按年、月、供应商、仓库 统计,后面加上( 条),可是上面出错代码 供应商 后面 关于加 (条)出错,请老师赐教
|
-- 作者:有点蓝 -- 发布时间:2018/12/22 9:06:00 -- 表达式里的字符串要使用单引号引起来: nd1.Text = nd1.text & "供应商名称(" & dt.Compute("Sum(订单数)","年 = " & Year1 & " And 月 = " & Month1 & " and 供应商名称 = \'" & Product1 & "\'" ) & "条)" |