Dim Filter As String
Filter = "[管辖部门] in ('" & user.Roles.replace(",", "','") & "')"
Filter = "[品牌] in ('" & user.Roles.replace(",", "','") & "')"
With e.Form.Controls("combobox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter &"品牌 like '%" & .Value & "%'"
End If
End With
With e.Form.Controls("combobox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "销售型号 like'%" & .Value & "%'"
End If
End With
With e.Form.Controls("combobox12")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "销售商场 like'%" & .Value & "%'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "销售日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "销售日期 <= #" & .Value & "#"
End If
End With
Dim bd1 As New SqlGroUPTableBuilder("查询表_table1", "销售资料")
Dim dt1 As fxDataSource
bd1.groups.AddDef("销售商场")'根据型号分组
bd1.groups.AddDef("品牌")'根据型号分组
bd1.Groups.AddDef("销售型号")'根据型号分组
bd1.Groups.AddDef("管辖部门")'根据型号分组
bd1.Groups.AddDef("销售日期", "月")
bd1.Totals.AddDef("数量")
bd1.Totals.AddDef("销售单价")
bd1.Filter = Filter
dt1 = bd1.BuildDataSource()
Tables("查询表_table1").DataSource = dt1 '将统计结果绑定到Table
With Tables("查询表_Table1")
Dim g As SubtotalGroup '定义一个新的分组
.SubtotalGroups.Clear() '清除原有的分组
g = New SubtotalGroup
g.GroupOn = "月" '分组列为客户
g.TotalOn = "数量,销售单价" '对数量和金额进行统计
.SubtotalGroups.Add(g) '加入刚刚定义的分组
g = New SubtotalGroup
g.GroupOn = "销售商场" '分组列为客户
g.TotalOn = "数量,销售单价" '对数量和金额进行统计
.SubtotalGroups.Add(g) '加入刚刚定义的分组
g = New SubtotalGroup
g.GroupOn = "*" '分组列为客户
g.TotalOn = "数量,销售单价" '对数量和金额进行统计
.SubtotalGroups.Add(g) '加入刚刚定义的分组
.Subtotal() '生成汇总模式
End With
Tables("查询表_Table1").SysStyles("Subtotal0").BackColor = Color.LightSkyBlue'小计行颜色
Tables("查询表_Table1").SysStyles("Subtotal1").BackColor = Color.Turquoise'小计2颜色
Tables("查询表_Table1").Cols("销售商场").Width = 160'列宽设置
Tables("查询表_Table1").Cols("销售型号").Width = 120'列宽设置
Tables("查询表_Table1").Cols("数量").TextAlign = TextAlignEnum.Center'数据居中
Tables("查询表_Table1").Cols("销售单价").TextAlign = TextAlignEnum.Center'数据居中
Tables("查询表_Table1").Cols("月").TextAlign = TextAlignEnum.Center'数据居中
'Tables("查询表_Table1").Filter = Filter & "[管辖部门] in ('" & user.Roles.replace(",", "','") & "')"
'Tables("查询表_Table1").Filter = "[品牌] in ('" & user.Roles.replace(",", "','") & "')"
老师上面2句红色的就下一句起作用,,这个2个角色同时生效需要怎么设置呀