Add new table for total ht, total tva value and total ttc in facture

This commit is contained in:
Tiavina 2025-01-04 19:41:56 +03:00
parent 80a3c6675a
commit 0322bb0cd9

View File

@ -39,7 +39,7 @@ class InvoicePdfHandler extends FPDF {
function Header() function Header()
{ {
if($this->logo != "nothing"){ if($this->logo != "nothing"){
$this->Image($this->logoPath."logo.png", 10, 10, 55, 30); $this->Image($this->logoPath."logo.png", 10, 10, 75, 25);
} }
else{ else{
$this->Cell(55,30,''); $this->Cell(55,30,'');
@ -49,14 +49,14 @@ class InvoicePdfHandler extends FPDF {
function Footer() function Footer()
{ {
$this->SetY(-40); $this->SetY(-40);
$this->SetFont('Arial', '', 8); $this->SetFont('Arial', '', 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,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->Ln(1); $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,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->SetY(-15); $this->SetY(-15);
$this->SetFont('Arial', 'B', 9); $this->SetFont('Arial', 'B', 8);
$this->Cell(0, 10, utf8_decode(html_entity_decode($this->factureData['configuration']->legal_one)), 0, 0, 'C'); $this->Cell(0, 10, utf8_decode(html_entity_decode($this->factureData['configuration']->legal_one)), 0, 0, 'C');
} }
@ -75,12 +75,12 @@ class InvoicePdfHandler extends FPDF {
private function DrawInvoiceCompanyAndClientInfo(){ private function DrawInvoiceCompanyAndClientInfo(){
$this->SetFont('Arial', '', 12); $this->SetFont('Arial', '', 12);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 0); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 0);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['client_nom'] . ' ' . $this->factureData['client_entreprise']), 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['client_nom']), 0, 1,'R');
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 0); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 0);
$this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])), 0, 1,'R'); $this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])), 0, 1,'R');
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 0);border: $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 0);border:
$this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])), 0, 1,'R'); $this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])), 0, 1,'R');
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,0);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret'], 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret'], 0, 1,'R');
$this->Cell(0, 7, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1); $this->Cell(0, 7, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
$this->Ln(3); $this->Ln(3);
@ -92,8 +92,8 @@ class InvoicePdfHandler extends FPDF {
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement); $factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
$factureDateEcheance = $factureDatePaiement; $factureDateEcheance = $factureDatePaiement;
$factureDatePaiement = $factureDatePaiement->format('d-m-Y'); $factureDatePaiement = $factureDatePaiement->format('d-m-Y');
$factureDateEcheance->modify('+30 days'); $factureDateEcheance->modify('+1 month');
$factureDateEcheance = $factureDateEcheance->format('d-m-Y'); $factureDateEcheance = $factureDateEcheance->format('t-m-Y');
$this->SetFont('Arial', 'B', 11); $this->SetFont('Arial', 'B', 11);
$this->Cell(30, 7, 'DATE', 1, 0, 'C'); $this->Cell(30, 7, 'DATE', 1, 0, 'C');
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
@ -183,9 +183,9 @@ class InvoicePdfHandler extends FPDF {
} }
return [ return [
"totalHt" => $totalHt, "TOTAL HT" => $totalHt,
"totalTtc" => $totalTtc, "TVA ".$tvaValue. "%" => $totalTva,
"totalTvaValue" => $totalTva "TOTAL TTC" => $totalTtc
]; ];
} }
@ -200,29 +200,22 @@ class InvoicePdfHandler extends FPDF {
//Table IBAN //Table IBAN
$this->SetFont('Arial', '', 11); $this->SetFont('Arial', '', 11);
$ibanWidth = 90; $ibanWidth = 90;
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 7, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C'); $this->Cell($ibanWidth, 7, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX(); $ibanCursorX = $this->GetX();
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C'); $this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT //TABLE HT
$ibanLastPositionX = $ibanCursorX+$ibanWidth + 20; $ibanLastPositionX = $ibanCursorX+$ibanWidth + 20;
$this->SetXY($ibanLastPositionX,$ibanCursorY); $startOfArrayX = $ibanLastPositionX;
$this->SetFont('Arial', 'B', 12); $startOfArrayY = $ibanCursorY;
$totalHtArrayWidth = 30; foreach($totalPriceArray as $label => $price){
$this->Cell($totalHtArrayWidth, 7, 'TOTAL HT', 1, 1, 'C'); $this->SetXY($startOfArrayX,$startOfArrayY);
$this->SetXY($ibanLastPositionX,$ibanCursorY); $this->Cell(40, 7, $label, 1, 1, 'C');
$this->SetFont('Arial', '', 11); $this->SetXY($startOfArrayX + 40,$startOfArrayY);
$this->Cell($totalHtArrayWidth, 20, number_format($totalPriceArray['totalHt'],2,'.','').chr(128), 1, 1, 'C'); $this->Cell(40, 7, number_format($price,2,'.','').chr(128), 1, 1, 'C');
$startOfArrayY += 7;
$tableHTLastPostionX = $ibanLastPositionX + $totalHtArrayWidth + 10; }
//TABLE TTC
$this->SetXY($tableHTLastPostionX,$ibanCursorY+7);
$this->SetFont('Arial', 'B', 12);
$this->Cell(30, 7, 'TOTAL TTC', 1, 1, 'C');
$this->SetXY($tableHTLastPostionX,$ibanCursorY+14);
$this->SetFont('Arial', '', 11);
$this->Cell(30, 7, number_format($totalPriceArray['totalTtc'],2,'.','').chr(128), 1, 1, 'C');
} }
public function GetFactureContent(){ public function GetFactureContent(){