Merge branch 'fixes/fix-total-price-table-in-invoice' into staging

This commit is contained in:
Tiavina 2025-01-04 19:43:51 +03:00
commit 6bc48f2e7f

View File

@ -39,7 +39,7 @@ class InvoicePdfHandler extends FPDF {
function Header()
{
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{
$this->Cell(55,30,'');
@ -49,14 +49,14 @@ class InvoicePdfHandler extends FPDF {
function Footer()
{
$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->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->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');
}
@ -75,12 +75,12 @@ class InvoicePdfHandler extends FPDF {
private function DrawInvoiceCompanyAndClientInfo(){
$this->SetFont('Arial', '', 12);
$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, 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, 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, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1);
$this->Ln(3);
@ -92,8 +92,8 @@ class InvoicePdfHandler extends FPDF {
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
$factureDateEcheance = $factureDatePaiement;
$factureDatePaiement = $factureDatePaiement->format('d-m-Y');
$factureDateEcheance->modify('+30 days');
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
$factureDateEcheance->modify('+1 month');
$factureDateEcheance = $factureDateEcheance->format('t-m-Y');
$this->SetFont('Arial', 'B', 11);
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
@ -183,9 +183,9 @@ class InvoicePdfHandler extends FPDF {
}
return [
"totalHt" => $totalHt,
"totalTtc" => $totalTtc,
"totalTvaValue" => $totalTva
"TOTAL HT" => $totalHt,
"TVA ".$tvaValue. "%" => $totalTva,
"TOTAL TTC" => $totalTtc
];
}
@ -200,29 +200,22 @@ class InvoicePdfHandler extends FPDF {
//Table IBAN
$this->SetFont('Arial', '', 11);
$ibanWidth = 90;
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 7, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX();
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT
$ibanLastPositionX = $ibanCursorX+$ibanWidth + 20;
$this->SetXY($ibanLastPositionX,$ibanCursorY);
$this->SetFont('Arial', 'B', 12);
$totalHtArrayWidth = 30;
$this->Cell($totalHtArrayWidth, 7, 'TOTAL HT', 1, 1, 'C');
$this->SetXY($ibanLastPositionX,$ibanCursorY);
$this->SetFont('Arial', '', 11);
$this->Cell($totalHtArrayWidth, 20, number_format($totalPriceArray['totalHt'],2,'.','').chr(128), 1, 1, 'C');
$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');
$startOfArrayX = $ibanLastPositionX;
$startOfArrayY = $ibanCursorY;
foreach($totalPriceArray as $label => $price){
$this->SetXY($startOfArrayX,$startOfArrayY);
$this->Cell(40, 7, $label, 1, 1, 'C');
$this->SetXY($startOfArrayX + 40,$startOfArrayY);
$this->Cell(40, 7, number_format($price,2,'.','').chr(128), 1, 1, 'C');
$startOfArrayY += 7;
}
}
public function GetFactureContent(){