X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=topdf.php;h=0040c7be926bb504c9d9a1d9393f9e14eacb55a3;hb=3be2bc61911ea52fb39774f7e569f7f9f2552b58;hp=eb09bc45217a384ef57181f29da03a7b42668817;hpb=047bc803a5228a0a786462cabdfa5fdd9be762a4;p=timetracker.git diff --git a/topdf.php b/topdf.php index eb09bc45..0040c7be 100644 --- a/topdf.php +++ b/topdf.php @@ -62,26 +62,16 @@ $bean = new ActionForm('reportBean', new Form('reportForm'), $request); // is grouped by either date, user, client, project, task or cf_1 and user only needs to see subtotals by group. $totals_only = ($bean->getAttribute('chtotalsonly') == '1'); -// Determine group by header. -$group_by = $bean->getAttribute('group_by'); -if ('no_grouping' != $group_by) { - if ('cf_1' == $group_by) - $group_by_header = $custom_fields->fields[0]['label']; - else { - $key = 'label.'.$group_by; - $group_by_header = $i18n->get($key); - } -} - // Obtain items for report. +$options = ttReportHelper::getReportOptions($bean); if (!$totals_only) - $items = ttReportHelper::getItems($bean); // Individual entries. -if ($totals_only || 'no_grouping' != $group_by) - $subtotals = ttReportHelper::getSubtotals($bean); // Subtotals for groups of items. -$totals = ttReportHelper::getTotals($bean); // Totals for the entire report. + $items = ttReportHelper::getItems($options); // Individual entries. +if ($totals_only || 'no_grouping' != $group_by1) + $subtotals = ttReportHelper::getSubtotals($options); // Subtotals for groups of items. +$totals = ttReportHelper::getTotals($options); // Totals for the entire report. // Assign variables that are used to print subtotals. -if ($items && 'no_grouping' != $group_by) { +if ($items && 'no_grouping' != $group_by1) { $print_subtotals = true; $first_pass = true; $prev_grouped_by = ''; @@ -103,12 +93,14 @@ $html .= ''; if ($totals_only) { // We are building a "totals only" report with only subtotals and total. + $group_by_header = ttReportHelper::makeGroupByHeader($options); $colspan = 1; // Column span for an empty row. // Table header. $html .= ''; $html .= ""; $html .= ''; if ($bean->getAttribute('chduration')) { $colspan++; $html .= "'; } + if ($bean->getAttribute('chunits')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chcost')) { $colspan++; $html .= "'; } $html .= ''; $html .= ''; @@ -117,6 +109,7 @@ if ($totals_only) { $html .= ''; $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chcost')) { $html .= ""; $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chcost')) { $html .= "'; } if ($bean->getAttribute('chfinish')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chduration')) { $colspan++; $html .= "'; } + if ($bean->getAttribute('chunits')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chnote')) { $colspan++; $html .= ''; } if ($bean->getAttribute('chcost')) { $colspan++; $html .= "'; } if ($bean->getAttribute('chpaid')) { $colspan++; $html .= "'; } @@ -176,32 +171,33 @@ if ($totals_only) { $html .= ''; if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { $html .= ''; } if ($bean->getAttribute('chclient')) { $html .= ''; } if ($bean->getAttribute('chproject')) { $html .= ''; } if ($bean->getAttribute('chtask')) { $html .= ''; } if ($bean->getAttribute('chcf_1')) { $html .= ''; } if ($bean->getAttribute('chstart')) $html .= ''; if ($bean->getAttribute('chfinish')) $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chnote')) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; if ($bean->getAttribute('chfinish')) $html .= "'; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chnote')) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { $html .= ''; } if ($bean->getAttribute('chclient')) { $html .= ''; } if ($bean->getAttribute('chproject')) { $html .= ''; } if ($bean->getAttribute('chtask')) { $html .= ''; } if ($bean->getAttribute('chcf_1')) { $html .= ''; } if ($bean->getAttribute('chstart')) $html .= ''; if ($bean->getAttribute('chfinish')) $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chnote')) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "'; if ($bean->getAttribute('chfinish')) $html .= ''; if ($bean->getAttribute('chduration')) $html .= "'; + if ($bean->getAttribute('chunits')) $html .= "'; if ($bean->getAttribute('chnote')) $html .= ''; if ($bean->getAttribute('chcost')) { $html .= "
'.htmlspecialchars($group_by_header).'".$i18n->get('label.duration').'".$i18n->get('label.work_units_short').'".$i18n->get('label.cost').'
'.htmlspecialchars($subtotal['name']).'".$subtotal['time'].'".$subtotal['units'].'"; if ($user->can('manage_invoices') || $user->isClient()) @@ -132,6 +125,7 @@ if ($totals_only) { $html .= "
'.$i18n->get('label.total').'".$totals['time'].'".$totals['units'].'"; $html .= htmlspecialchars($user->currency).' '; @@ -158,6 +152,7 @@ if ($totals_only) { if ($bean->getAttribute('chstart')) { $colspan++; $html .= "".$i18n->get('label.start').'".$i18n->get('label.finish').'".$i18n->get('label.duration').'".$i18n->get('label.work_units_short').''.$i18n->get('label.note').'".$i18n->get('label.cost').'".$i18n->get('label.paid').''.$i18n->get('label.subtotal').''; - if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'client') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'client') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'project') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'project') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'task') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'task') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'cf_1') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'cf_1') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= '".$subtotals[$prev_grouped_by]['time'].'".$subtotals[$prev_grouped_by]['units'].'"; @@ -231,6 +227,7 @@ if ($totals_only) { if ($bean->getAttribute('chstart')) $html .= "".$item['start'].'".$item['finish'].'".$item['duration'].'".$item['units'].''.htmlspecialchars($item['note']).'"; @@ -263,32 +260,33 @@ if ($totals_only) { $html .= ''.$i18n->get('label.subtotal').''; - if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'client') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'client') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'project') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'project') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'task') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'task') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= ''; - if ($group_by == 'cf_1') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); + if ($group_by1 == 'cf_1') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); $html .= '".$subtotals[$prev_grouped_by]['time'].'".$subtotals[$prev_grouped_by]['units'].'"; @@ -316,6 +314,7 @@ if ($totals_only) { if ($bean->getAttribute('chstart')) $html .= '".$totals['time'].'".$totals['units'].'".htmlspecialchars($user->currency).' ';