Adjust font sizes and spacing

This commit is contained in:
Narindra ezway 2025-04-04 18:05:11 +03:00
parent acd5a3f13d
commit f16729aecf
5 changed files with 83 additions and 75 deletions

View File

@ -40,7 +40,7 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
$totalHt = 0;
$totalTtc = 0;
$totalTva = 0;
$yValue = $this->startingYOfArticlesTable + 11;
$yValue = $this->startingYOfArticlesTable + 13;
$maxDescriptionWidth = 102;
$currentIndexPosition = $this->currentIndexPosition;
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){
@ -89,9 +89,9 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
} else {
$this->Cell($maxDescriptionWidth, 6, $productDescription);
}
$this->SetFont('ComicSans', '', 7);
$this->SetFont('ComicSans', '', 8);
$this->SetXY( 135,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');

View File

@ -99,14 +99,14 @@ class InvoiceGroupPdfHandler extends FPDF {
function Footer()
{
$this->SetY(-35);
$this->SetY(-38);
$this->SetFont('ComicSans', '', size: 7);
$this->MultiCell(0,5,utf8_decode(html_entity_decode('Tout retard de paiement entraînera de plein droit une pénalité de retard de 3 fois le taux légal ( Loi 2008-776 du 4 août 2008) et une indemnité forfaitaire de 40 EUR pour frais de recouvrement sera appliquée.')));
$this->MultiCell(0,4,utf8_decode(html_entity_decode('Tout retard de paiement entraînera de plein droit une pénalité de retard de 3 fois le taux légal ( Loi 2008-776 du 4 août 2008) et une indemnité forfaitaire de 40 EUR pour frais de recouvrement sera appliquée.')));
$this->Ln(1);
$this->MultiCell(0,5,utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).
$this->MultiCell(0,4,utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).
')));
$this->SetY(-15);
$this->SetY(-10);
$this->SetFont('ComicSans', '', 7);
$this->Cell(0, 10, utf8_decode(html_entity_decode($this->factureData['configuration']->legal_one)), 0, 0, 'C');
}
@ -151,11 +151,11 @@ class InvoiceGroupPdfHandler extends FPDF {
public function DrawInvoiceCompanyInfo(){
$this->SetY(40);
$this->SetFont('ComicSans', '', 10);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 1);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 1);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 1);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1);
$this->Cell(0, 5, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 1);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 1);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 1);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1);
$this->Cell(0, 4, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
}
public function DrawInvoiceClientInfo(){
$this->SetFont('ComicSans', '', 10);
@ -170,21 +170,22 @@ class InvoiceGroupPdfHandler extends FPDF {
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->MultiCell( 0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
$this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if($clientAdressIsMultiline){
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
}
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
}
public function DrawInvoiceCompanyAndClientInfo(){
$this->DrawInvoiceCompanyInfo();
$this->DrawInvoiceClientInfo();
}
public function DrawInvoiceInfoTable(){
@ -202,12 +203,12 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->Cell(36, 7, 'ECHEANCE', 1, 1, 'C');
$this->SetFont('ComicSans', '', 10);
$this->Cell(25, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
$this->Cell(39, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 7, $factureDateEcheance, 1, 1, 'C');
$this->Cell(25, 11, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 11, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
$this->Cell(39, 11, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 11, $factureDateEcheance, 1, 1, 'C');
$this->startingYOfArticlesTable = 85;
$this->startingYOfArticlesTable = 88;
}
public function DrawArticlesTableRect(){
@ -218,10 +219,10 @@ class InvoiceGroupPdfHandler extends FPDF {
// cadre titre des colonnes
$this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207,$this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName);
// les traits verticaux colonnes
$this->Line(28, $this->startingYOfArticlesTable, 28, 232);
$this->Line(132, $this->startingYOfArticlesTable, 132, 232);
$this->Line(157, $this->startingYOfArticlesTable, 157, 232);
$this->Line(182, $this->startingYOfArticlesTable, 182, 232);
$this->Line(28, $this->startingYOfArticlesTable, 28, 235);
$this->Line(132, $this->startingYOfArticlesTable, 132, 235);
$this->Line(157, $this->startingYOfArticlesTable, 157, 235);
$this->Line(182, $this->startingYOfArticlesTable, 182, 235);
}
public function DrawArticlesTableHeader(){
@ -242,17 +243,18 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->SetXY(185, $columnNameY);
$this->Cell(20, 8, "Prix Uni. TTC", 0, 0, 'C');
}
public function DrawArticlesTableValue(){
// Set espacement avant de continue
$this->SetFont('ComicSans','',10);
$devisData = $this->factureData['devis'];
$tvaValue = $this->factureData["configuration"]->tva_default;
$totalHt = 0;
$totalTtc = 0;
$totalTva = 0;
$yValue = $this->startingYOfArticlesTable + 11;
$yValue = $this->startingYOfArticlesTable + 13;
$maxDescriptionWidth = 102;
$currentIndexPosition = $this->currentIndexPosition;
for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){
@ -294,7 +296,7 @@ class InvoiceGroupPdfHandler extends FPDF {
$this->Cell($maxDescriptionWidth, 6, $productDescription);
}
$this->SetFont('ComicSans', '', 7);
$this->SetFont('ComicSans', '', 8);
$this->SetXY( 135,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
@ -320,16 +322,16 @@ class InvoiceGroupPdfHandler extends FPDF {
}
public function DrawBankAndTotalPriceInfo(){
$this->SetY(235);
$this->SetY(238);
$this->SetFont('ComicSans', '', 7);
$this->MultiCell(0,5,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->factureData['configuration']->entreprise)));
$this->MultiCell(0,5,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :")));
$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->Ln(1);
//Table IBAN
$this->SetFont('ComicSans', '', 7);
$ibanWidth = 56;
$this->SetFont('ComicSans', '', 8);
$ibanWidth = 62;
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 5, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX();
@ -342,7 +344,7 @@ class InvoiceGroupPdfHandler extends FPDF {
// Position correcte de la 2e table
$startOfArrayX = $pageWidth - $tableWidth - $marginRight;
$startOfArrayY = $ibanCursorY - 10;
$startOfArrayY = $ibanCursorY - 5;
$totalPriceArray = $this->totalPrices;

View File

@ -43,24 +43,24 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 39;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->MultiCell( 0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
$this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if($clientAdressIsMultiline){
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
}
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$clientInfoYAxis += 5;
$this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
$clientInfoYAxis += 5;
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
}
public function DrawInvoiceInfoTable(){
@ -79,13 +79,13 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
$this->SetFont('ComicSans', '', 10);
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
$this->Cell(34, 7, $this->factureData["facture_order_number"], 1, 1, 'C');
$this->Cell(30, 11, $factureDatePaiement, 1, 0, 'C');
$this->Cell(60, 11, 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, 11, $factureDateEcheance, 1, 0, 'C');
$this->Cell(34, 11, $this->factureData["facture_order_number"], 1, 1, 'C');
$this->startingYOfArticlesTable = 85;
$this->startingYOfArticlesTable = 88;
}

View File

@ -89,14 +89,14 @@ class InvoicePdfHandler extends FPDF
function Footer()
{
$this->SetY(-35);
$this->SetY(-38);
$this->SetFont('ComicSans', '', 7);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode('Tout retard de paiement entraînera de plein droit une pénalité de retard de 3 fois le taux légal ( Loi 2008-776 du 4 août 2008) et une indemnité forfaitaire de 40 EUR pour frais de recouvrement sera appliquée.')));
$this->MultiCell(0, 4, utf8_decode(html_entity_decode('Tout retard de paiement entraînera de plein droit une pénalité de retard de 3 fois le taux légal ( Loi 2008-776 du 4 août 2008) et une indemnité forfaitaire de 40 EUR pour frais de recouvrement sera appliquée.')));
$this->Ln(1);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).
$this->MultiCell(0, 4, utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).
')));
$this->SetY(-15);
$this->SetY(-10);
$this->SetFont('ComicSans', '', 7);
$this->Cell(0, 10, utf8_decode(html_entity_decode($this->factureData['configuration']->legal_one)), 0, 0, 'C');
}
@ -165,22 +165,22 @@ class InvoicePdfHandler extends FPDF
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->MultiCell(0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
$this->MultiCell(0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
if ($clientAdressIsMultiline) {
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
}
$clientInfoYAxis += 5;
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$clientInfoYAxis += 5;
$this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
$clientInfoYAxis += 5;
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
$clientInfoYAxis += 4;
$this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
$this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
}
private function DrawInvoiceCompanyAndClientInfo()
@ -191,7 +191,7 @@ class InvoicePdfHandler extends FPDF
private function DrawInvoiceInfoTable()
{
$this->setY(67);
$this->setY(80);
$factureDatePaiement = $this->factureData['date_paiement'];
$factureDatePaiement = DateTime::createFromFormat('Y-m-d', $factureDatePaiement);
$factureDateEcheance = $factureDatePaiement;
@ -204,11 +204,14 @@ class InvoicePdfHandler extends FPDF
$this->Cell(39, 7, 'FACTURE', 1, 0, 'C');
$this->Cell(36, 7, 'ECHEANCE', 1, 1, 'C');
$this->setY(90);
$this->SetFont('ComicSans', '', 10);
$this->Cell(25, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C');
$this->Cell(39, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 7, $factureDateEcheance, 1, 1, 'C');
$this->setY(30);
$this->Cell(25, 11, $factureDatePaiement, 1, 0, 'C');
$this->Cell(104, 11, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C');
$this->Cell(39, 11, $this->factureData['num'], 1, 0, 'C');
$this->Cell(36, 11, $factureDateEcheance, 1, 1, 'C');
$orderNumberIsProvided = (trim($this->factureData['order_number']) !== "" && trim($this->factureData['order_number']) !== "-");
$caseNumberIsProvided = (trim($this->factureData['case_number']) !== "" && trim($this->factureData['case_number']) !== "-");
@ -228,7 +231,7 @@ class InvoicePdfHandler extends FPDF
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport("Numéro de dossier: " . $this->factureData['case_number']), 0, 1, 'C');
}
$this->startingYOfArticlesTable = $this->thereIsOrderOrCaseNumber ? 95 : 85;
$this->startingYOfArticlesTable = $this->thereIsOrderOrCaseNumber ? 98 : 88;
}
private function DrawArticlesTable()
@ -297,6 +300,7 @@ class InvoicePdfHandler extends FPDF
$this->SetXY(29, $yValue);
$this->MultiAlignCell(102, 6, utf8_decode(html_entity_decode($productDescription)), 0, '0',);
$this->SetFont('ComicSans', '', 7);
$this->SetXY(135, $yValue);

View File

@ -167,7 +167,9 @@ class InvoicePdfService {
$templateType = $invoicePdfData['template_type_key'];
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
$factureFolders = $this->getGroupFactureFolder($invoicePdfData,$clean_folder);
//For testing
// $templateType = ClientTemplateTypeConstant::OGF;
switch ($templateType) {
case ClientTemplateTypeConstant::FUNECAP:
$pdf = new InvoiceFunecapPdfHandler();