以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 分组统计问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=146525) |
-- 作者:裴保民 -- 发布时间:2020/2/25 17:50:00 -- 分组统计问题 Dim flb As WinForm.RadioButton = e.Form.Controls("flRadioButton") Dim fltab As WinForm.TabControl = e.Form.Controls("flymTabContro") Dim aszlx As WinForm.RadioButton = e.Form.Controls("asjdcxRadioButton") Dim g As New GroupTableBuilder("统计表1", DataTables("收支交易流水")) If aszlx.Checked=True Then g.Groups.AddDef("所属账户","账户名称") g.Totals.AddDef("单号", AggregateEnum.Count,"笔数") g.Totals.AddDef("收入金额","金额") g.Totals.AddDef("收入金额", AggregateEnum.Average, "每笔平均金额") g.Filter = "[交易类型] =\'收入\'" g.Build() MainTable = Tables("统计表1") Tables("收入明细窗体_srTable").DataSource = DataTables("统计表1") Tables("收入明细窗体_srTable").SetColVisibleWidth("账户名称|200|笔数|160|金额|300|每笔平均金额|300") For Each c As Col In Tables("收入明细窗体_srTable").Cols c.TextAlign = TextAlignEnum.Center Next End If 这样是统计整个表的数据,这样统计某 一时间段内的数据呀?假如只统计本年内的数据怎么写呢?
[此贴子已经被作者于2020/2/25 17:51:16编辑过]
|
-- 作者:sloyy -- 发布时间:2020/2/25 19:48:00 -- Dim g As New GroupTableBuilder("统计表1", DataTables("收支交易流水")) g.filter="[日期] >=\'2020-01-01 And [日期]<= \'2020-12-31\'" If aszlx.Checked=True Then ..... |
-- 作者:有点蓝 -- 发布时间:2020/2/25 20:19:00 -- Dim y As Integer = date.today.year \'指定年份 g.Filter = "[交易类型] =\'收入\' and [日期] >=\'" & dt1 & "\' And [日期]< \'" & dt1.addyears(1) & "\'"
Dim dt1 As New Date(y, 1, 1) |