Foxtable(狐表)用户栏目专家坐堂 → 目录树统计


  共有2347人关注过本帖树形打印复制链接

主题:目录树统计

帅哥哟,离线,有人找我吗?
outcat
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:一尾狐 帖子:470 积分:3641 威望:0 精华:0 注册:2017/11/5 14:47:00
目录树统计  发帖心情 Post By: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

老师,我要实现目录树 按年、月、供应商、仓库 统计,后面加上( 条),可是上面出错代码 供应商 后面  关于加 (条)出错,请老师赐教

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110581 积分:562801 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2018/12/22 9:06:00 [只看该作者]

表达式里的字符串要使用单引号引起来:

nd1.Text = nd1.text & "供应商名称(" & dt.Compute("Sum(订单数)","年 = " & Year1 & " And 月 = " & Month1 & " and 供应商名称 = '" & Product1 & "'" ) & "条)"

 回到顶部