Dim page As WinForm.TopicPage
page = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnk As WinForm.TopicLink = page.Links("未完成立项")
Dim cnt As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = False ")
lnk.Text = lnk.Text & "(" & cnt & ")"
Dim pagea As WinForm.TopicPage
pagea = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnka As WinForm.TopicLink = pagea.Links("未选择供应商")
Dim cnta As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = true And 参与报价 = False ")
lnka.Text = lnka.Text & "(" & cnta & ")"
Dim pageb As WinForm.TopicPage
pageb = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnkb As WinForm.TopicLink = pageb.Links("未提交反馈")
Dim cntb As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = true And 参与报价 = true And 提交反馈 = False ")
lnkb.Text = lnkb.Text & "(" & cntb & ")"
Dim paged As WinForm.TopicPage
paged = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnkd As WinForm.TopicLink = paged.Links("总经理未确认")
Dim cntd As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = true And 参与报价 = true And 提交反馈 = true And 总经理确认 = False")
lnkd.Text = lnkd.Text & "(" & cntd & ")"
Dim pagee As WinForm.TopicPage
pagee = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnke As WinForm.TopicLink = pagee.Links("客户未最终确认")
Dim cnte As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = true And 参与报价 = true And 提交反馈 = true And 总经理确认 = true And 最终确认 = False")
lnke.Text = lnke.Text & "(" & cnte & ")"
Dim pagef As WinForm.TopicPage
pagef = Forms("导航栏").Controls("TopicBar1").pages("项目流程跟踪")
Dim lnkf As WinForm.TopicLink = pagef.Links("未完成报价")
Dim cntf As Byte = DataTables("报价阶段表").Compute("count([_identify])"," 是否立项 = true And 参与报价 = true And 提交反馈 = true And 总经理确认 = true And 最终确认 = true And 报价结束 = False")
lnkf.Text = lnkf.Text & "(" & cntf & ")"
lnk = page.Links("七天内到截止日期")
cnt = DataTables("报价阶段表").Compute("count([_identify])","项目截止时间<=#" & Date.Today.adddays(7) & "#")
lnk.Text = lnk.Text & "(" & cnt & ")"
lnk = page.Links("三天内到截止日期")
cnt = DataTables("报价阶段表").Compute("count([_identify])","项目截止时间<=#" & Date.Today.adddays(3) & "#")
lnk.Text = lnk.Text & "(" & cnt & ")"
Dim pageg As WinForm.TopicPage
Dim nms() As String = {"客户名称" ,"报价_供应商" , "项目经理"}
For Each nm As String In nms
pageg = Forms("导航栏").Controls("TopicBar1").pages(nm)
For Each pd As String In DataTables("报价阶段表").GetValues(nm)
Dim lnkg As WinForm.TopicLink = pageg.Links.Add(pd ,pd)
Dim cntg As Integer = DataTables("报价阶段表").Compute("count([_identify])", nm & "='" & pd & "'")
lnkg.Text = lnkg.Text & "(" & cntg & ")"
Next
Next
Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("产品订单管理"))
b.Groups.AddDef("客户名称")
b.Groups.AddDef("产品代号")
b.Groups.AddDef("订单关闭")
b.Totals.AddDef("订单关闭",AggregateEnum.Count,"订单数") '根据客户列来统计记录数,也就是订单数
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 Producta As String = "'" & nd.DataRow("客户名称") & "'"
Dim Productb As String = "'" & nd.DataRow("产品代号") & "'"
Dim Product As String = "'" & nd.DataRow("订单关闭") & "'"
Select Case nd.Level
Case 0
nd.Text = nd.text & "客户名称(" & dt.Compute("Sum(订单数)","客户名称 = " & Producta) & "条)"
Case 1
nd.Text = nd.text & "产品代号(" & dt.Compute("Sum(订单数)","客户名称 = " & Producta & " And 产品代号 = " & Productb) & "条)"
Case 2
nd.Text = nd.text & "产品代号(" & dt.Compute("Sum(订单数)","客户名称 = " & Producta & " And 产品代号 = " & Productb & " and 订单关闭 = " & Product) & "条)"
Case 3
nd.Text = nd.text & "(" & nd.DataRow("订单数") & "条)"
End Select
Next
trv.Nodes.Insert("显示所有行","显示所有行(" & dt.Compute("Sum(订单数)") & "条)",0)
trv.ResumeRedraw