Merge branch 'fixes/fixing-pdf-always-4' into staging

This commit is contained in:
Narindra ezway 2025-04-16 16:10:25 +03:00
commit a7039dedc8
4 changed files with 94 additions and 83 deletions

View File

@ -53,11 +53,11 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$products = $currentDevis["products"]; $products = $currentDevis["products"];
$subcontractorOrderNumberText = "Numéro de sous traitance ".$currentDevis["order_number"]; $subcontractorOrderNumberText = "Numéro de sous traitance ".$currentDevis["order_number"];
$subcontractorCaseNumberText = "Numéro de dossier ".$currentDevis["case_number"]; $subcontractorCaseNumberText = "Numéro de dossier ".$currentDevis["case_number"];
$this->SetXY( 29,$yValue ); $this->SetXY( 30,$yValue );
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorOrderNumberText),0,'0',); $this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorOrderNumberText),0,'0',);
$yValue += 6; $yValue += 6;
$this->SetXY( 29,$yValue ); $this->SetXY( 30,$yValue );
$this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorCaseNumberText),0,'0',); $this->MultiAlignCell(100, 6, FileExportHelpers::FormatTextForExport($subcontractorCaseNumberText),0,'0',);
$yValue += 6; $yValue += 6;
foreach($products as $product){ foreach($products as $product){
@ -73,10 +73,10 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? ""; $productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
} }
$tvaAmount = $valueTtc - $valueHt; $tvaAmount = $valueTtc - $valueHt;
$this->SetXY( 5,$yValue ); $this->SetXY( 4.5,$yValue );
$this->Cell(5, 6, $dateValue, 0,0); $this->Cell(5, 6, $dateValue, 0,0);
$this->SetXY( 29,$yValue ); $this->SetXY( 30,$yValue );
$productDescription = FileExportHelpers::FormatTextForExport($productDescription); $productDescription = FileExportHelpers::FormatTextForExport($productDescription);
$productDescriptionWidth = $this->GetStringWidth($productDescription); $productDescriptionWidth = $this->GetStringWidth($productDescription);
$productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth; $productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth;
@ -94,10 +94,10 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
} }
$this->SetXY( 135,$yValue ); $this->SetXY( 144,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 159,$yValue ); $this->SetXY( 165,$yValue );
$this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 182,$yValue ); $this->SetXY( 182,$yValue );

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 ) + 30; // 297 mm est la hauteur d'une page A4 $y = ((297 - $height) / 2 ) + 19; // 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,17 +246,17 @@ class InvoiceGroupPdfHandler extends FPDF {
$factureDateEcheance->modify('last day of next month'); $factureDateEcheance->modify('last day of next month');
$factureDateEcheance = $factureDateEcheance->format('d-m-Y'); $factureDateEcheance = $factureDateEcheance->format('d-m-Y');
$this->SetFont('ComicSans', '', 9); $this->SetFont('ComicSans', '', 10);
$this->Cell(25, 7, 'DATE', 1, 0, 'C'); $this->Cell(25, 7, 'DATE', 1, 0, 'C');
$this->Cell(104, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(104, 7, 'CLIENT', 1, 0, 'C');
$this->Cell(39, 7, 'FACTURE', 1, 0, 'C'); $this->Cell(39, 7, 'FACTURE', 1, 0, 'C');
$this->Cell(36, 7, 'ECHEANCE', 1, 1, 'C'); $this->Cell(36, 7, 'ECHEANCE', 1, 1, 'C');
$this->SetFont('ComicSans', '', 9); $this->SetFont('ComicSans', '', 10);
$this->Cell(25, 11, $factureDatePaiement, 1, 0, 'C'); $this->Cell(25, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 11, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C'); $this->Cell(104, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
$this->Cell(39, 11, $this->factureData['num'], 1, 0, 'C'); $this->Cell(39, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 11, $factureDateEcheance, 1, 1, 'C'); $this->Cell(36, 7, $factureDateEcheance, 1, 1, 'C');
$this->startingYOfArticlesTable = $startInvoiceInfoTable + 20; $this->startingYOfArticlesTable = $startInvoiceInfoTable + 20;
} }
@ -264,37 +264,40 @@ class InvoiceGroupPdfHandler extends FPDF {
public function DrawArticlesTableRect(){ public function DrawArticlesTableRect(){
$this->SetLineWidth(0.2); $this->SetLineWidth(0.2);
$gapBetweenStartingOfArticlesTableAndColumnName = 10; $gapBetweenStartingOfArticlesTableAndColumnName = 7;
$tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 10; $tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 7;
$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
$this->Line(28, $this->startingYOfArticlesTable, 28, 237); $additionalMargRight = 1;
$this->Line(132, $this->startingYOfArticlesTable, 132, 237); $endingLine = 234;
$this->Line(157, $this->startingYOfArticlesTable, 157, 237); $this->Line(27 + $additionalMargRight, $this->startingYOfArticlesTable, 27+ $additionalMargRight , $endingLine);
$this->Line(182, $this->startingYOfArticlesTable, 182, 237); $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);
} }
public function DrawArticlesTableHeader(){ public function DrawArticlesTableHeader(){
$additionalMargRight = 1;
$tvaValue = $this->factureData["configuration"]->tva_default; $tvaValue = $this->factureData["configuration"]->tva_default;
$columnNameY = $this->startingYOfArticlesTable + 1; $columnNameY = $this->startingYOfArticlesTable - 1.5;
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$this->SetXY(12, $columnNameY); $this->SetXY(12 + $additionalMargRight, $columnNameY);
$this->Cell(7, 8, "Date", 0, 0, 'C'); $this->Cell(7, 10, "Date", 0, 0, 'C');
$this->SetXY(28, $columnNameY); $this->SetXY(30 + $additionalMargRight, $columnNameY);
$this->Cell(100, 8, "Description", 0, 0, 'C'); $this->Cell(100, 10, "Description", 0, 0, 'C');
$this->SetXY(135, $columnNameY); $this->SetXY(143 + $additionalMargRight, $columnNameY);
$this->Cell(20, 8, "Prix Uni. HT", 0, 0, 'C'); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C');
$this->SetXY(159, $columnNameY); $this->SetXY(163 + $additionalMargRight, $columnNameY);
$this->Cell(20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C'); $this->Cell(20, 10, 'TVA ' . $tvaValue . '%', 0, 0, 'C');
$this->SetXY(185, $columnNameY); $this->SetXY(185 , $columnNameY);
$this->Cell(20, 8, "Prix Uni. TTC", 0, 0, 'C'); $this->Cell(20, 10, "Prix Uni. TTC", 0, 0, 'C');
} }
public function DrawArticlesTableValue(){ public function DrawArticlesTableValue(){
@ -329,10 +332,10 @@ class InvoiceGroupPdfHandler extends FPDF {
$productDescription .= " de " . $currentDevis["defunt_nom"] ?? ""; $productDescription .= " de " . $currentDevis["defunt_nom"] ?? "";
} }
$tvaAmount = $valueTtc - $valueHt; $tvaAmount = $valueTtc - $valueHt;
$this->SetXY( 5,$yValue ); $this->SetXY(4,$yValue );
$this->Cell(5, 6, $dateValue, 0,0); $this->Cell(5, 6, $dateValue, 0,0);
$this->SetXY( 29,$yValue ); $this->SetXY( 30,$yValue );
$productDescription = FileExportHelpers::FormatTextForExport($productDescription); $productDescription = FileExportHelpers::FormatTextForExport($productDescription);
$productDescriptionWidth = $this->GetStringWidth($productDescription); $productDescriptionWidth = $this->GetStringWidth($productDescription);
$productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth; $productDescriptionWidthIsGreaterThanMaxWidth = $productDescriptionWidth > $maxDescriptionWidth;
@ -350,10 +353,10 @@ class InvoiceGroupPdfHandler extends FPDF {
} }
$this->SetXY( 135,$yValue ); $this->SetXY(144,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 159,$yValue ); $this->SetXY(165,$yValue );
$this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 182,$yValue ); $this->SetXY( 182,$yValue );
@ -381,38 +384,40 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->MultiCell(0,4,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :"))); $this->MultiCell(0,4,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :")));
$this->Ln(1); $this->Ln(1);
//Table IBAN //Table IBAN
$startOftable = 3 ;
$this->SetX($startOftable);
$this->SetFont('ComicSans', '', 8); $this->SetFont('ComicSans', '', 8);
$ibanWidth = 62; $ibanWidth = 62;
$ibanCursorY = $this->GetY(); $ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 5, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C'); $this->Cell($ibanWidth, 6.5, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX(); $ibanCursorX = $this->GetX();
$this->Cell($ibanWidth, 5, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C'); $this->SetX($startOftable);
$this->Cell($ibanWidth, 6.5, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT //TABLE HT
$tableWidth = 48; // Largeur totale de la 2e table (20+20) $tableWidth = 48; // Largeur totale de la 2e table (20+20)
$marginRight = 3; // Marge par rapport au bord droit $marginRight = 3; // Marge par rapport au bord droit
$pageWidth = 210; // Largeur d'une page A4 en mm (portrait) $pageWidth = 210; // Largeur d'une page A4 en mm (portrait)
// Position correcte de la 2e table // Position correcte de la 2e table
$startOfArrayX = $pageWidth - $tableWidth - $marginRight; $startOfArrayX = $pageWidth - $tableWidth - $marginRight ;
$startOfArrayY = $ibanCursorY - 5; $startOfArrayY = $ibanCursorY - 5;
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$totalPriceArray = $this->totalPrices; $totalPriceArray = $this->totalPrices;
foreach($totalPriceArray as $label => $price){ foreach($totalPriceArray as $label => $price){
$this->SetXY($startOfArrayX,$startOfArrayY); $this->SetXY($startOfArrayX,$startOfArrayY);
$this->Cell(24, 5, $label, 1, 1, 'C'); $this->Cell(24, 6.5, $label, 1, 1, 'C');
$this->SetXY($startOfArrayX + 24,$startOfArrayY); $this->SetXY($startOfArrayX + 24,$startOfArrayY);
$this->Cell(24, 5, number_format($price,2,'.','').chr(128), 1, 1, 'C'); $this->Cell(24, 6.5, number_format($price,2,'.','').chr(128), 1, 1, 'C');
$startOfArrayY += 5; $startOfArrayY += 6.5;
} }
} }
public function SetFactureContent(){ public function SetFactureContent(){
$this->AddPage(); $this->AddPage();
$this->SetMargins(3,0,3); $this->SetMargins(2,0,3);
$this->DrawArticlesTable(); $this->DrawArticlesTable();
$this->DrawBankAndTotalPriceInfo(); $this->DrawBankAndTotalPriceInfo();
} }

