以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  头晕眼花,没折了  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=59868)

--  作者:石四
--  发布时间:2014/11/12 15:53:00
--  头晕眼花,没折了

Tables("部门考勤_Table3").StopRedraw
Dim Filter As String
Dim curB As String = e.Form.Controls("bm1").Value
Dim curE As Date = e.Form.Controls("日期2").Value \'结束日期
Dim curS As Date = e.Form.Controls("日期1").Value \'起始日期
Filter = Filter &  "考勤日期 >= #" & curS & "#" & " And 考勤日期  <= #" & curE & "#" & " And 部门  = #" & curB & "#"

Dim bd0 As New GroupTableBuilder("考勤机",DataTables("考勤机数据")) 

Bd0.C
Dim dt0 As fxDataSource
Bd0.Groups.AddDef("姓名") \'根据型号分组
Bd0.Totals.AddDef("实出勤d","考勤机_出勤") \'对数量进行统计
Bd0.Totals.AddDef("请假h","考勤机_请假") \'对数量进行统计
Bd0.Filter = Filter
Dt0 = bd0.BuildDataSource()

Dim bd1 As New GroupTableBuilder("部门",DataTables("部门考勤"))
Bd1. C
Dim dt1 As fxDataSource
bd1.Groups.AddDef("部门") \'根据型号分组
bd1.Groups.AddDef("姓名") \'根据型号分组
bd1.Totals.AddDef("出勤","部门考勤_出勤") \'对数量进行统计
bd1.Totals.AddDef("请假","部门考勤_请假") \'对数量进行统计
bd1.Filter = Filter
dt1 = bd1.BuildDataSource()

dt1.Combine("姓名",dt0,"姓名") \'将销售统计数据组合到进货统计数据
Tables("部门考勤_Table3").DataSource = dt1 \'将统计结果绑定到Table

 


此主题相关图片如下:捕获.png
按此在新窗口浏览图片
[此贴子已经被作者于2014-11-12 15:54:38编辑过]

--  作者:石四
--  发布时间:2014/11/12 15:56:00
--  
找不出该未知字
--  作者:有点甜
--  发布时间:2014/11/12 15:57:00
--  
Filter = Filter &  "考勤日期 >= #" & curS & "#" & " And 考勤日期  <= #" & curE & "#" & " And 部门  = #" & curB & "#"

 

改成

 

Filter = Filter &  "考勤日期 >= #" & curS & "#" & " And 考勤日期  <= #" & curE & "#" & " And 部门  = \'" & curB & "\'"


--  作者:石四
--  发布时间:2014/11/12 17:17:00
--  

OK!这里应该用SQL后台统计:

 

Tables("部门考勤_Table3").StopRedraw
Dim Filter As String
Dim curB As String = e.Form.Controls("bm1").Value
Dim curE As Date = e.Form.Controls("日期2").Value \'结束日期
Dim curS As Date = e.Form.Controls("日期1").Value \'起始日期
Filter = Filter &  "考勤日期 >= #" & curS & "#" & " And 考勤日期  <= #" & curE & "#" & " And 部门  = \'" & curB & "\'"

Dim bd0 As New SQLGroupTableBuilder("考勤机","考勤机数据")
Bd0.C
Dim dt0 As fxDataSource
Bd0.Groups.AddDef("姓名") \'根据型号分组
Bd0.Totals.AddDef("实出勤d","考勤机_出勤") \'对数量进行统计
Bd0.Totals.AddDef("请假h","考勤机_请假") \'对数量进行统计
Bd0.Filter = Filter
Dt0 = bd0.BuildDataSource()

Dim bd1 As New SQLGroupTableBuilder("部门","部门考勤")
Bd1.C
Dim dt1 As fxDataSource
bd1.Groups.AddDef("部门") \'根据型号分组
bd1.Groups.AddDef("姓名") \'根据型号分组
bd1.Totals.AddDef("出勤","部门考勤_出勤") \'对数量进行统计
bd1.Totals.AddDef("请假","部门考勤_请假") \'对数量进行统计
bd1.Filter = Filter
dt1 = bd1.BuildDataSource()

dt1.Combine("姓名",dt0,"姓名") \'将销售统计数据组合到进货统计数据
Tables("部门考勤_Table3").DataSource = dt1 \'将统计结果绑定到Table
Tables("部门考勤_Table3").ResumeRedraw

[此贴子已经被作者于2014-11-12 17:17:24编辑过]