3 * FusionForge reporting system
5 * Copyright 2003-2004, Tim Perdue/GForge, LLC
6 * Copyright 2009, Roland Mas
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfcommon.'reporting/Report.class.php';
26 class ReportSiteTime extends Report {
28 function ReportSiteTime($type,$start=0,$end=0) {
32 $start=mktime(0,0,0,date('m'),1,date('Y'));;
43 if (!$type || $type=='tasks') {
44 $res = db_query_params ('SELECT pt.summary,sum(rtt.hours) AS hours
45 FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
46 WHERE pgl.group_project_id=pt.group_project_id
47 AND rtt.report_date BETWEEN $1 AND $2
48 AND rtt.project_task_id=pt.project_task_id
56 } elseif ($type=='category') {
57 $res = db_query_params ('SELECT rtc.category_name, sum(rtt.hours) AS hours
58 FROM rep_time_tracking rtt, rep_time_category rtc
59 WHERE rtt.report_date BETWEEN $1 AND $2
60 AND rtt.time_code=rtc.time_code
61 GROUP BY rtc.category_name
66 // Percentage this user spent on a specific subproject
68 } elseif ($type=='subproject') {
70 $res = db_query_params ('SELECT pgl.project_name, sum(rtt.hours) AS hours
71 FROM rep_time_tracking rtt, project_task pt, project_group_list pgl
72 WHERE rtt.report_date BETWEEN $1 AND $2
73 AND rtt.project_task_id=pt.project_task_id
74 AND pt.group_project_id=pgl.group_project_id
75 GROUP BY pgl.project_name
81 $res = db_query_params ('SELECT u.realname, sum(rtt.hours) AS hours
82 FROM users u, rep_time_tracking rtt, project_task pt, project_group_list pgl
83 WHERE rtt.report_date BETWEEN $1 AND $2
84 AND u.user_id=rtt.user_id
91 $this->start_date=$start;
94 if (!$res || db_error()) {
95 $this->setError('ReportUserAct:: '.db_error());
99 $this->labels = util_result_column_to_array($res,0);
100 $this->setData($res,1);
108 // c-file-style: "bsd"