Dim dt As DataTable
dt = DataTables("ysd")
Dim bb As String = "金额" 'drxx1("统计列").split("|") ' 指要统计的数量?金额
Dim bfl As String = "采购方式" ' drxx1("表头分类字段").split("|") ' 指要表头分类统计的字段
Dim btj As String = "管理部门" ' drxx1("统计分类字段").split("|") ' 指要列表分类统计的项目
'通用统计
Dim i As Integer = 0
Dim Pr1 As List(Of String) ' 表头分类取值
Pr1 = Dt.GetValues(bfl)
Dim dts(pr1.count-1) As fxDataSource
For Each r As String In Pr1
If r <> Nothing
If i = 0
Dim bd As New GroupTableBuilder("统计表1",dt)
bd.Filter = bfl & " = '" & r & "' "
bd.Groups.AddDef(btj) '统计分类字段
bd.Totals.AddDef(bb,r) '对金额进行统计
dts(i) = bd.BuildDataSource()
i = i + 1
Else
Dim bd As New GroupTableBuilder("统计表1",dt)
bd.Filter = bfl & " = '" & r & "' "
bd.Groups.AddDef(btj) '统计分类字段
bd.Totals.AddDef(bb,r) '对金额进行统计
dts(i) = bd.BuildDataSource()
dts(0).Combine(btj,dts(i),btj)
i = i + 1
End If
End If
Next
Tables("通用时期报表_表").DataSource = dts(0) '将统计结果绑定到