diff --git a/gestion/lib/Db/Bdd.php b/gestion/lib/Db/Bdd.php index 2031d4c..564819e 100644 --- a/gestion/lib/Db/Bdd.php +++ b/gestion/lib/Db/Bdd.php @@ -2977,6 +2977,7 @@ class Bdd { client.nom as client_nom, client.entreprise as client_entreprise, client.adresse as client_adresse, + client.mail as client_mail, defunt.nom as defunt_nom, defunt.sexe as defunt_sexe, lieu.nom as lieu_nom, diff --git a/gestion/lib/Service/InvoicePdfHandler.php b/gestion/lib/Service/InvoicePdfHandler.php index ec46795..596fe62 100644 --- a/gestion/lib/Service/InvoicePdfHandler.php +++ b/gestion/lib/Service/InvoicePdfHandler.php @@ -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); @@ -77,7 +77,7 @@ class InvoicePdfHandler extends FPDF { foreach($this->multipleFactureData as $factureData){ $factureType = $factureData["facture_type"]; if($factureType == MultipleFactureTypeConstant::CLIENT_FILTER_TYPE){ - $filename = mb_strtoupper($factureData["client_prenom"],'UTF-8'); + $filename = mb_strtoupper($factureData["client_nom"],'UTF-8'); } else{ $filename = 'GROUPE_'.mb_strtoupper($factureData["group_facturation_name"],'UTF-8'); @@ -96,27 +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, 1); - $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; @@ -125,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'); @@ -139,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'); } @@ -180,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); @@ -193,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; @@ -219,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; } } @@ -256,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(); diff --git a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php index a0d001c..d2d7e51 100644 --- a/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php +++ b/gestion/lib/Service/InvoiceRecap/InvoiceRecapService.php @@ -237,7 +237,7 @@ class InvoiceRecapService { $pdf->Cell( 0, 8, "Saint Senoux, le ".utf8_decode($date_formated), 0, 0, 'R'); // n° facture, date echeance et reglement et obs - $pdf->SetLineWidth(0.1); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF"); + $pdf->SetLineWidth(0.2); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF"); $pdf->SetXY( 114, 20 ); $pdf->SetFont( "ComicSans", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])), 0, 0, 'C'); // adresse du facture @@ -251,7 +251,7 @@ class InvoiceRecapService { // le cadre des articles // *********************** // cadre avec 18 lignes max ! et 118 de hauteur --> 80 + 118 = 198 pour les traits verticaux - $pdf->SetLineWidth(0.1); $pdf->Rect(5, 80, 200, 153, "D"); + $pdf->SetLineWidth(0.2); $pdf->Rect(5, 80, 200, 153, "D"); // cadre titre des colonnes $pdf->Line(5, 90, 205, 90); // les traits verticaux colonnes @@ -426,7 +426,7 @@ class InvoiceRecapService { $j=1; foreach ($client as $key => $facture) { if($j==1) { - $current_client = $facture['prenoms_client'].' '.$facture['nom_client']; + $current_client = $facture['nom_client']; $date_facture = $facture['date_facture']; $clientAddresses = FileExportHelpers::GetAddressAndCityFromAddress($facture['adresse_client']); $clientAddress = $clientAddresses['address']; @@ -527,7 +527,7 @@ class InvoiceRecapService { $pdf->Cell( 0, 8,"Saint Senoux, le ".utf8_decode($date_formated), 0, 0, 'R'); // n° facture, date echeance et reglement et obs - $pdf->SetLineWidth(0.1); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF"); + $pdf->SetLineWidth(0.2); $pdf->SetFillColor(255); $pdf->Rect(114, 20, 85, 8, "DF"); $pdf->SetXY( 114, 20 ); $pdf->SetFont( "ComicSans", "B", 12 ); $pdf->Cell( 85, 8, 'FACTURE N'.utf8_decode('°').' FAC/'.$key_annee.'/'.strtoupper(FileExportHelpers::ConvertSpecialChar(explode(' ', $date_formated)[1])), 0, 0, 'C'); // adresse du facture @@ -545,7 +545,7 @@ class InvoiceRecapService { // le cadre des articles // *********************** // cadre avec 18 lignes max ! et 118 de hauteur --> 80 + 118 = 198 pour les traits verticaux - $pdf->SetLineWidth(0.1); $pdf->Rect(5, 80, 200, 153, "D"); + $pdf->SetLineWidth(0.2); $pdf->Rect(5, 80, 200, 153, "D"); // cadre titre des colonnes $pdf->Line(5, 90, 205, 90); // les traits verticaux colonnes