5 * Copyright 2004 (c) GForge LLC
7 * @author Tim Perdue tim@gforge.org
10 * This file is part of GForge.
12 * GForge is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * GForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with GForge; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 require_once('../env.inc.php');
28 require_once $gfwww.'include/pre.php';
29 require_once $gfcommon.'reporting/report_utils.php';
30 require_once $gfcommon.'reporting/Report.class.php';
32 session_require( array('group'=>$sys_stats_group) );
35 if ($report->isError()) {
36 exit_error($report->getErrorMessage());
39 $start = getIntFromRequest('start');
40 $end = getIntFromRequest('end');
41 $tstat = getStringFromRequest('tstat');
43 $z =& $report->getWeekStartArr();
45 $start = $z[count($z)-1];
62 echo report_header(_('User Summary Report'));
65 <h2><?php echo _('User Summary Report'); ?></h2>
67 <?php echo _('Choose the range from the pop-up boxes below. The report will list all tasks with an open date in that range.'); ?>
69 <form action="<?php echo getStringFromServer('PHP_SELF'); ?>" method="get">
72 <td><strong><?php echo _('Start'); ?>:</strong><br /><?php echo report_weeks_box($report, 'start', $start); ?></td>
73 <td><strong><?php echo _('End'); ?>:</strong><br /><?php echo report_weeks_box($report, 'end', $end); ?></td>
74 <td><strong><?php echo _('Task Status'); ?>:</strong><br /><?php echo html_build_select_box_from_arrays($l,$n,'tstat',$tstat,false); ?></td>
75 <td><input type="submit" name="submit" value="<?php echo _('Refresh'); ?>" /></td>
82 $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,
83 (select sum(hours) from rep_time_tracking
84 WHERE user_id=users.user_id
85 AND project_task_id=pt.project_task_id
86 AND report_date BETWEEN $1 AND $2) AS cumulative_hrs
87 FROM users, project_assigned_to pat, project_status ps, project_group_list pgl, project_task pt
88 LEFT JOIN rep_time_tracking rtt USING (project_task_id)
89 WHERE users.user_id=pat.assigned_to_id
90 AND pgl.group_project_id=pt.group_project_id
91 AND pat.project_task_id=pt.project_task_id
92 AND pt.status_id=ps.status_id
93 AND pt.status_id = ANY ($3)
94 AND pt.start_date BETWEEN $1 AND $2
95 GROUP BY realname, users.user_id, user_name, status_name, pgl.group_id, pt.group_project_id,
96 summary, pt.hours, end_date, pt.project_task_id, pt.hours',
99 db_int_array_to_any_clause ($tstat)));
100 if (!$res || db_numrows($res) < 1) {
101 echo _('No matches found').db_error();
103 $tableHeaders = array(
111 echo $HTML->listTableTop($tableHeaders);
113 for ($i=0; $i<db_numrows($res); $i++) {
114 $name=db_result($res,$i,'realname');
115 if ($last_name != $name) {
117 <tr '.$HTML->boxGetAltRowStyle(0).'>
118 <td colspan="6"><strong>'.$name.'</strong></td>
123 <tr '.$HTML->boxGetAltRowStyle(1).'>
125 <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')) .'
127 <td>'.db_result($res,$i,'status_name').'</td>
128 <td>'.number_format(db_result($res,$i,'cumulative_hrs'),1).'</td>
129 <td>'.number_format((db_result($res,$i,'hours')-db_result($res,$i,'remaining_hrs')),1).'</td>
130 <td>'.date(_('Y-m-d H:i'),db_result($res,$i,'end_date')).'</td>
133 $task=db_result($res,$i,'project_task_id');
135 $res2 = db_query_params ('SELECT g.group_name, g.group_id, agl.group_artifact_id, agl.name, a.artifact_id, a.summary
136 FROM project_task_artifact pta, artifact a, artifact_group_list agl, groups g
137 WHERE pta.project_task_id=$1
138 AND pta.artifact_id=a.artifact_id
139 AND a.group_artifact_id=agl.group_artifact_id
140 AND agl.group_id=g.group_id',
143 if (!$res2 || db_numrows($res2) < 1) {
146 for ($j=0; $j<db_numrows($res2); $j++) {
147 $tracker=db_result($res2,$j,'group_name'). '*' .db_result($res2,$j,'name');
149 <tr '.$HTML->boxGetAltRowStyle(1).'>
150 <td colspan="3"> </td>
152 if ($last_tracker != $tracker) {
153 $last_tracker = $tracker;
160 <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')).'
168 echo $HTML->listTableBottom();
172 echo report_footer();
176 // c-file-style: "bsd"