Dim b As New SQLCrossTableBuilder("統計","配量表")
b.HGroups.AddDef("款號") '添加客户列用于水平分组
b.HGroups.AddDef("物料")
For Each s1 As String In Lst
b.HGroups.AddExp("顏色信息_" & s1 ,"款號")
Next
b.VGroups.AddDef("尺碼信息") '添加产品列用于垂直分组
b.Totals.AddDef("用量信息") '添加数量列用于统计
b.Build '生成统计表
Dim dr1,dr2 As DataRow
For Each dr2 In DataTables("統計").DataRows
For Each s1 As String In Lst
dr1= DataTables("配色表").Find("款號 ='" & dr2("款號") & "' And 物料 ='" & dr2("物料") & "' And 顏色信息 ='" & s1 & "'")
If dr1 IsNot Nothing Then
dr2("顏色信息_" & s1) = dr1("配色信息")
End If
Next
Next
Dim s2 As String
For Each c1 As DataCol In DataTables("統計").DataCols
If c1.Name.Contains("用量信息_") Then
C1.Caption = "尺碼信息_" & C1.Caption
End If
Next
DataTables("統計") .BuildHeader()
MainTable = Tables("統計") '打开生成的统计表