Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
内部表,,这个就要一个一个表设置吗,,全局的不行吗,登入的时候直接给限制了
Dim Filter As String
With e.Form.Controls("combobox1")
If .Value IsNot Nothing Then
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
If user.IsRole("管辖部门") Then
If Filter > "" Then
Filter = Filter & " and "
End If
Filter = "[管辖部门] in ('" & user.Roles.replace(",", "','") & "')"
End If
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
'bd1.Subtotal = True
'bd1.SubtotalLevel = 1
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'数据居中
老师麻烦在给看一下,,查询统计加的代码是不是错的,,也不报错,查询也不起作用
If user.IsRole("管辖部门") Then
If Filter > "" Then
Filter = Filter & " and "
End If
Filter = "[管辖部门] in ('" & user.Roles.replace(",", "','") & "')"
End If
谢谢老师已经调试出来了,
多了一个if语句,就加这一句就可以了
Filter = "[管辖部门] in ('" & user.Roles.replace(",", "','") & "')"