X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=topdf.php;h=f0fdb6023483437e1997652820bd8a9ce6c381db;hb=30e08b05e01bb089836582b5b467727dba822a13;hp=d017299b7ccb5f424afd6ae3f886576518e688a4;hpb=05b0f8e4762b8a2ca2002a8f7545b7ff68cc3925;p=timetracker.git
diff --git a/topdf.php b/topdf.php
index d017299b..f0fdb602 100644
--- a/topdf.php
+++ b/topdf.php
@@ -87,6 +87,9 @@ if ($items && 'no_grouping' != $group_by) {
$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;"';
@@ -156,6 +159,7 @@ if ($totals_only) {
if ($bean->getAttribute('chduration')) { $colspan++; $html .= "
".$i18n->getKey('label.duration').' | '; }
if ($bean->getAttribute('chnote')) { $colspan++; $html .= ''.$i18n->getKey('label.note').' | '; }
if ($bean->getAttribute('chcost')) { $colspan++; $html .= "".$i18n->getKey('label.cost').' | '; }
+ if ($bean->getAttribute('chpaid')) { $colspan++; $html .= "".$i18n->getKey('label.paid').' | '; }
if ($bean->getAttribute('chinvoice')) { $colspan++; $html .= ''.$i18n->getKey('label.invoice').' | '; }
$html .= '';
$html .= '';
@@ -205,6 +209,7 @@ if ($totals_only) {
$html .= $subtotals[$prev_grouped_by]['expenses'];
$html .= '';
}
+ if ($bean->getAttribute('chpaid')) $html .= ' | ';
if ($bean->getAttribute('chinvoice')) $html .= ' | ';
$html .= '';
$html .= ' |
';
@@ -232,6 +237,11 @@ if ($totals_only) {
$html .= $item['expense'];
$html .= '';
}
+ if ($bean->getAttribute('chpaid')) {
+ $html .= '';
+ $html .= $item['paid'] == 1 ? $i18n->getKey('label.yes') : $i18n->getKey('label.no');
+ $html .= ' | ';
+ }
if ($bean->getAttribute('chinvoice')) $html .= ''.htmlspecialchars($item['invoice']).' | ';
$html .= '';
@@ -280,6 +290,7 @@ if ($totals_only) {
$html .= $subtotals[$prev_grouped_by]['expenses'];
$html .= '';
}
+ if ($bean->getAttribute('chpaid')) $html .= ' | ';
if ($bean->getAttribute('chinvoice')) $html .= ' | ';
$html .= '';
}
@@ -305,6 +316,7 @@ if ($totals_only) {
$html .= $totals['expenses'];
$html .= '';
}
+ if ($bean->getAttribute('chpaid')) $html .= ' | ';
if ($bean->getAttribute('chinvoice')) $html .= ' | ';
$html .= '';
$html .= '';
@@ -327,7 +339,7 @@ header('Cache-Control: post-check=0, pre-check=0', false);
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.
@@ -404,6 +416,6 @@ $pdf->writeHTML($html, true, false, false, false, '');
// 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.