'''
Dim dws() As String = {"梁平中学","红旗中学","梁平一中","实中双桂","屏锦中学","袁驿中学","福禄中学"}
Dim jb As New SQLJoinTableBuilder("查询表1","成绩库")
jb.AddCols("年级","学科","Cstr(大袋40份) as " & dws(0) & "_大袋40份","大袋30份 as " & dws(0) & "_大袋30份","小袋5份 as " & dws(0) & "_小袋5份","[大袋40份] * 40 + [大袋30份] * 30 + [小袋5份] * 5 as " & dws(0) & "_合计")
jb.Filter = "年级='2018' and 单位='" & dws(0) & "'"
Dim d As fxDataSource = jb.BuildDataSource()
For i As Integer = 1 To dws.Length - 1
Dim jb1 As New SQLJoinTableBuilder("查询表1","成绩库")
jb1.AddCols("年级","学科","Cstr(大袋40份) as " & dws(i) & "_大袋40份","大袋30份 as " & dws(i) & "_大袋30份","小袋5份 as " & dws(i) & "_小袋5份","[大袋40份] * 40 + [大袋30份] * 30 + [小袋5份] * 5 as " & dws(i) & "_合计")
jb1.Filter = "年级='2018' and 单位='" & dws(i) & "'"
Dim d1 As fxDataSource = jb1.BuildDataSource()
Dim Cols As String = "年级|学科"
d.Combine(Cols.split("|"),d1,Cols.split("|"))
Next
d.Show("查询表1")
jb = New SQLJoinTableBuilder("查询表2","成绩库")
jb.AddCols("单位","经办人","联系电话","分管领导","分管领导电话","0 as 排序")
jb.Filter = "年级='2018' and 联系电话 is not null and 分管领导电话 is not null"
jb.Distinct = True
Dim dt As DataTable = jb.Build(True)
For Each dr As DataRow In dt.DataRows
dr("排序") = Array.IndexOf(dws,dr("单位"))
Next
Dim s() As Integer = {0,2,6,10,14,18,22,26}
For i As Integer = 0 To s.length - 1
Tables("查询表1").Cols(s(i)).TextAlign = TextAlignEnum.Center
Next
For i As Integer = 1 To dt.DataCols.Count - 2
Dim lst As List(of String) = dt.GetValues(dt.DataCols(i).name,"","排序")
Dim r As Row = Tables("查询表1").AddNew
r(Tables("查询表1").Cols(s(0)).Name) = dt.DataCols(i).name
For i1 As Integer = 1 To s.length - 1
r(Tables("查询表1").Cols(s(i1)).Name) = lst(i1-1)
Next
Dim ii As Integer = Tables("查询表1").Rows.Count + 1
Dim tb As Table = Tables("查询表1")
tb.Grid.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom
Dim rng As C1.Win.C1FlexGrid.CellRange = tb.Grid.GetCellRange(ii, 1, ii, 2)
tb.Grid.MergedRanges.Add(rng)
For Each i2 As Integer In s
If i2 <> 0
rng = tb.Grid.GetCellRange(ii, i2+1, ii, i2+4)
tb.Grid.MergedRanges.Add(rng)
End If
Next
Next
Tables("查询表1").AutoSizeCols
MainTable = Tables("查询表1")