Foxtable(狐表)用户栏目专家坐堂 → SQLGroupTableBuilder 多表统计


  共有2865人关注过本帖树形打印复制链接

主题:SQLGroupTableBuilder 多表统计

帅哥哟,离线,有人找我吗?
石四
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:972 积分:7048 威望:0 精华:0 注册:2013/3/31 10:33:00
SQLGroupTableBuilder 多表统计  发帖心情 Post By:2014/12/6 13:30: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.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


 回到顶部
帅哥哟,离线,有人找我吗?
石四
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:972 积分:7048 威望:0 精华:0 注册:2013/3/31 10:33:00
  发帖心情 Post By: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


 回到顶部