feat: move cost unit from assignment to job profile

This commit is contained in:
Björn Fromme
2025-03-18 12:30:24 +01:00
parent 3d85949ade
commit 924026e9f8
9 changed files with 69 additions and 32 deletions
+12 -9
View File
@@ -22,26 +22,29 @@ class InvoiceApprover extends AbstractPdfRenderer
throw new \InvalidArgumentException('Expected PDF but got '.$invoice->getMimeType());
}
// Load template
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
if (false === file_exists($filepath)) {
throw new \InvalidArgumentException('Uploaded document not found at '.$filepath);
}
$pdf = new Pdf();
$pdf->SetAuthor($teamer->getFullName(), true);
$pdf->SetCreator($teamer->getFullName(), true);
// Load template
$filepath = sprintf('%s/uploads/invoice/%s', $this->config['project_dir'], $originalFilename);
$pdf->appendPdf($filepath);
$pdf->setPage(1);
// Cost unit
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
// Cost unit job profile
if (null !== $costUnit = $assignment->getJobProfile()->getCostUnit()) {
$pdf->SetFont('Arial', '', 11);
$pdf->Text(20,20, utf8_decode('Kostenstelle: '.$costUnit));
$pdf->Text(20,20, utf8_decode('Kostenstelle 1: '.$costUnit));
}
// Cost center
if (null !== $costCenter = $assignment->getCostCenter()) {
// Cost unit destination/hotel
if (null !== $costUnit = $assignment->getDestination()->getCostUnit()) {
$pdf->SetFont('Arial', '', 11);
$pdf->Text(20,25, utf8_decode('Kostenträger: '.$costCenter));
$pdf->Text(20,25, utf8_decode('Kostenstelle 2: '.$costUnit));
}
// Approval