-if ('no_grouping' != $group_by)
- $subtotals = ttReportHelper::getSubtotals($bean);
-$totals = ttReportHelper::getTotals($bean);
-
-// Assign variables that are used to print subtotals.
-if ($report_items && 'no_grouping' != $group_by) {
- $smarty->assign('print_subtotals', true);
- $smarty->assign('first_pass', true);
- $smarty->assign('group_by', $group_by);
- $smarty->assign('prev_grouped_by', '');
- $smarty->assign('cur_grouped_by', '');
-}
-// Determine group by header.
-if ('no_grouping' != $group_by) {
- if ('cf_1' == $group_by)
- $smarty->assign('group_by_header', $custom_fields->fields[0]['label']);
- else {
- $key = 'label.'.$group_by;
- $smarty->assign('group_by_header', $i18n->getKey($key));
+if (ttReportHelper::grouping($options)) {
+ $subtotals = ttReportHelper::getSubtotals($options);
+ $smarty->assign('group_by_header', ttReportHelper::makeGroupByHeader($options));
+ if ($report_items) {
+ // Assign variables that are used to print subtotals.
+ $smarty->assign('print_subtotals', true);
+ $smarty->assign('first_pass', true);
+ $smarty->assign('prev_grouped_by', '');
+ $smarty->assign('cur_grouped_by', '');