3 * FusionForge Reporting System
5 * Copyright 2003-2004 (c) GForge LLC, Tim Perdue
6 * Copyright 2010 (c), FusionForge Team
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('../env.inc.php');
25 require_once $gfcommon.'include/pre.php';
26 require_once $gfcommon.'reporting/report_utils.php';
27 require_once $gfcommon.'reporting/Report.class.php';
29 session_require_global_perm ('forge_stats', 'read') ;
32 if ($report->isError()) {
33 exit_error($report->getErrorMessage());
36 $start = getIntFromRequest('start');
37 $end = getIntFromRequest('end');
38 $tstat = getStringFromRequest('tstat');
40 if (!$start || !$end) $z =& $report->getWeekStartArr();
45 $end = $z[count($z)-1];
47 if ($end < $start) list($start, $end) = array($end, $start);
61 report_header(_('User Summary Report'));
64 <?php echo _('Choose the range from the pop-up boxes below. The report will list all tasks with an open date in that range.'); ?>
66 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="get">
69 <td><strong><?php echo _('Start'); ?>:</strong><br /><?php echo report_weeks_box($report, 'start', $start); ?></td>
70 <td><strong><?php echo _('End'); ?>:</strong><br /><?php echo report_weeks_box($report, 'end', $end); ?></td>
71 <td><strong><?php echo _('Task Status'); ?>:</strong><br /><?php echo html_build_select_box_from_arrays($l,$n,'tstat',$tstat,false); ?></td>
72 <td><input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" /></td>
79 $res = db_query_params ('SELECT users.realname,users.user_id,users.user_name, ps.status_name, pgl.group_id, pt.group_project_id, pt.summary, pt.hours, pt.end_date, pt.project_task_id, pt.hours, sum(rtt.hours) AS remaining_hrs,
80 (select sum(hours) from rep_time_tracking
81 WHERE user_id=users.user_id
82 AND project_task_id=pt.project_task_id
83 AND report_date BETWEEN $1 AND $2) AS cumulative_hrs
84 FROM users, project_assigned_to pat, project_status ps, project_group_list pgl, project_task pt
85 LEFT JOIN rep_time_tracking rtt USING (project_task_id)
86 WHERE users.user_id=pat.assigned_to_id
87 AND pgl.group_project_id=pt.group_project_id
88 AND pat.project_task_id=pt.project_task_id
89 AND pt.status_id=ps.status_id
90 AND pt.status_id = ANY ($3)
91 AND pt.start_date BETWEEN $1 AND $2
92 GROUP BY realname, users.user_id, user_name, status_name, pgl.group_id, pt.group_project_id,
93 summary, pt.hours, end_date, pt.project_task_id, pt.hours',
96 db_int_array_to_any_clause (explode(',',$tstat))));
97 if (!$res || db_numrows($res) < 1) {
98 echo '<p class="feedback">' . _('No matches found').db_error() . '</p>';
100 $tableHeaders = array(
108 echo $HTML->listTableTop($tableHeaders);
110 for ($i=0; $i<db_numrows($res); $i++) {
111 $name=db_result($res,$i,'realname');
112 if ($last_name != $name) {
114 <tr '.$HTML->boxGetAltRowStyle(0).'>
115 <td colspan="6"><strong>'.$name.'</strong></td>
120 <tr '.$HTML->boxGetAltRowStyle(1).'>
122 <td>'.util_make_link ('/pm/task.php?func=detailtask&group_id='.db_result($res,$i,'group_id') .'&project_task_id='.db_result($res,$i,'project_task_id') .'&group_project_id='.db_result($res,$i,'group_project_id'),db_result($res,$i,'summary')) .'
124 <td>'.db_result($res,$i,'status_name').'</td>
125 <td>'.number_format(db_result($res,$i,'cumulative_hrs'),1).'</td>
126 <td>'.number_format((db_result($res,$i,'hours')-db_result($res,$i,'remaining_hrs')),1).'</td>
127 <td>'.date(_('Y-m-d H:i'),db_result($res,$i,'end_date')).'</td>
130 $task=db_result($res,$i,'project_task_id');
132 $res2 = db_query_params ('SELECT g.group_name, g.group_id, agl.group_artifact_id, agl.name, a.artifact_id, a.summary
133 FROM project_task_artifact pta, artifact a, artifact_group_list agl, groups g
134 WHERE pta.project_task_id=$1
135 AND pta.artifact_id=a.artifact_id
136 AND a.group_artifact_id=agl.group_artifact_id
137 AND agl.group_id=g.group_id',
140 if (!$res2 || db_numrows($res2) < 1) {
143 for ($j=0; $j<db_numrows($res2); $j++) {
144 $tracker=db_result($res2,$j,'group_name'). '*' .db_result($res2,$j,'name');
146 <tr '.$HTML->boxGetAltRowStyle(1).'>
147 <td colspan="3"> </td>
149 if ($last_tracker != $tracker) {
150 $last_tracker = $tracker;
157 <td colspan="2">'.util_make_link ('/tracker/?func=detail&atid='.db_result($res2,$j,'group_artifact_id'). '&group_id='.db_result($res2,$j,'group_id'). '&aid='.db_result($res2,$j,'artifact_id'), db_result($res2,$j,'summary')).'
165 echo $HTML->listTableBottom();
173 // c-file-style: "bsd"