-- 加载明细记录
老师,我想根据 查询到的 供应商 生成的明细记录,生成一个目录树,也就是根据下面的红色代码 生成一个目录树,现在是目录树已经可以了,但是右边的表记录,却是所有供应商的记录,这个怎么处理到下面的目录树代码里呢?
DataTables("供应商订货明细表").LoadFilter = ""
DataTables("供应商订货明细表").Load
\'同步记录
If Forms("商家订货").opened
Dim cr As Row = Tables("商家订货_Table2").Current
e.Form.Controls("DateTimePicker1").text=Forms("商家订货").Controls("StartDate").text
e.Form.Controls("DateTimePicker2").text=Forms("商家订货").Controls("EndDate").text
\'
Tables("商家订货记录_Table1").Filter ="供应商名称 = \'" & cr("供应商名称") & "\'and 日期 >= \'" & e.Form.Controls("DateTimePicker1").text & "\' and 日期 <= \'" & e.Form.Controls("DateTimePicker2").text & "\'"
Dim dt As DataTable
Dim b As New GroupTableBuilder("统计表1",DataTables("供应商订货明细表"),"供应商名称 = \'" & cr("供应商名称") & "\'")
b.Groups.AddDef("供应商名称","供应商名称")
b.Groups.AddDef("日期",DateGroupEnum.Year,"年")
b.Groups.AddDef("日期",DateGroupEnum.Month,"月")
b.Groups.AddDef("日期",DateGroupEnum.Day,"日")
b.Totals.AddDef("订货单号",AggregateEnum.Count,"订单数") \'根据客户列来统计记录数,也就是订单数
dt = b.Build()
Dim trv1 As WinForm.TreeView = e.Form.Controls("TreeView1")
trv1.BuildTree(dt, "供应商名称|年|月|日","供应商名称 = \'" & cr("供应商名称") & "\'")
trv1.StopRedraw
For Each nd1 As WinForm.TreeNode In trv1.AllNodes
Dim Year1 As Integer = nd1.DataRow("年")
Dim Month1 As Integer = nd1.DataRow("月")
Dim Day1 As Integer = nd1.DataRow("日")
Dim Product1 As String = "\'" & nd1.DataRow("供应商名称") & "\'"
Select Case nd1.Level
Case 0
nd1.Text = nd1.text & "(" & dt.Compute("Sum(订单数)","供应商名称 = " & Product1) & "条)"
Case 1
nd1.Text = nd1.text & "年(" & dt.Compute("Sum(订单数)","供应商名称 = " & Product1 & " And 年 = " & Year1) & "条)"
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
trv1.Nodes.Insert("显示全部","显示全部(" & dt.Compute("Sum(订单数)") & "条)",0)
trv1.ResumeRedraw
End If
\'\'同步记录