fix: adjust image positioning and table height in PDF handlers

This commit is contained in:
Narindra ezway 2025-04-24 16:50:18 +03:00
parent c5ee392cb2
commit 59b9f0dede
2 changed files with 9 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class InvoiceGroupPdfHandler extends FPDF {
$height = $originalHeight * $scale; $height = $originalHeight * $scale;
// Calculer la position pour centrer l'image // Calculer la position pour centrer l'image
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm $x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
$y = ((297 - $height) / 2 ) + 19; // 297 mm est la hauteur d'une page A4 $y = ((297 - $height) / 2 ) + 21; // 297 mm est la hauteur d'une page A4
// Ajouter l'image en filigrane // Ajouter l'image en filigrane
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur $this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
@ -265,14 +265,15 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->SetLineWidth(0.2); $this->SetLineWidth(0.2);
$gapBetweenStartingOfArticlesTableAndColumnName = 7; $gapBetweenStartingOfArticlesTableAndColumnName = 7;
$tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 7; $additionnalheight = 0.75;
$tableHeight = $this->thereIsOrderOrCaseNumber ? (137 + $additionnalheight) : ( 137 + 6 + $additionnalheight);
$this->Rect(3, $this->startingYOfArticlesTable, 204, $tableHeight, "D"); $this->Rect(3, $this->startingYOfArticlesTable, 204, $tableHeight, "D");
// $this->RoundedRect(3, $this->startingYOfArticlesTable, 204, $tableHeight,5 ,'1234',"D"); // $this->RoundedRect(3, $this->startingYOfArticlesTable, 204, $tableHeight,5 ,'1234',"D");
// cadre titre des colonnes // cadre titre des colonnes
$this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207,$this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName); $this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207,$this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName);
// les traits verticaux colonnes // les traits verticaux colonnes
$additionalMargRight = 1; $additionalMargRight = 1;
$endingLine = 234; $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(142 + $additionalMargRight, $this->startingYOfArticlesTable, 142+ $additionalMargRight , $endingLine);
$this->Line(164 + $additionalMargRight, $this->startingYOfArticlesTable, 164+ $additionalMargRight , $endingLine); $this->Line(164 + $additionalMargRight, $this->startingYOfArticlesTable, 164+ $additionalMargRight , $endingLine);

View File

@ -77,7 +77,7 @@ class InvoicePdfHandler extends FPDF
$height = $originalHeight * $scale; $height = $originalHeight * $scale;
// Calculer la position pour centrer l'image // Calculer la position pour centrer l'image
$x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm $x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm
$y = ((297 - $height) / 2 ) + 19; // 297 mm est la hauteur d'une page A4 $y = ((297 - $height) / 2 ) + 21; // 297 mm est la hauteur d'une page A4
// Ajouter l'image en filigrane // Ajouter l'image en filigrane
$this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur $this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur
@ -246,10 +246,11 @@ class InvoicePdfHandler extends FPDF
private function DrawArticlesTable() private function DrawArticlesTable()
{ {
$this->startingYOfArticlesTable = $this->startingYOfArticlesTable - 2;
$this->SetLineWidth(0.2); $this->SetLineWidth(0.2);
$gapBetweenStartingOfArticlesTableAndColumnName = 8; $gapBetweenStartingOfArticlesTableAndColumnName = 8;
$tableHeight = $this->thereIsOrderOrCaseNumber ? $this->articleTablesHeight : $this->articleTablesHeight + 7; $tableHeight = $this->thereIsOrderOrCaseNumber ? $this->articleTablesHeight : $this->articleTablesHeight + 9;
$this->Rect(3, $this->startingYOfArticlesTable, 204, $tableHeight, "D"); $this->Rect(3, $this->startingYOfArticlesTable , 204, $tableHeight, "D");
// cadre titre des colonnes // cadre titre des colonnes
$this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName); $this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName);
// les traits verticaux colonnes // les traits verticaux colonnes
@ -268,7 +269,7 @@ class InvoicePdfHandler extends FPDF
$columnNameY = $this->startingYOfArticlesTable - 1; $columnNameY = $this->startingYOfArticlesTable - 1;
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$this->SetXY(12 + $additionalMargRight, $columnNameY); $this->SetXY(12 + $additionalMargRight, $columnNameY);
$this->Cell(7, 10, "Date", 0, 0, 'C'); $this->Cell(7, 10, "Datess", 0, 0, 'C');
$this->SetXY(30 + $additionalMargRight, $columnNameY); $this->SetXY(30 + $additionalMargRight, $columnNameY);
$this->Cell(100, 10, "Description", 0, 0, 'C'); $this->Cell(100, 10, "Description", 0, 0, 'C');