Feat: Impmlement invoice pdf rendering
This commit is contained in:
@@ -8,10 +8,12 @@ class ContractRenderer extends AbstractPdfRenderer
|
||||
{
|
||||
public function render(Disposition $disposition): Pdf
|
||||
{
|
||||
$teamer = $disposition->getTeamer();
|
||||
|
||||
$pdf = new Pdf();
|
||||
|
||||
$pdf->SetAuthor('Continentale', true);
|
||||
$pdf->SetCreator('Continentale', true);
|
||||
$pdf->SetAuthor($teamer->getFullName(), true);
|
||||
$pdf->SetCreator($teamer->getFullName(), true);
|
||||
|
||||
// Load template
|
||||
$pdfTemplate = sprintf('%s/assets/pdf/contract.pdf', $this->config['project_dir']);
|
||||
@@ -20,7 +22,6 @@ class ContractRenderer extends AbstractPdfRenderer
|
||||
|
||||
$pdf->SetFont('Arial', '', 10);
|
||||
|
||||
$teamer = $disposition->getTeamer();
|
||||
$assignment = $disposition->getAssignment();
|
||||
$destination = $assignment->getDestination();
|
||||
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service\Pdf;
|
||||
|
||||
use App\Entity\Disposition;
|
||||
|
||||
class InvoiceRenderer extends AbstractPdfRenderer
|
||||
{
|
||||
public function render(Disposition $disposition): Pdf
|
||||
{
|
||||
$teamer = $disposition->getTeamer();
|
||||
|
||||
$pdf = new Pdf();
|
||||
|
||||
$pdf->SetAuthor($teamer->getFullName(), true);
|
||||
$pdf->SetCreator($teamer->getFullName(), true);
|
||||
|
||||
// Load template
|
||||
$pdfTemplate = sprintf('%s/assets/pdf/invoice.pdf', $this->config['project_dir']);
|
||||
$pdf->appendPdf($pdfTemplate);
|
||||
$pdf->setPage(1);
|
||||
|
||||
$pdf->SetFont('Arial', '', 10);
|
||||
|
||||
$assignment = $disposition->getAssignment();
|
||||
|
||||
// Name
|
||||
$pdf->Text(135,28.5, utf8_decode($teamer->getFullName()));
|
||||
|
||||
// Address
|
||||
$address = $teamer->getAddress();
|
||||
$pdf->Text(135,39, utf8_decode($address->getStreet()));
|
||||
$pdf->Text(135,51, utf8_decode($address->getPostCode(). ' '.$address->getCity()));
|
||||
|
||||
// Tax ID
|
||||
$pdf->Text(144,62, utf8_decode($teamer->getTaxId()));
|
||||
|
||||
// Invoice number
|
||||
$pdf->SetFont('Arial', '', 12);
|
||||
$number = $assignment->getTotalPeriod()->start->format('d/m/Y');
|
||||
$pdf->Text(85,116, $number);
|
||||
|
||||
$pdf->SetFont('Arial', '', 10);
|
||||
|
||||
// Bank account
|
||||
$bankAccount = $teamer->getBankAccount();
|
||||
$pdf->Text(36,233.5, utf8_decode($bankAccount->getIban()));
|
||||
$pdf->Text(36,241, utf8_decode($bankAccount->getBic()));
|
||||
$pdf->Text(36,248.5, utf8_decode($bankAccount->getBank()));
|
||||
|
||||
|
||||
// Current date
|
||||
$date = (new \DateTimeImmutable())->format('d.m.Y');
|
||||
$pdf->Text(38,264, utf8_decode($date));
|
||||
|
||||
return $pdf;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user