- // Print a regular row.
- if ($cur_date != $prev_date)
- $row_style = ($row_style == $rowItem) ? $rowItemAlt : $rowItem;
- $body .= '<tr style="'.$row_style.'">';
- $body .= '<td style="'.$cellLeftAligned.'">'.$record['date'].'</td>';
- if ($canViewReports || $isClient)
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['user']).'</td>';
- if ($bean->getAttribute('chclient'))
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['client']).'</td>';
- if ($bean->getAttribute('chproject'))
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['project']).'</td>';
- if ($bean->getAttribute('chtask'))
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['task']).'</td>';
- if ($bean->getAttribute('chcf_1'))
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['cf_1']).'</td>';
- if ($bean->getAttribute('chstart'))
- $body .= '<td nowrap style="'.$cellRightAligned.'">'.$record['start'].'</td>';
- if ($bean->getAttribute('chfinish'))
- $body .= '<td nowrap style="'.$cellRightAligned.'">'.$record['finish'].'</td>';
- if ($bean->getAttribute('chduration'))
- $body .= '<td style="'.$cellRightAligned.'">'.$record['duration'].'</td>';
- if ($bean->getAttribute('chunits'))
- $body .= '<td style="'.$cellRightAligned.'">'.$record['units'].'</td>';
- if ($bean->getAttribute('chnote'))
- $body .= '<td style="'.$cellLeftAligned.'">'.htmlspecialchars($record['note']).'</td>';
- if ($bean->getAttribute('chcost'))
- $body .= '<td style="'.$cellRightAligned.'">'.$record['cost'].'</td>';
- if ($bean->getAttribute('chpaid')) {
- $body .= '<td style="'.$cellRightAligned.'">';
- $body .= $record['paid'] == 1 ? $i18n->get('label.yes') : $i18n->get('label.no');
- $body .= '</td>';
- }
- if ($bean->getAttribute('chip')) {
- $body .= '<td style="'.$cellRightAligned.'">';
- $body .= $record['modified'] ? $record['modified_ip'].' '.$record['modified'] : $record['created_ip'].' '.$record['created'];
- $body .= '</td>';
- }
- if ($bean->getAttribute('chinvoice'))
- $body .= '<td style="'.$cellRightAligned.'">'.htmlspecialchars($record['invoice']).'</td>';
- $body .= '</tr>';
-
- $prev_date = $record['date'];
- if ($print_subtotals)
- $prev_grouped_by = $record['grouped_by'];
- }
- }
-
- // Print a terminating subtotal.
- if ($print_subtotals) {
- $body .= '<tr style="'.$rowSubtotal.'">';
- $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.$i18n->get('label.subtotal').'</td>';
- $subtotal_name = htmlspecialchars($subtotals[$cur_grouped_by]['name']);
- if ($canViewReports || $isClient) $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.($group_by == 'user' ? $subtotal_name : '').'</td>';
- if ($bean->getAttribute('chclient')) $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.($group_by == 'client' ? $subtotal_name : '').'</td>';
- if ($bean->getAttribute('chproject')) $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.($group_by == 'project' ? $subtotal_name : '').'</td>';
- if ($bean->getAttribute('chtask')) $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.($group_by == 'task' ? $subtotal_name : '').'</td>';
- if ($bean->getAttribute('chcf_1')) $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.($group_by == 'cf_1' ? $subtotal_name : '').'</td>';
- if ($bean->getAttribute('chstart')) $body .= '<td></td>';
- if ($bean->getAttribute('chfinish')) $body .= '<td></td>';
- if ($bean->getAttribute('chduration')) $body .= '<td style="'.$cellRightAlignedSubtotal.'">'.$subtotals[$cur_grouped_by]['time'].'</td>';
- if ($bean->getAttribute('chunits')) $body .= '<td style="'.$cellRightAlignedSubtotal.'">'.$subtotals[$cur_grouped_by]['units'].'</td>';
- if ($bean->getAttribute('chnote')) $body .= '<td></td>';
- if ($bean->getAttribute('chcost')) {
- $body .= '<td style="'.$cellRightAlignedSubtotal.'">';
- $body .= ($canViewReports || $isClient) ? $subtotals[$cur_grouped_by]['cost'] : $subtotals[$cur_grouped_by]['expenses'];
- $body .= '</td>';
- }
- if ($bean->getAttribute('chpaid')) $body .= '<td></td>';
- if ($bean->getAttribute('chip')) $body .= '<td></td>';
- if ($bean->getAttribute('chinvoice')) $body .= '<td></td>';
- $body .= '</tr>';
- }
-
- // Print totals.
- $body .= '<tr><td> </td></tr>';
- $body .= '<tr style="'.$rowSubtotal.'">';
- $body .= '<td style="'.$cellLeftAlignedSubtotal.'">'.$i18n->get('label.total').'</td>';
- if ($canViewReports || $isClient) $body .= '<td></td>';
- if ($bean->getAttribute('chclient')) $body .= '<td></td>';
- if ($bean->getAttribute('chproject')) $body .= '<td></td>';
- if ($bean->getAttribute('chtask')) $body .= '<td></td>';
- if ($bean->getAttribute('chcf_1')) $body .= '<td></td>';
- if ($bean->getAttribute('chstart')) $body .= '<td></td>';
- if ($bean->getAttribute('chfinish')) $body .= '<td></td>';
- if ($bean->getAttribute('chduration')) $body .= '<td style="'.$cellRightAlignedSubtotal.'">'.$totals['time'].'</td>';
- if ($bean->getAttribute('chunits')) $body .= '<td style="'.$cellRightAlignedSubtotal.'">'.$totals['units'].'</td>';
- if ($bean->getAttribute('chnote')) $body .= '<td></td>';
- if ($bean->getAttribute('chcost')) {
- $body .= '<td nowrap style="'.$cellRightAlignedSubtotal.'">'.htmlspecialchars($user->currency).' ';
- $body .= ($canViewReports || $isClient) ? $totals['cost'] : $totals['expenses'];
- $body .= '</td>';
- }
- if ($bean->getAttribute('chpaid')) $body .= '<td></td>';
- if ($bean->getAttribute('chip')) $body .= '<td></td>';
- if ($bean->getAttribute('chinvoice')) $body .= '<td></td>';
- $body .= '</tr>';
-
- $body .= '</table>';