From f4f9d715ffe140b2aa5f84d4f5a12898c8f23217 Mon Sep 17 00:00:00 2001 From: Boris Trivic Date: Wed, 23 Nov 2016 10:29:51 +0100 Subject: [PATCH] Added user selection on the report page. Added entry date in the report so we can compare it to 'expositure' date. --- TimeTracking/core/timetracking_api.php | 7 ++- TimeTracking/pages/show_report.php | 64 ++++++++++++++++++++++---- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/TimeTracking/core/timetracking_api.php b/TimeTracking/core/timetracking_api.php index 1c3893c..c121181 100644 --- a/TimeTracking/core/timetracking_api.php +++ b/TimeTracking/core/timetracking_api.php @@ -42,8 +42,13 @@ function plugin_TimeTracking_stats_get_project_array( $p_project_id, $p_from, $p $t_user_where = ''; } +// BT 2015-07-18 +if(isset($_POST['user_id']) && $_POST['user_id'] > 0) { + $t_user_where = " AND user = " . intval($_POST['user_id']) . " "; +} + $t_results = array(); -$query = "SELECT u.username, p.name as project_name, bug_id, expenditure_date, hours, timestamp, info +$query = "SELECT u.username, p.id as project_id, p.name as project_name, bug_id, expenditure_date, hours, timestamp, info FROM $t_timereport_table tr, $t_bug_table b, $t_user_table u, $t_project_table p WHERE tr.bug_id=b.id and tr.user=u.id AND p.id = b.project_id $t_project_where $t_from_where $t_to_where $t_user_where diff --git a/TimeTracking/pages/show_report.php b/TimeTracking/pages/show_report.php index e34016f..ad3738c 100644 --- a/TimeTracking/pages/show_report.php +++ b/TimeTracking/pages/show_report.php @@ -51,6 +51,31 @@ ?> + + + + + + + Select user: + + + + + + Entry date + @@ -107,17 +135,20 @@ $t_user_summary = array(); $t_project_summary = array(); $t_bug_summary = array(); +//echo '
'.print_r($t_plugin_TimeTracking_stats,1).'
'; + # Initialize the user summary array foreach ( $t_plugin_TimeTracking_stats as $t_item ) { -$t_user_summary[$t_item['username']] = 0; -$t_project_summary[$t_item['project_name']] = 0; -$t_bug_summary[$t_item['bug_id']] = 0; + $t_user_summary[$t_item['username']] = 0; + $t_project_summary[$t_item['project_name']] = 0; + $t_bug_summary[$t_item['bug_id']] = 0; } + foreach ( $t_plugin_TimeTracking_stats as $t_key => $t_item ) { -$t_sum_in_hours += $t_item['hours']; -$t_user_summary[$t_item['username']] += $t_item['hours']; -$t_project_summary[$t_item['project_name']] += $t_item['hours']; -$t_bug_summary[$t_item['bug_id']] += $t_item['hours']; + $t_sum_in_hours += $t_item['hours']; + $t_user_summary[$t_item['username']] += $t_item['hours']; + $t_project_summary[$t_item['project_name']] += $t_item['hours']; + $t_bug_summary[$t_item['bug_id']] += $t_item['hours']; ?> > @@ -126,6 +157,9 @@ + + + @@ -139,12 +173,16 @@ > - + - + + + + () - + + @@ -208,7 +246,13 @@ $t_bug_value ) { ?> > +() +*/ ?> + + ()