From 70aed1fbe00efa2be7718aac5d9658b89af78e8d Mon Sep 17 00:00:00 2001 From: Tolotsoa Date: Tue, 26 Aug 2025 21:10:48 +0300 Subject: [PATCH] feat add Montant HT on facture --- .../InvoiceGroupPdfHandler.php | 25 ++++++++++------- gestion/lib/Service/InvoicePdfHandler.php | 27 ++++++++++--------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index 1fdc287..3e1baac 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -312,13 +312,14 @@ class InvoiceGroupPdfHandler extends FPDF $this->Line(27 + $additionalMargRight, $this->startingYOfArticlesTable, 27 + $additionalMargRight, $endingLine); if ($this->hasTva) { - // Avec TVA : 3 colonnes de prix (Date | Description | HT | TVA | TTC) + // Avec TVA : 3 colonnes de prix $this->Line(142 + $additionalMargRight, $this->startingYOfArticlesTable, 142 + $additionalMargRight, $endingLine); $this->Line(164 + $additionalMargRight, $this->startingYOfArticlesTable, 164 + $additionalMargRight, $endingLine); $this->Line(182 + $additionalMargRight, $this->startingYOfArticlesTable, 182 + $additionalMargRight, $endingLine); } else { - // Sans TVA : 2 colonnes seulement (Date | Description | HT) - $this->Line(165 + $additionalMargRight, $this->startingYOfArticlesTable, 165 + $additionalMargRight, $endingLine); + // Sans TVA : 2 colonnes - garder la ligne séparatrice Description/Prix HT + $this->Line(142 + $additionalMargRight, $this->startingYOfArticlesTable, 142 + $additionalMargRight, $endingLine); + $this->Line(182 + $additionalMargRight, $this->startingYOfArticlesTable, 182 + $additionalMargRight, $endingLine); } } @@ -336,17 +337,19 @@ class InvoiceGroupPdfHandler extends FPDF $this->Cell(100, 10, "Description", 0, 0, 'C'); if ($this->hasTva) { - // Avec TVA : HT | TVA | TTC - $this->SetXY(145 + $additionalMargRight, $columnNameY); // Décalé de 145 au lieu de 143 + // Avec TVA : 3 colonnes (HT | TVA | TTC) + $this->SetXY(145 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C'); $this->SetXY(163 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, 'TVA ' . $tvaValue . '%', 0, 0, 'C'); $this->SetXY(185, $columnNameY); $this->Cell(20, 10, "Prix Uni. TTC", 0, 0, 'C'); } else { - // Sans TVA : seulement HT - $this->SetXY(167, $columnNameY); // Décalé de 167 au lieu de 165 + // Sans TVA : 2 colonnes seulement (HT | Montant HT) + $this->SetXY(145 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C'); + $this->SetXY(185, $columnNameY); + $this->Cell(20, 10, "Montant HT", 0, 0, 'C'); } } @@ -417,7 +420,7 @@ class InvoiceGroupPdfHandler extends FPDF if ($this->hasTva) { // Prix HT - $this->SetXY(146, $yValue); // Décalé de 146 au lieu de 144 + $this->SetXY(146, $yValue); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); // TVA $this->SetXY(165, $yValue); @@ -426,8 +429,10 @@ class InvoiceGroupPdfHandler extends FPDF $this->SetXY(182, $yValue); $this->Cell(25, 6, number_format($valueTtc, 2, '.', '') . chr(128), 0, 1, 'C'); } else { - // Sans TVA : seulement Prix HT - $this->SetXY(167, $yValue); // Décalé de 167 au lieu de 165 + // Sans TVA : 2 colonnes (Prix HT | Montant HT) + $this->SetXY(146, $yValue); + $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); + $this->SetXY(182, $yValue); $this->Cell(25, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 1, 'C'); } diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index 4fd2adb..7846823 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -299,13 +299,13 @@ class InvoicePdfHandler extends FPDF $this->Line(27 + $additionalMargRight, $this->startingYOfArticlesTable, 27 + $additionalMargRight, $endingLine); if ($this->hasTva) { - // Avec TVA : 3 colonnes de prix (Date | Description | HT | TVA | TTC) $this->Line(142 + $additionalMargRight, $this->startingYOfArticlesTable, 142 + $additionalMargRight, $endingLine); $this->Line(164 + $additionalMargRight, $this->startingYOfArticlesTable, 164 + $additionalMargRight, $endingLine); $this->Line(182 + $additionalMargRight, $this->startingYOfArticlesTable, 182 + $additionalMargRight, $endingLine); } else { - // Sans TVA : 2 colonnes seulement (Date | Description | HT) - $this->Line(165 + $additionalMargRight, $this->startingYOfArticlesTable, 165 + $additionalMargRight, $endingLine); + // Sans TVA : garder la ligne séparatrice Description/Prix HT + $this->Line(142 + $additionalMargRight, $this->startingYOfArticlesTable, 142 + $additionalMargRight, $endingLine); + $this->Line(182 + $additionalMargRight, $this->startingYOfArticlesTable, 182 + $additionalMargRight, $endingLine); } } @@ -322,17 +322,19 @@ class InvoicePdfHandler extends FPDF $this->Cell(100, 10, "Description", 0, 0, 'C'); if ($this->hasTva) { - // Avec TVA : HT | TVA | TTC - $this->SetXY(145 + $additionalMargRight, $columnNameY); // Décalé de 145 au lieu de 143 + // Avec TVA : 3 colonnes + $this->SetXY(145 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C'); $this->SetXY(163 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, 'TVA ' . $tvaDefault . '%', 0, 0, 'C'); $this->SetXY(185, $columnNameY); $this->Cell(20, 10, "Prix Uni. TTC", 0, 0, 'C'); } else { - // Sans TVA : seulement HT - $this->SetXY(167, $columnNameY); // Décalé de 167 au lieu de 165 + // Sans TVA : 2 colonnes + $this->SetXY(145 + $additionalMargRight, $columnNameY); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C'); + $this->SetXY(185, $columnNameY); + $this->Cell(20, 10, "Montant HT", 0, 0, 'C'); } } @@ -382,18 +384,17 @@ class InvoicePdfHandler extends FPDF $this->MultiAlignCell($maxDescriptionWidth, 6, utf8_decode(html_entity_decode($productDescription)), 0, '0', ); if ($this->hasTva) { - // Prix HT - $this->SetXY(146, $yValue); // Décalé de 146 au lieu de 144 + $this->SetXY(146, $yValue); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); - // TVA $this->SetXY(165, $yValue); $this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C'); - // Prix TTC $this->SetXY(182, $yValue); $this->Cell(25, 6, number_format($valueTtc, 2, '.', '') . chr(128), 0, 1, 'C'); } else { - // Sans TVA : seulement Prix HT - $this->SetXY(167, $yValue); // Décalé de 167 au lieu de 165 + // Sans TVA : 2 colonnes + $this->SetXY(146, $yValue); + $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); + $this->SetXY(182, $yValue); $this->Cell(25, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 1, 'C'); }