new facture design

This commit is contained in:
Tiavina 2025-02-03 18:02:50 +03:00
parent e019843e78
commit 75a14254e9

View File

@ -50,7 +50,7 @@ class InvoicePdfHandler extends FPDF {
}
function Footer()
{
$this->SetY(-40);
$this->SetY(-35);
$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->Ln(1);
@ -96,28 +96,47 @@ class InvoicePdfHandler extends FPDF {
return $this->factureData['configuration']->facture_prefixe.'_'.$factureNum.'_'.mb_strtoupper($defuntNom,'UTF-8');
}
private function DrawInvoiceCompanyAndClientInfo(){
private 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);
}
private function DrawInvoiceClientInfo(){
$this->SetFont('ComicSans', '', 10);
$clientName = $this->factureData['client_nom'];
if($this->factureData['facture_type'] == MultipleFactureTypeConstant::GROUP_FILTER_TYPE){
$clientName = $this->factureData['group_facturation_name'];
}
$this->SetY(40);
$this->SetFont('ComicSans', '', 12);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 0);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($clientName), 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,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, 0);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail'], 0, 1,'R');
$this->Ln(3);
$clientInfoXAxis = 125;
$clientInfoYAxis = 40;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_real_adress'])));
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']);
$clientInfoYAxis += 5;
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']);
}
private function DrawInvoiceCompanyAndClientInfo(){
$this->DrawInvoiceCompanyInfo();
$this->DrawInvoiceClientInfo();
}
private function DrawInvoiceInfoTable(){
$this->setY(70);
$factureDatePaiement = $this->factureData['date_paiement'];
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
$factureDateEcheance = $factureDatePaiement;
@ -126,13 +145,13 @@ class InvoicePdfHandler extends FPDF {
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
$this->SetFont('ComicSans', 'B', 11);
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
$this->Cell(94, 7, 'CLIENT', 1, 0, 'C');
$this->Cell(40, 7, 'FACTURE', 1, 0, 'C');
$this->Cell(40, 7, 'ECHEANCE', 1, 1, 'C');
$this->SetFont('ComicSans', '', 10);
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
$this->Cell(80, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C');
$this->Cell(94, 7, utf8_decode(html_entity_decode($this->factureData['client_nom'])), 1, 0, 'C');
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
$this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C');
@ -140,33 +159,33 @@ class InvoicePdfHandler extends FPDF {
}
private function DrawArticlesTable(){
$this->SetLineWidth(0.1);
$this->Rect(10, 105, 190, 100, "D");
$this->SetLineWidth(0.2);
$this->Rect(3, 95, 204, 137, "D");
// cadre titre des colonnes
$this->Line(10, 115, 200,115);
$this->Line(3, 105, 207,105);
// les traits verticaux colonnes
$this->Line(35, 105, 35, 205);
$this->Line(135, 105, 135, 205);
$this->Line(155, 105, 155, 205);
$this->Line(175, 105, 175, 205);
$this->Line(35, 95, 35, 232);
$this->Line(135, 95, 135, 232);
$this->Line(160, 95, 160, 232);
$this->Line(180, 95, 180, 232);
}
private function DrawArticlesTableHeader(){
$tvaValue = $this->factureData["configuration"]->tva_default;
$this->SetFont('ComicSans','',10);
$this->SetXY( 10,106 );
$this->SetXY( 9,96 );
$this->Cell( 20, 8, "Date", 0, 0, 'C');
$this->SetXY( 35,106 );
$this->SetXY( 35,96 );
$this->Cell( 100, 8, "Description", 0, 0, 'C');
$this->SetXY( 135,106 );
$this->SetXY( 138,96 );
$this->Cell( 20, 8, "Prix Uni. HT", 0, 0, 'C');
$this->SetXY( 155,106 );
$this->SetXY( 160,96 );
$this->Cell( 20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C');
$this->SetXY( 175,106 );
$this->SetXY( 181,96 );
$this->Cell( 25, 8, "Prix Uni. TTC", 0, 0, 'C');
}
@ -181,7 +200,7 @@ class InvoicePdfHandler extends FPDF {
$totalTtc = 0;
$totalTva = 0;
$products = $this->factureData["products"];
$yValue = 116;
$yValue = 106;
foreach($products as $product){
$valueHt = $product['produit_price'];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue);
@ -194,19 +213,19 @@ class InvoicePdfHandler extends FPDF {
$productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->factureData['defunt_sexe']) . ' '. $this->factureData["defunt_nom"];
}
$tvaAmount = $valueTtc - $valueHt;
$this->SetXY( 10,$yValue );
$this->SetXY( 8,$yValue );
$this->Cell(20, 6, $dateValue, 0,0);
$this->SetXY( 35,$yValue );
$this->MultiAlignCell(100, 6, utf8_decode(html_entity_decode($productDescription)),0,'0',);
$this->SetXY( 135,$yValue );
$this->SetXY( 138,$yValue );
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 155,$yValue );
$this->SetXY( 160,$yValue );
$this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C');
$this->SetXY( 175,$yValue );
$this->SetXY( 181,$yValue );
$this->Cell(25, 6, number_format($valueTtc,2,'.','').chr(128), 0, 1, 'C');
$yValue += 12;
$totalTva += $tvaAmount;
@ -220,31 +239,31 @@ class InvoicePdfHandler extends FPDF {
}
private function DrawBankAndTotalPriceInfo($totalPriceArray){
$this->SetY(210);
$this->SetFont('ComicSans', '', 9);
$this->SetY(235);
$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->Ln(1);
//Table IBAN
$this->SetFont('ComicSans', '', 11);
$this->SetFont('ComicSans', '', 9);
$ibanWidth = 90;
$ibanCursorY = $this->GetY();
$this->Cell($ibanWidth, 7, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$this->Cell($ibanWidth, 5, 'IBAN : FR76 1360 6000 1436 5418 1800 038', 1, 1, 'C');
$ibanCursorX = $this->GetX();
$this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
$this->Cell($ibanWidth, 5, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT
$ibanLastPositionX = $ibanCursorX+$ibanWidth + 20;
$ibanLastPositionX = $ibanCursorX+$ibanWidth + 54;
$startOfArrayX = $ibanLastPositionX;
$startOfArrayY = $ibanCursorY;
$startOfArrayY = $ibanCursorY - 10;
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;
$this->Cell(30, 5, $label, 1, 1, 'C');
$this->SetXY($startOfArrayX + 30,$startOfArrayY);
$this->Cell(30, 5, number_format($price,2,'.','').chr(128), 1, 1, 'C');
$startOfArrayY += 5;
}
}
@ -257,7 +276,7 @@ class InvoicePdfHandler extends FPDF {
public function SetFactureContent(){
$this->AddPage();
$this->SetMargins(10,0,10);
$this->SetMargins(3,0,3);
$this->DrawInvoiceCompanyAndClientInfo();
$this->DrawInvoiceInfoTable();
$this->DrawArticlesTable();