Dim g As New GroupTableBuilder("最近几个月收支情况报表", DataTables("收支交易流水"))
g.Groups.AddDef("记账日期", "月份")
g.Totals.AddDef("收入金额")
g.Totals.AddDef("支出金额")
g.Filter = "[记账日期] >= #" & qsrq & "# And [记账日期] <= #" & jsrq & "#"
g.SubTotal = True
g.Build()''
MainTable = Tables("最近几个月收支情况报表")
Tables("公用窗体_zjjgyszqkTable").DataSource = DataTables("最近几个月收支情况报表")
With DataTables("公用窗体_zjjgyszqkTable").DataCols '用表达式列计算库存数据
.Add("收支差额",Gettype(Double), "IsNull([收入金额],0) - ISNULL([支出金额],0)")
End With
Tables("公用窗体_zjjgyszqkTable").SetColVisibleWidth("月份|100|收入金额|120|支出金额|120|收支差额|120")
Tables("公用窗体_zjjgyszqkTable").DataTable.DataCols("收入金额").SetFormat("0.00")
Tables("公用窗体_zjjgyszqkTable").DataTable.DataCols("支出金额").SetFormat("0.00")
Tables("公用窗体_zjjgyszqkTable").DataTable.DataCols("收支差额").SetFormat("0.00")
For Each c As Col In Tables("公用窗体_zjjgyszqkTable").Cols
c.TextAlign = TextAlignEnum.Center
Next
DataTables("最近几个月收支情况报表").GlobalHandler.PrepareEdit=True
t = Tables("公用窗体_zjjgyszqkTable")
t.Cols("月份").GrandTotal = True '指定要合计的列
t.Cols("收入金额").GrandTotal = True
t.Cols("支出金额").GrandTotal = True
t.Cols("收支差额").GrandTotal = True
t.Sort = "月份" '指定排序字段
t.GrandTotal = True '显示合计模式
t.Grid.Name = t.Name
AddHandler t.grid.Paint, AddressOf Grid_Paint