diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceFunecapPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceFunecapPdfHandler.php index 82cc4f8..1274b0b 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceFunecapPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceFunecapPdfHandler.php @@ -44,7 +44,7 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler { $maxDescriptionWidth = 102; $currentIndexPosition = $this->currentIndexPosition; for($currentIndexPosition;$currentIndexPosition<($this->initialIndexPosition + $this->devisCountToGet);$currentIndexPosition++){ - $this->SetFont('ComicSans', '', 8); + $currentDevis = $devisData[$currentIndexPosition]; $devisDate = $currentDevis['devis_date']; diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php index 18a59c4..29260d8 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceGroupPdfHandler.php @@ -51,6 +51,8 @@ class InvoiceGroupPdfHandler extends FPDF { public $startingYOfArticlesTable = 95; public int $maxArticlePerPage = 19; public $additionalArticlesLineBasedOnMultiline = 0; + public $interLigneHeader = 5; + function Header() { if($this->logo != "nothing"){ @@ -77,12 +79,12 @@ class InvoiceGroupPdfHandler extends FPDF { $originalHeight = $originalHeight * 0.264583; // Augmenter l'échelle, par exemple, 1.5 pour 150% de la taille d'origine - $scale = 2; + $scale = 1.7; $width = $originalWidth * $scale; $height = $originalHeight * $scale; // Calculer la position pour centrer l'image $x = (210 - $width) / 2 + 15; // Décalage à droite de 15 mm - $y = (297 - $height) / 2; // 297 mm est la hauteur d'une page A4 + $y = ((297 - $height) / 2 ) + 30; // 297 mm est la hauteur d'une page A4 // Ajouter l'image en filigrane $this->Image($imagePath, $x, $y, $width, $height); // Chemin, position x, position y, largeur, hauteur @@ -97,14 +99,23 @@ class InvoiceGroupPdfHandler extends FPDF { $this->SetDrawColor(0, 0, 0, $alpha * 255); } + public function DrawInvoiceCompanyAndClientInfo(){ + $this->DrawInvoiceCompanyInfo(); + $this->DrawInvoiceClientInfo(); + + } + function Footer() { $this->SetY(-34); - $this->SetFont('ComicSans', '', size: 7); - $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->SetFont('ComicSans', '', 7); + + $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 '))); + $this->MultiCell(0,4,utf8_decode(html_entity_decode('( 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('sera appliquée.'))); $this->Ln(1); - $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->MultiCell(0,4,utf8_decode(html_entity_decode('Si les frais de recouvrement sont supérieurs à ce montant forfaitaire, une indemnisation complémentaire'))); + $this->MultiCell(0,4,utf8_decode(html_entity_decode('sera due sur présentation de justificatifs ( articles L.441-3 et L.441-6 du code de commerce ).'))); $this->SetY(-10); $this->SetFont('ComicSans', '', 7); @@ -151,11 +162,11 @@ class InvoiceGroupPdfHandler extends FPDF { public function DrawInvoiceCompanyInfo(){ $this->SetY(40); $this->SetFont('ComicSans', '', 10); - $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); + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($this->factureData['configuration']->entreprise), 0, 1); + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse']), 0, 1); + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($this->factureData['configuration_adresse_city']), 0, 1); + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->factureData['configuration']->telephone),0,1); + $this->Cell(0, $this->interLigneHeader, 'Mail : ' . $this->factureData['configuration']->mail, 0, 1); } public function DrawInvoiceClientInfo(){ $this->SetFont('ComicSans', '', 10); @@ -168,8 +179,8 @@ class InvoiceGroupPdfHandler extends FPDF { $clientInfoYAxis = 40; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName)); - $clientInfoYAxis += 4; + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName)); + $clientInfoYAxis += $this->interLigneHeader; if ( $this->factureData['group_type'] == 'single' ) { $address = FileExportHelpers::FormatTextForExport(trim($clientAddress)); $addressWidth = $this->GetStringWidth($address); @@ -178,19 +189,19 @@ class InvoiceGroupPdfHandler extends FPDF { $this->SetXY($clientInfoXAxis,$clientInfoYAxis); if ($addressWidthGreaterThanMaxWidth) { $yBefore = $this->GetY(); - $this->MultiCell($availableWidhtForClientInfo, 4, $address,0,'L'); + $this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address,0,'L'); $yAfter = $this->GetY(); - $isMultiline = ($yAfter - $yBefore) > 4; + $isMultiline = ($yAfter - $yBefore) > $this->interLigneHeader; if($isMultiline){ $this->SetXY($this->GetX(),$yBefore); } } else { - $this->Cell($availableWidhtForClientInfo, 4, $address); + $this->Cell($availableWidhtForClientInfo, $this->interLigneHeader, $address); } if($isMultiline){ - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; } - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; }else{ $clientAddresses = explode(",",$clientAddress); @@ -202,31 +213,27 @@ class InvoiceGroupPdfHandler extends FPDF { $this->SetXY($clientInfoXAxis,$clientInfoYAxis); if ($addressWidthGreaterThanMaxWidth) { $yBefore = $this->GetY(); - $this->MultiCell($availableWidhtForClientInfo, 4, $address,0,'L'); + $this->MultiCell($availableWidhtForClientInfo, $this->interLigneHeader, $address,0,'L'); $yAfter = $this->GetY(); - $isMultiline = ($yAfter - $yBefore) > 4; + $isMultiline = ($yAfter - $yBefore) > $this->interLigneHeader; if($isMultiline){ $this->SetXY($this->GetX(),$yBefore); } } else { - $this->Cell($availableWidhtForClientInfo, 4, $address); + $this->Cell($availableWidhtForClientInfo, $this->interLigneHeader, $address); } if($isMultiline){ - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; } - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; } } $this->SetXY($clientInfoXAxis,$clientInfoYAxis + 1); - $this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); + $this->Cell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); } - public function DrawInvoiceCompanyAndClientInfo(){ - $this->DrawInvoiceCompanyInfo(); - $this->DrawInvoiceClientInfo(); - - } + public function DrawInvoiceInfoTable(){ $this->setY(67); @@ -236,13 +243,14 @@ class InvoiceGroupPdfHandler extends FPDF { $factureDatePaiement = $factureDatePaiement->format('d-m-Y'); $factureDateEcheance->modify('last day of next month'); $factureDateEcheance = $factureDateEcheance->format('d-m-Y'); - $this->SetFont('ComicSans', 'B', 11); + + $this->SetFont('ComicSans', '', 9); $this->Cell(25, 7, 'DATE', 1, 0, 'C'); $this->Cell(104, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(39, 7, 'FACTURE', 1, 0, 'C'); $this->Cell(36, 7, 'ECHEANCE', 1, 1, 'C'); - $this->SetFont('ComicSans', '', 10); + $this->SetFont('ComicSans', '', 9); $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'); @@ -256,6 +264,7 @@ class InvoiceGroupPdfHandler extends FPDF { $gapBetweenStartingOfArticlesTableAndColumnName = 10; $tableHeight = $this->thereIsOrderOrCaseNumber ? 137 : 137 + 10; $this->Rect(3, $this->startingYOfArticlesTable, 204, $tableHeight, "D"); + // $this->RoundedRect(3, $this->startingYOfArticlesTable, 204, $tableHeight,5 ,'1234',"D"); // cadre titre des colonnes $this->Line(3, $this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName, 207,$this->startingYOfArticlesTable + $gapBetweenStartingOfArticlesTableAndColumnName); // les traits verticaux colonnes @@ -305,8 +314,7 @@ class InvoiceGroupPdfHandler extends FPDF { $products = $currentDevis["products"]; $productIncrement = 0; foreach($products as $product){ - $this->SetFont('ComicSans', '', 8); - + $valueHt = $product['produit_price'] * $product["quantite"]; $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); $totalHt+=$valueHt; @@ -365,7 +373,7 @@ class InvoiceGroupPdfHandler extends FPDF { public function DrawBankAndTotalPriceInfo(){ $this->SetY(238); - $this->SetFont('ComicSans', '', 7); + $this->SetFont('ComicSans', '', 8); $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 :"))); @@ -474,4 +482,62 @@ class InvoiceGroupPdfHandler extends FPDF { } return $nl; } + + + private function RoundedRect($x, $y, $w, $h, $r, $corners = '1234', $style = '') + { + $k = $this->k; + $hp = $this->h; + if($style=='F') + $op='f'; + elseif($style=='FD' || $style=='DF') + $op='B'; + else + $op='S'; + $MyArc = 4/3 * (sqrt(2) - 1); + $this->_out(sprintf('%.2F %.2F m',($x+$r)*$k,($hp-$y)*$k )); + + $xc = $x+$w-$r; + $yc = $y+$r; + $this->_out(sprintf('%.2F %.2F l', $xc*$k,($hp-$y)*$k )); + if (strpos($corners, '2')===false) + $this->_out(sprintf('%.2F %.2F l', ($x+$w)*$k,($hp-$y)*$k )); + else + $this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); + + $xc = $x+$w-$r; + $yc = $y+$h-$r; + $this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-$yc)*$k)); + if (strpos($corners, '3')===false) + $this->_out(sprintf('%.2F %.2F l',($x+$w)*$k,($hp-($y+$h))*$k)); + else + $this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); + + $xc = $x+$r; + $yc = $y+$h-$r; + $this->_out(sprintf('%.2F %.2F l',$xc*$k,($hp-($y+$h))*$k)); + if (strpos($corners, '4')===false) + $this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-($y+$h))*$k)); + else + $this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); + + $xc = $x+$r ; + $yc = $y+$r; + $this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$yc)*$k )); + if (strpos($corners, '1')===false) + { + $this->_out(sprintf('%.2F %.2F l',($x)*$k,($hp-$y)*$k )); + $this->_out(sprintf('%.2F %.2F l',($x+$r)*$k,($hp-$y)*$k )); + } + else + $this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); + $this->_out($op); + } + + private function _Arc($x1, $y1, $x2, $y2, $x3, $y3) + { + $h = $this->h; + $this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c ', $x1*$this->k, ($h-$y1)*$this->k, + $x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k)); + } } diff --git a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php index ab33335..44e4a18 100644 --- a/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php +++ b/gestion/lib/Service/InvoiceGroupPdfHandler/InvoiceOgfPdfHandler.php @@ -45,22 +45,22 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler { $clientInfoYAxis = $clientAdressIsMultiline ? 35 : 39; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->Cell(0, 4, FileExportHelpers::FormatTextForExport($clientName)); - $clientInfoYAxis += 4; + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName)); + $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->MultiCell( 0, 4, trim(FileExportHelpers::FormatTextForExport($clientAddress))); + $this->MultiCell( 0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($clientAddress))); if($clientAdressIsMultiline){ - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; } - $clientInfoYAxis += 4; + $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->Cell(0, 4, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); - $clientInfoYAxis += 4; + $this->Cell(0, $this->interLigneHeader, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city']))); + $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']); - $clientInfoYAxis += 4; + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport('Numéro') . ' Siret: ' . $this->factureData['siret']); + $clientInfoYAxis += $this->interLigneHeader; $this->SetXY($clientInfoXAxis,$clientInfoYAxis); - $this->Cell(0, 4, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']); + $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport('Mail : ') . $this->factureData['client_mail']); } public function DrawInvoiceInfoTable(){ @@ -71,7 +71,7 @@ class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler { $factureDatePaiement = $factureDatePaiement->format('d-m-Y'); $factureDateEcheance->modify('last day of next month'); $factureDateEcheance = $factureDateEcheance->format('d-m-Y'); - $this->SetFont('ComicSans', 'B', 11); + $this->SetFont('ComicSans', '', 9); $this->Cell(30, 7, 'DATE', 1, 0, 'C'); $this->Cell(60, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(40, 7, 'FACTURE', 1, 0, 'C');