以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- SQLGroupTableBuilder 多表统计 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=61069) |
-- 作者:石四 -- 发布时间:2014/12/6 13:30:00 -- SQLGroupTableBuilder 多表统计 两个表 部门考勤和调休表,单独统计都行得通:
Dim Filter As String Dim curD As Date = #9/30/2014# Dim lastD As Date = curD.AddMonths(-1) \'上一个月的日期 Dim lastD2 As New Date(lastD.Year, lastD.Month, Date.DaysInMonth(lastD.Year,lastD.Month)) \'上个月的最后一天 Filter = Filter & "考勤日期 > #" & lastD2 & "#" & " And 考勤日期 <= #" & curD & "#"
Dim b As New SQLGroupTableBuilder("统计表1","部门考勤") b.C B.Groups.AddDef("{部门考勤}.考勤日期",DateGroupEnum.Year,"年") \' b.Groups.AddDef("{部门考勤}.考勤日期","月") \' b.Groups.AddDef("{部门考勤}.部门") \' b.Groups.AddDef("姓名") b.Totals.AddDef("出勤") b.Filter = Filter b.Build
Dim Filter As String Dim curD As Date = #9/30/2014# Dim lastD As Date = curD.AddMonths(-1) \'上一个月的日期 Dim lastD2 As New Date(lastD.Year, lastD.Month, Date.DaysInMonth(lastD.Year,lastD.Month)) \'上个月的最后一天 Filter = Filter & "考勤日期 > #" & lastD2 & "#" & " And 考勤日期 <= #" & curD & "#"
Dim b As New SQLGroupTableBuilder("统计表1","调休表") b.C B.Groups.AddDef("{调休表}.考勤日期",DateGroupEnum.Year,"年") \' b.Groups.AddDef("{调休表}.考勤日期","月") \' b.Groups.AddDef("{调休表}.部门") \' b.Groups.AddDef("姓名") b.Totals.AddDef("调休结余") b.Filter = Filter b.Build |
-- 作者:石四 -- 发布时间:2014/12/6 13:32:00 -- 组合起来统计就不行,是什么原因?
Dim Filter As String Dim curD As Date = #9/30/2014# Dim lastD As Date = curD.AddMonths(-1) \'上一个月的日期 Dim lastD2 As New Date(lastD.Year, lastD.Month, Date.DaysInMonth(lastD.Year,lastD.Month)) \'上个月的最后一天 Filter = Filter & "考勤日期 > #" & lastD2 & "#" & " And 考勤日期 <= #" & curD & "#" Dim b As New SQLGroupTableBuilder("统计表1","部门考勤") B.AddTable("部门考勤","人员编号","调休表","人员编号") \'添加统计表 b.C B.Groups.AddDef("{部门考勤}.考勤日期",DateGroupEnum.Year,"年") \' b.Groups.AddDef("{部门考勤}.考勤日期","月") b.Groups.AddDef("{部门考勤}.部门") \' b.Groups.AddDef("{部门考勤}.姓名") b.Totals.AddDef("出勤") b.Totals.AddDef("调休结余") b.Filter = Filter b.Build |