Dim ary1() As String = {"CheckBox8", "CheckBox9", "CheckBox10|CheckBox11"}
Dim ary2() As String = {"陈列量", "动销量","库位销售分析"} '表名
Dim ary3() As String = {"陈列量", "动销量", "销售数量|销售金额,吊牌金额"} '列名
Dim ary4() As String = {"陈列sku数", "动销sku数", "销售件数|销售金额,吊牌金额"} '列名
Dim ary5() As String = {"统计表1", "统计表2", "统计表3"} '统计表
Dim pdt As fxDataSource = Nothing
Dim ls As new List(of String)
ls.add("门店")
ls.add("库位")
For Each c As Object In e.Form.controls("groupbox3").children
If c.checked Then
ls.add(c.text)
End If
Next
Dim nms As String() = ls.ToArray
For i As Integer = 0 To ary1.length - 1
Dim ary8() As String = ary1(i).split("|")
Dim isChecked = False
For Each s As String In ary8
If e.form.controls(s).checked Then
isChecked = True
End If
Next
If isChecked Then
Dim bdn As New SQLcrossTableBuilder(ary5(i),ary2(i))
bdn.HGroups.AddDef("门店") '添加客户列用于水平分组
bdn.HGroups.AddDef("库位") '添加客户列用于水平分组
bdn.vGroups.AddDef("调整期间","调整期间_{0}") '添加客户列用于水平分组
Dim ary6() As String = ary3(i).split("|")
Dim ary7() As String = ary4(i).split("|")
For k As Integer = 0 To ary8.length - 1
If e.form.controls(ary8(k)).checked Then
Dim ary9() As String = ary6(k).split(",")
Dim ary10() As String = ary7(k).split(",")
For j As Integer = 0 To ary9.length-1
bdn.Totals.AddDef(ary9(j),ary10(j)) '添加数量列用于统计
next
End If
Next
Dim dt = bdn.BuildDataSource()
If pdt Is Nothing AndAlso dt IsNot Nothing Then
pdt = dt
Else
If pdt IsNot Nothing AndAlso dt IsNot Nothing Then
pdt.Combine(nms,dt,nms)
End If
End If
End If
Next
Tables(e.Form.Name & "_table1").StopRedraw
Tables(e.Form.Name & "_table1").DataSource = pdt