If _UserRole = "导购" Then
Dim g As New CrossTableBuilder("统计表2", DataTables("pos_t_saleflow"))
g.HGroups.AddDef("oper_date",DateGroupEnum.Year,"年")
g.HGroups.AddDef("oper_date",DateGroupEnum.Month,"月")
g.HGroups.AddDef("oper_date",DateGroupEnum.Day,"日")
g.HGroups.AddDef("ABC")
g.VGroups.AddDef("sell_way")
g.Totals.AddDef("实际金额", "销售额")
g.HorizontalTotal = True
Dim t As Table = e.Form.Controls("Table1").Table
t.DataSource = g.BuildDataSource
t.DataTable.DataCols.Add("提成", Gettype(Double))
For Each r As Row In t.Rows
If r("abc") = "a" Then
r("提成") = r("合计") * Vars("tc_a")
ElseIf r("abc") = "b" Then
r("提成") = r("合计") * Vars("tc_b")
ElseIf r("abc") = "c" Then
r("提成") = r("合计") * Vars("tc_c")
End If
Next
If time1 = Nothing Then
If time2 = Nothing Then
messagebox.Show("至少指定日期2")
Return
Else
Tables("维护提成统计_Table1").Filter = "[年] = '" & time2.Year & "' And [月] = '" & time2.Month & "' And [日] = '" & time2.Day & "'"
End If
Else
If time2 = Nothing Then
messagebox.Show("至少指定日期2")
Return
Else
Tables("维护提成统计_Table1").Filter = "[年] >= '" & time1.Year & "' And [月] >= '" & time1.Month & "' And [日] >= '" & time1.Day & "' And [年] <= '" & time2.Year & "' And [月] <= '" & time2.Month & "' And [日] <= '" & time2.Day & "' "
End If
End If
With Tables("维护提成统计_Table1")
.MergeMode = MergeModeEnum.Standard
.MergeCols.Clear()
.MergeCols.Add("年")
.MergeCols.Add("月")
.MergeCols.Add("日")
.MergeCols.Add("abc")
.MergeSort = "年 DESC,月 DESC,日 DESC,abc"
.AllowMerge = True
End With