From fca12c05dcd495f4d9ccec3fe75effa59d9c7b82 Mon Sep 17 00:00:00 2001 From: Tiavina Date: Fri, 3 Jan 2025 10:25:42 +0300 Subject: [PATCH] fix facture date echeance , margins, WIP nom defunt --- gestion/lib/Service/InvoicePdfHandler.php | 39 ++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index 3d1f53a..4ee99bf 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -79,13 +79,22 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod public function GetFactureContent(){ $this->AddPage(); - + $this->SetMargins(10,0,10); $factureDate = $this->factureData['date']; $factureDate = DateTime::createFromFormat('Y-m-d',$factureDate); $factureDate = $factureDate->format('d-m-Y'); $factureDatePaiement = $this->factureData['date_paiement']; $factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement); + $factureDateEcheance = $factureDatePaiement; $factureDatePaiement = $factureDatePaiement->format('d-m-Y'); + + $factureDateEcheance->modify('+30 days'); + $factureDateEcheance = $factureDateEcheance->format('d-m-Y'); + + $devisDate = $this->factureData['devis_date']; + $devisDate = DateTime::createFromFormat('Y-m-d',$devisDate); + $devisDate = $devisDate->format('d-m-Y'); + $this->SetFont('Arial', '', 12); $this->Cell(0, 7, utf8_decode(html_entity_decode($this->factureData['configuration']->entreprise)), 0, 0); $this->Cell(0, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'] . ' ' . $this->factureData['client_entreprise'])), 0, 1,'R'); @@ -101,15 +110,15 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod //facture infos $this->SetFont('Arial', 'B', 11); $this->Cell(30, 7, 'DATE', 1, 0, 'C'); - $this->Cell(70, 7, 'CLIENT', 1, 0, 'C'); + $this->Cell(80, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(40, 7, 'FACTURE', 1, 0, 'C'); $this->Cell(40, 7, 'ECHEANCE', 1, 1, 'C'); $this->SetFont('Arial', '', 10); - $this->Cell(30, 7, $factureDate, 1, 0, 'C'); - $this->Cell(70, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C'); + $this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C'); + $this->Cell(80, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C'); $this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C'); - $this->Cell(40, 7, $factureDatePaiement, 1, 1, 'C'); + $this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C'); $this->Ln(8); @@ -117,7 +126,7 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod $tvaValue = $this->factureData["configuration"]->tva_default; $this->SetFont('Arial', 'B', 11); $this->Cell(20, 8, 'Date', 1, 0); - $this->Cell(80, 8, 'Description', 1, 0,'C'); + $this->Cell(90, 8, 'Description', 1, 0,'C'); $this->Cell(30, 8, 'Prix Uni. HT', 1, 0, 'C'); $this->Cell(20, 8, 'TVA ' . $tvaValue . '%', 1, 0, 'C'); $this->Cell(30, 8, 'Prix Uni. TTC', 1, 1, 'C'); @@ -129,17 +138,17 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); $totalHt+=$valueHt; $totalTtc+=$valueTtc; - $descriptionLineNumber = $this->NbLines(80,$product["produit_description"]); + $descriptionLineNumber = $this->NbLines(90,$product["produit_description"]); $articleListMaxHeight = $descriptionLineNumber * 10; $tvaAmount = $valueTtc - $valueHt; $this->SetFont('Arial', '', 10); - $this->Cell(20, $articleListMaxHeight, $factureDate, 'LR',0); - $this->MultiAlignCell(80, $articleListMaxHeight, utf8_decode(html_entity_decode($product["produit_description"])),'LR','0',); - $this->Cell(30, $articleListMaxHeight, number_format($valueHt,2,'.',''), 'LR', 0, 'C'); - $this->Cell(20, $articleListMaxHeight, number_format($tvaAmount,2,'.',''), 'LR', 0, 'C'); - $this->Cell(30, $articleListMaxHeight, number_format($valueTtc,2,'.',''), 'LR', 1, 'C'); + $this->Cell(20, $articleListMaxHeight, $devisDate, 'LR',0); + $this->MultiAlignCell(90, $articleListMaxHeight, utf8_decode(html_entity_decode($product["produit_description"])),'LR','0',); + $this->Cell(30, $articleListMaxHeight, number_format($valueHt,2,'.','').chr(128), 'LR', 0, 'C'); + $this->Cell(20, $articleListMaxHeight, number_format($tvaAmount,2,'.','').chr(128), 'LR', 0, 'C'); + $this->Cell(30, $articleListMaxHeight, number_format($valueTtc,2,'.','').chr(128), 'LR', 1, 'C'); } - $this->Cell(180,0,'','T'); + $this->Cell(190,0,'','T'); $this->Ln(8); $this->SetFont('Arial', '', 9); $this->MultiCell(0,5,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->factureData['configuration']->entreprise))); @@ -163,7 +172,7 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod $this->Cell($totalHtArrayWidth, 7, 'TOTAL HT', 1, 1, 'C'); $this->SetXY($ibanLastPositionX,$ibanCursorY); $this->SetFont('Arial', '', 11); - $this->Cell($totalHtArrayWidth, 20, number_format($totalHt,2,'.',''), 1, 1, 'C'); + $this->Cell($totalHtArrayWidth, 20, number_format($totalHt,2,'.','').chr(128), 1, 1, 'C'); $tableHTLastPostionX = $ibanLastPositionX + $totalHtArrayWidth + 10; //TABLE TTC @@ -172,7 +181,7 @@ sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du cod $this->Cell(30, 7, 'TOTAL TTC', 1, 1, 'C'); $this->SetXY($tableHTLastPostionX,$ibanCursorY+14); $this->SetFont('Arial', '', 11); - $this->Cell(30, 7, number_format($totalTtc,2,'.',''), 1, 1, 'C'); + $this->Cell(30, 7, number_format($totalTtc,2,'.','').chr(128), 1, 1, 'C'); $pdfContent = $this->Output('','S');