-if ('no_grouping' != $group_by)
- $subtotals = ttReportHelper::getSubtotals($bean, $options);
-$totals = ttReportHelper::getTotals($bean, $options);
+if (ttReportHelper::grouping($options)) {
+ $subtotals = ttReportHelper::getSubtotals($options);
+ $smarty->assign('group_by_header', ttReportHelper::makeGroupByHeader($options));
+}
+$totals = ttReportHelper::getTotals($options);
+
+// TODO: Determine if we can create a timesheet out of this report.
+// There must be only one user, and nothing assigned to existing timesheets.