Dim y As Integer = Date.Today.Year
Dim dt1 As New Date(y, 1, 1)
Dim dt2 As New Date(y, 12, 31)
Dim Filter As String
Dim s As String = ""
Select Case User.Group
Case "录入者","",Nothing
s =user.name
Case Else
Dim dr2 As DataRow
dr2 = DataTables("用户").Find("[分组] = '" & User.Group & "'")
If dr2 IsNot Nothing Then
s = dr2("下级")
End If
End Select
Filter = "日期 >= #" & dt1 & "# And 日期 <= #" & dt2 & "# and 录入者 in ('" & s.replace(",","','") & "')"
Dim b As New GroupTableBuilder("统计表1",DataTables("订单"))
b.Groups.AddDef("产品")
b.Totals.AddDef("数量","订购数量") '添加数量列用于统计
b.Filter = Filter
Tables("分组加载统计_Table1").DataSource = b.BuildDataSource()