added pdf template and other invoice improvements (#1693)

This commit is contained in:
Kevin Papst
2020-05-10 16:19:59 +02:00
committed by GitHub
parent 4e1ffedc20
commit e3749c8e8f
45 changed files with 561 additions and 89 deletions

View File

@@ -75,7 +75,7 @@ class InvoiceItemDefaultHydrator implements InvoiceItemHydrator
'entry.currency' => $currency,
'entry.duration' => $item->getDuration(),
'entry.duration_decimal' => $formatter->getFormattedDecimalDuration($item->getDuration()),
'entry.duration_minutes' => number_format($item->getDuration() / 60),
'entry.duration_minutes' => (int) ($item->getDuration() / 60),
'entry.begin' => $formatter->getFormattedDateTime($begin),
'entry.begin_time' => $formatter->getFormattedTime($begin),
'entry.begin_timestamp' => $begin->getTimestamp(),

View File

@@ -57,7 +57,7 @@ class InvoiceModelProjectHydrator implements InvoiceModelHydrator
$prefix . 'budget_money_plain' => $project->getBudget(),
$prefix . 'budget_time' => $project->getTimeBudget(),
$prefix . 'budget_time_decimal' => $formatter->getFormattedDecimalDuration($project->getTimeBudget()),
$prefix . 'budget_time_minutes' => number_format($project->getTimeBudget() / 60),
$prefix . 'budget_time_minutes' => (int) ($project->getTimeBudget() / 60),
];
foreach ($project->getVisibleMetaFields() as $metaField) {

View File

@@ -45,7 +45,14 @@ final class PdfRenderer implements RendererInterface
$content = $this->twig->render('@invoice/' . basename($document->getFilename()), [
'model' => $model
]);
$content = $this->converter->convertToPdf($content);
$content = $this->converter->convertToPdf($content, [
'setAutoTopMargin' => 'pad',
'setAutoBottomMargin' => 'pad',
'margin_top' => 12,
'margin_bottom' => 8,
]);
$filename = (string) new InvoiceFilename($model);
$response = new Response($content);