-- 作者:winwtj
-- 发布时间:2016/5/13 6:55:00
--
代码如下:
Dim nd1 As String nd1 = DataTables("明细").Compute("max(预算年度)") Dim nd2 As String=nd1-1 Dim nd3() As String ={nd1,nd2}
Dim g As New CrossTableBuilder("统计表e", DataTables("明细"),"预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")") g.HGroups.AddDef("支出类型编号") g.HGroups.AddDef("支出类型") g.HGroups.AddDef("项目类型编号") g.HGroups.AddDef("项目类型") g.VGroups.AddDef("预算年度") g.Totals.AddDef("财政拨款", "财政拨款") g.Totals.AddDef("上级拨款", "上级拨款") g.Totals.AddDef("其他收入", "其他收入") g.Totals.AddDef("上年结余", "上年结余") g.Totals.AddDef("支出合计", "支出合计") g.Filter = "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")" g.Build()
Dim g1 As New GroupTableBuilder("统计表A", DataTables("明细"),"预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")") g1.Groups.AddDef("单位编号") g1.Groups.AddDef("单位名称") g1.Totals.AddDef("支出合计") g1.Filter = "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")" g1.Build()
Dim g2 As New CrossTableBuilder("统计表B", DataTables("明细"),"预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")") g2.HGroups.AddDef("单位编号") g2.HGroups.AddDef("单位名称") g2.HGroups.AddDef("支出类型编号") g2.HGroups.AddDef("支出类型") g2.HGroups.AddDef("项目类型编号") g2.HGroups.AddDef("项目类型") g2.HGroups.AddDef("项目名称") g2.VGroups.AddDef("预算年度") g2.Totals.AddDef("财政拨款", "财政拨款") g2.Totals.AddDef("上级拨款", "上级拨款") g2.Totals.AddDef("其他收入", "其他收入") g2.Totals.AddDef("上年结余", "上年结余") g2.Filter = "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")" g2.Build() Dim g3 As New CrossTableBuilder("统计表C", DataTables("明细"),"预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")") \'g3.HGroups.AddDef("明细项目名称2") g3.HGroups.AddDef("单位编号") g3.HGroups.AddDef("单位名称") g3.HGroups.AddDef("支出类型编号") g3.HGroups.AddDef("支出类型") g3.HGroups.AddDef("项目类型编号") g3.HGroups.AddDef("项目类型") g3.HGroups.AddDef("项目名称") g3.HGroups.AddDef("明细项目名称") g3.HGroups.AddDef("经济分类编号") g3.HGroups.AddDef("经济分类") g3.VGroups.AddDef("预算年度") g3.Totals.AddDef("财政拨款", "财政拨款") g3.Totals.AddDef("上级拨款", "上级拨款") g3.Totals.AddDef("其他收入", "其他收入") g3.Totals.AddDef("上年结余", "上年结余") g3.Filter = "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")" g3.Build() \'Tables("统计表C").sort="明细项目名称2" Dim g4 As New CrossTableBuilder("统计表D", DataTables("明细"), "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")") g4.HGroups.AddDef("单位编号") g4.HGroups.AddDef("单位名称") g4.HGroups.AddDef("支出类型编号") g4.HGroups.AddDef("支出类型") g4.HGroups.AddDef("项目类型编号") g4.HGroups.AddDef("项目类型") g4.VGroups.AddDef("预算年度") g4.Totals.AddDef("财政拨款", "财政拨款") g4.Totals.AddDef("上级拨款", "上级拨款") g4.Totals.AddDef("其他收入", "其他收入") g4.Totals.AddDef("上年结余", "上年结余") g4.Totals.AddDef("支出合计", "支出合计") g4.Filter = "预算类型=\'年初预算\'and [预算年度] in ("& nd1 &","& nd2 &")" g4.Build()
Dim dt1 As DataTable = DataTables("统计表A") Dim dt2 As DataTable = DataTables("统计表B") Dim DataCols1(1) As DataCol Dim DataCols2(1) As DataCol DataCols1(0)=dt1.datacols("单位编号") DataCols1(1)=dt1.datacols("单位名称") DataCols2(0)=dt2.datacols("单位编号") DataCols2(1)=dt2.datacols("单位名称") Relations.Add("A_B", DataCols1, DataCols2) Dim dt3 As DataTable = DataTables("统计表B") Dim dt4 As DataTable = DataTables("统计表C") Dim DataCols3(3) As DataCol Dim DataCols4(3) As DataCol DataCols3(0)=dt3.datacols("单位编号") DataCols3(1)=dt3.datacols("单位名称") DataCols3(2)=dt3.datacols("项目类型编号") DataCols3(3)=dt3.datacols("项目名称") DataCols4(0)=dt4.datacols("单位编号") DataCols4(1)=dt4.datacols("单位名称") DataCols4(2)=dt4.datacols("项目类型编号") DataCols4(3)=dt4.datacols("项目名称") Relations.Add("B_C", DataCols3, DataCols4) Dim dt5 As DataTable = DataTables("统计表A") Dim dt6 As DataTable = DataTables("统计表C") Dim DataCols5(1) As DataCol Dim DataCols6(1) As DataCol DataCols5(0)=dt5.datacols("单位编号") DataCols5(1)=dt5.datacols("单位名称") DataCols6(0)=dt6.datacols("单位编号") DataCols6(1)=dt6.datacols("单位名称") Relations.Add("A_C", DataCols5, DataCols6)
Dim dt7 As DataTable = DataTables("统计表A") Dim dt8 As DataTable = DataTables("统计表D") Dim DataCols7(1) As DataCol Dim DataCols8(1) As DataCol DataCols7(0)=dt7.datacols("单位编号") DataCols7(1)=dt7.datacols("单位名称") DataCols8(0)=dt8.datacols("单位编号") DataCols8(1)=dt8.datacols("单位名称") Relations.Add("A_D", DataCols7, DataCols8)
Dim tv As WinForm.TreeView tv =e.Form.Controls("TreeView1") tv.BuildTree("统计表A", "单位名称", "", "单位编号") tv.Nodes.Insert("所有单位",0)
|