View File

@ -82,11 +82,11 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C'); $this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$this->Cell(30, 11, $factureDatePaiement, 1, 0, 'C'); $this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(60, 11, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C'); $this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
$this->Cell(40, 11, $this->factureData['num'], 1, 0, 'C'); $this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(40, 11, $factureDateEcheance, 1, 0, 'C'); $this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
$this->Cell(34, 11, $this->factureData["facture_order_number"], 1, 1, 'C'); $this->Cell(34, 7, $this->factureData["facture_order_number"], 1, 1, 'C');
$this->startingYOfArticlesTable = $startInvoiceInfoTable + 20; $this->startingYOfArticlesTable = $startInvoiceInfoTable + 20;

View File

@ -72,14 +72,14 @@ class InvoicePdfHandler extends FPDF
$originalHeight = $originalHeight * 0.264583; $originalHeight = $originalHeight * 0.264583;
// Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine // Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine
$scale = 2; $scale = 1.7;
$width = $originalWidth * $scale; $width = $originalWidth * $scale;
$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; // 297 mm est la hauteur d'une page A4 $y = ((297 - $height) / 2 ) + 19; // 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
$this->SetAlpha(0.1); // Définir l'opacité $this->SetAlpha(0.1); // Définir l'opacité
} }
@ -216,10 +216,10 @@ class InvoicePdfHandler extends FPDF
$this->setY(77); $this->setY(77);
$this->SetFont('ComicSans', '', 9); $this->SetFont('ComicSans', '', 9);
$this->Cell(25, 11, $factureDatePaiement, 1, 0, 'C'); $this->Cell(25, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 11, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C'); $this->Cell(104, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C');
$this->Cell(39, 11, $this->factureData['num'], 1, 0, 'C'); $this->Cell(39, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 11, $factureDateEcheance, 1, 1, 'C'); $this->Cell(36, 7, $factureDateEcheance, 1, 1, 'C');
$orderNumberIsProvided = (trim($this->factureData['order_number']) !== "" && trim($this->factureData['order_number']) !== "-"); $orderNumberIsProvided = (trim($this->factureData['order_number']) !== "" && trim($this->factureData['order_number']) !== "-");
$caseNumberIsProvided = (trim($this->factureData['case_number']) !== "" && trim($this->factureData['case_number']) !== "-"); $caseNumberIsProvided = (trim($this->factureData['case_number']) !== "" && trim($this->factureData['case_number']) !== "-");
@ -245,37 +245,40 @@ class InvoicePdfHandler extends FPDF
private function DrawArticlesTable() private function DrawArticlesTable()
{ {
$this->SetLineWidth(0.2); $this->SetLineWidth(0.2);
$gapBetweenStartingOfArticlesTableAndColumnName = 10; $gapBetweenStartingOfArticlesTableAndColumnName = 8;
$tableHeight = $this->thereIsOrderOrCaseNumber ? $this->articleTablesHeight : $this->articleTablesHeight + 10; $tableHeight = $this->thereIsOrderOrCaseNumber ? $this->articleTablesHeight : $this->articleTablesHeight + 7;
$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
$this->Line(28, $this->startingYOfArticlesTable, 28, $this->endingYOfArticlesTable + 3); $additionalMargRight = 1;
$this->Line(132, $this->startingYOfArticlesTable, 132, $this->endingYOfArticlesTable + 3); $endingLine = 234;
$this->Line(157, $this->startingYOfArticlesTable, 157, $this->endingYOfArticlesTable + 3); $this->Line(27 + $additionalMargRight, $this->startingYOfArticlesTable, 27+ $additionalMargRight , $endingLine);
$this->Line(182, $this->startingYOfArticlesTable, 182, $this->endingYOfArticlesTable + 3); $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);
} }
private function DrawArticlesTableHeader() private function DrawArticlesTableHeader()
{ {
$additionalMargRight = 1;
$tvaValue = $this->factureData["configuration"]->tva_default; $tvaValue = $this->factureData["configuration"]->tva_default;
$columnNameY = $this->startingYOfArticlesTable + 1; $columnNameY = $this->startingYOfArticlesTable + 1;
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$this->SetXY(12, $columnNameY); $this->SetXY(12 + $additionalMargRight, $columnNameY);
$this->Cell(7, 8, "Date", 0, 0, 'C'); $this->Cell(7, 10, "Date", 0, 0, 'C');
$this->SetXY(28, $columnNameY); $this->SetXY(30 + $additionalMargRight, $columnNameY);
$this->Cell(100, 8, "Description", 0, 0, 'C'); $this->Cell(100, 10, "Description", 0, 0, 'C');
$this->SetXY(135, $columnNameY); $this->SetXY(143 + $additionalMargRight, $columnNameY);
$this->Cell(20, 8, "Prix Uni. HT", 0, 0, 'C'); $this->Cell(20, 10, "Prix Uni. HT", 0, 0, 'C');
$this->SetXY(159, $columnNameY); $this->SetXY(163 + $additionalMargRight, $columnNameY);
$this->Cell(20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C'); $this->Cell(20, 10, 'TVA ' . $tvaValue . '%', 0, 0, 'C');
$this->SetXY(185, $columnNameY); $this->SetXY(185, $columnNameY);
$this->Cell(20, 8, "Prix Uni. TTC", 0, 0, 'C'); $this->Cell(20, 10, "Prix Uni. TTC", 0, 0, 'C');
} }
public function DrawArticlesTableValueAndReturnTotalPrice() public function DrawArticlesTableValueAndReturnTotalPrice()
@ -289,7 +292,8 @@ class InvoicePdfHandler extends FPDF
$totalTtc = 0; $totalTtc = 0;
$totalTva = 0; $totalTva = 0;
$products = $this->factureData["products"]; $products = $this->factureData["products"];
$yValue = $this->startingYOfArticlesTable + 11; $yValue = $this->startingYOfArticlesTable + 13;
$maxDescriptionWidth = 102;
foreach ($products as $product) { foreach ($products as $product) {
$valueHt = $product['produit_price'] * $product['quantite']; $valueHt = $product['produit_price'] * $product['quantite'];
@ -306,15 +310,15 @@ class InvoicePdfHandler extends FPDF
$this->SetXY(5, $yValue); $this->SetXY(5, $yValue);
$this->Cell(5, 6, $dateValue, 0, 0); $this->Cell(5, 6, $dateValue, 0, 0);
$this->SetXY(29, $yValue); $this->SetXY(30, $yValue);
$this->MultiAlignCell(102, 6, utf8_decode(html_entity_decode($productDescription)), 0, '0',); $this->MultiAlignCell($maxDescriptionWidth , 6, utf8_decode(html_entity_decode($productDescription)), 0, '0',);
$this->SetXY(135, $yValue); $this->SetXY(144, $yValue);
$this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C');
$this->SetXY(159, $yValue); $this->SetXY(165, $yValue);
$this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C');
$this->SetXY(182, $yValue); $this->SetXY(182, $yValue);
@ -332,19 +336,21 @@ class InvoicePdfHandler extends FPDF
private function DrawBankAndTotalPriceInfo($totalPriceArray) private function DrawBankAndTotalPriceInfo($totalPriceArray)
{ {
$this->SetY(235); $this->SetY(239);
$this->SetFont('ComicSans', '', 8); $this->SetFont('ComicSans', '', 8);
$this->MultiCell(0,4,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->factureData['configuration']->entreprise))); $this->MultiCell(0,4,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->factureData['configuration']->entreprise)));
$this->MultiCell(0,4,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :"))); $this->MultiCell(0,4,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :")));
$this->Ln(1); $this->Ln(1);
$startOftable = 3 ;
$this->SetX($startOftable);
// Table IBAN // Table IBAN
$this->SetFont('ComicSans', '', 8); $this->SetFont('ComicSans', '', 8);
$ibanWidth = 62; $ibanWidth = 62;
$ibanCursorY = $this->GetY(); $ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 5, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C'); $this->Cell($ibanWidth, 5, 'IBANss : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX(); $ibanCursorX = $this->GetX();
$this->SetX($startOftable);
$this->Cell($ibanWidth, 5, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C'); $this->Cell($ibanWidth, 5, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT //TABLE HT
@ -360,9 +366,9 @@ class InvoicePdfHandler extends FPDF
foreach($totalPriceArray as $label => $price){ foreach($totalPriceArray as $label => $price){
$this->SetXY($startOfArrayX,$startOfArrayY); $this->SetXY($startOfArrayX,$startOfArrayY);
$this->Cell(24, 5, $label, 1, 1, 'C'); $this->Cell(24, 6.5, $label, 1, 1, 'C');
$this->SetXY($startOfArrayX + 24,$startOfArrayY); $this->SetXY($startOfArrayX + 24,$startOfArrayY);
$this->Cell(24, 5, number_format($price,2,'.','').chr(128), 1, 1, 'C'); $this->Cell(24, 6.5, number_format($price,2,'.','').chr(128), 1, 1, 'C');
$startOfArrayY += 5; $startOfArrayY += 5;
} }
} }
@ -378,7 +384,7 @@ class InvoicePdfHandler extends FPDF
public function SetFactureContent() public function SetFactureContent()
{ {
$this->AddPage(); $this->AddPage();
$this->SetMargins(3, 0, 3); $this->SetMargins(2, 0, 3);
$this->DrawInvoiceCompanyAndClientInfo(); $this->DrawInvoiceCompanyAndClientInfo();
$this->DrawInvoiceInfoTable(); $this->DrawInvoiceInfoTable();
$this->DrawArticlesTable(); $this->DrawArticlesTable();