diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index d65f753..aeeedaf 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -50,7 +50,7 @@ class InvoiceGroupPdfHandler extends FPDF public $thereIsOrderOrCaseNumber = false; public $startingYOfArticlesTable = 100; - public int $maxArticlePerPage = 19; + public int $maxArticlePerPage = 7; public $additionalArticlesLineBasedOnMultiline = 0; public $interLigneHeader = 5; @@ -300,7 +300,7 @@ class InvoiceGroupPdfHandler extends FPDF // les traits verticaux colonnes $additionalMargRight = 1; $endingLine = 233 + $additionnalheight; - $this->Line(27 + $additionalMargRight, $this->startingYOfArticlesTable, 27 + $additionalMargRight, $endingLine); + $this->Line( 27 + $additionalMargRight, $this->startingYOfArticlesTable, 27 + $additionalMargRight, $endingLine); $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); @@ -312,7 +312,7 @@ class InvoiceGroupPdfHandler extends FPDF $tvaValue = $this->factureData["configuration"]->tva_default; $columnNameY = $this->startingYOfArticlesTable - 1.5; $this->SetFont('ComicSans', '', 10); - $this->SetXY(12 + $additionalMargRight, $columnNameY); + $this->SetXY(35 + $additionalMargRight, $columnNameY); $this->Cell(7, 10, "Date", 0, 0, 'C'); $this->SetXY(30 + $additionalMargRight, $columnNameY); @@ -341,6 +341,7 @@ class InvoiceGroupPdfHandler extends FPDF $yValue = $this->startingYOfArticlesTable + 13; // $maxDescriptionWidth = 102; $maxDescriptionWidth = 104.3; + // $maxDescriptionWidth = 51; $currentIndexPosition = $this->currentIndexPosition; for ($currentIndexPosition; $currentIndexPosition < ($this->initialIndexPosition + $this->devisCountToGet); $currentIndexPosition++) { $currentDevis = $devisData[$currentIndexPosition]; @@ -351,21 +352,29 @@ class InvoiceGroupPdfHandler extends FPDF $productIncrement = 0; foreach ($products as $product) { + $valueHt = $product['produit_price'] * $product["quantite"]; $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue); $totalHt += $valueHt; $totalTtc += $valueTtc; $productDescription = $product["produit_description"] ?? ""; + $currentDevisDefuntName = $currentDevis["defunt_nom"] ?? ""; + $dateValue = ""; + $dateAndDefuntName = ""; if ($productIncrement == 0) { $dateValue = $devisDate; - $productDescription .= " de " . $currentDevis["defunt_nom"] ?? ""; + // $productDescription .= " de " . $currentDevis["defunt_nom"] ?? ""; + $dateAndDefuntName = $dateValue . " - " . $currentDevisDefuntName; + $this->SetXY(70, $yValue); + $this->Cell(5, 6, $currentDevisDefuntName, 0, 0); + $this->SetXY(4, $yValue + 5); + $this->Cell(5, 6, $dateValue, 0, 0); } - $tvaAmount = $valueTtc - $valueHt; - $this->SetXY(4, $yValue); - $this->Cell(5, 6, $dateValue, 0, 0); - $this->SetXY(30, $yValue); + $tvaAmount = $valueTtc - $valueHt; + + $this->SetXY(30, $yValue + 5); $productDescription = FileExportHelpers::FormatTextForExport($productDescription); $productDescriptionWidth = $this->GetStringWidth($productDescription); $productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth; @@ -383,13 +392,13 @@ class InvoiceGroupPdfHandler extends FPDF } - $this->SetXY(144, $yValue); + $this->SetXY(144, $yValue + 5); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); - $this->SetXY(165, $yValue); + $this->SetXY(165, $yValue + 5); $this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C'); - $this->SetXY(182, $yValue); + $this->SetXY(182, $yValue + 5); $this->Cell(25, 6, number_format($valueTtc, 2, '.', '') . chr(128), 0, 1, 'C'); $yValue += 6; $totalTva += $tvaAmount; @@ -398,6 +407,11 @@ class InvoiceGroupPdfHandler extends FPDF } $productIncrement++; } + $yValue += 6; + $isLastLigneDevis = $currentIndexPosition == (($this->initialIndexPosition + $this->devisCountToGet) -1); + if (!$isLastLigneDevis) { + $this->Line(3, $yValue , 207, $yValue); + } } $this->currentIndexPosition = $currentIndexPosition; $this->initialIndexPosition = $this->currentIndexPosition;