}
// Use custom fields plugin if it is enabled.
-if (in_array('cf', explode(',', $user->plugins))) {
+if ($user->isPluginEnabled('cf')) {
require_once('plugins/CustomFields.class.php');
$custom_fields = new CustomFields($user->team_id);
}
$cur_grouped_by = '';
}
+// Build a string to use as filename for the files being downloaded.
+$filename = strtolower($i18n->getKey('title.report')).'_'.$bean->mValues['start_date'].'_'.$bean->mValues['end_date'];
+
// Start preparing HTML to build PDF from.
$styleHeader = 'style="background-color:#a6ccf7;"';
$styleSubtotal = 'style="background-color:#e0e0e0;"';
if ($bean->getAttribute('chduration')) { $colspan++; $html .= "<td $styleCentered>".$i18n->getKey('label.duration').'</td>'; }
if ($bean->getAttribute('chnote')) { $colspan++; $html .= '<td>'.$i18n->getKey('label.note').'</td>'; }
if ($bean->getAttribute('chcost')) { $colspan++; $html .= "<td $styleCentered>".$i18n->getKey('label.cost').'</td>'; }
+ if ($bean->getAttribute('chpaid')) { $colspan++; $html .= "<td $styleCentered>".$i18n->getKey('label.paid').'</td>'; }
if ($bean->getAttribute('chinvoice')) { $colspan++; $html .= '<td>'.$i18n->getKey('label.invoice').'</td>'; }
$html .= '</tr>';
$html .= '</thead>';
$html .= $subtotals[$prev_grouped_by]['expenses'];
$html .= '</td>';
}
+ if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
$html .= '</tr>';
$html .= '<tr><td colspan="'.$colspan.'"> </td></tr>';
$html .= $item['expense'];
$html .= '</td>';
}
+ if ($bean->getAttribute('chpaid')) {
+ $html .= '<td>';
+ $html .= $item['paid'] == 1 ? $i18n->getKey('label.yes') : $i18n->getKey('label.no');
+ $html .= '</td>';
+ }
if ($bean->getAttribute('chinvoice')) $html .= '<td>'.htmlspecialchars($item['invoice']).'</td>';
$html .= '</tr>';
$html .= $subtotals[$prev_grouped_by]['expenses'];
$html .= '</td>';
}
+ if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
$html .= '</tr>';
}
$html .= $totals['expenses'];
$html .= '</td>';
}
+ if ($bean->getAttribute('chpaid')) $html .= '<td></td>';
if ($bean->getAttribute('chinvoice')) $html .= '<td></td>';
$html .= '</tr>';
$html .= '</table>';
header('Cache-Control: private', false);
header('Content-Type: application/pdf');
-header('Content-Disposition: attachment; filename="timesheet.pdf"');
+header('Content-Disposition: attachment; filename="'.$filename.'.pdf"');
// Beginning of TCPDF code here.
// Close and output PDF document.
// $pdf->Output('timesheet.pdf', 'I'); // This will display inline in browser.
-$pdf->Output('timesheet.pdf', 'D'); // D is for downloads.
+$pdf->Output($filename.'.pdf', 'D'); // D is for downloads.
// End of of TCPDF code.