finish 3 different templates for group devis to pdf
This commit is contained in:
parent
69099e7187
commit
9c6ba888f9
@ -33,53 +33,6 @@ use OCA\Gestion\Helpers\PriceHelpers;
|
||||
class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
|
||||
public int $maxArticlePerPage = 6;
|
||||
|
||||
public function DrawInvoiceClientInfo(){
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$clientName = $this->factureData['group_name'];
|
||||
$clientInfoXAxis = 125;
|
||||
|
||||
$clientAddress = $this->factureData['client_real_adress'];
|
||||
$clientAdressWidth = $this->GetStringWidth($clientAddress);
|
||||
$maxWidth = $this->GetPageWidth();
|
||||
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
|
||||
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
|
||||
|
||||
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->MultiCell( 0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
|
||||
if($clientAdressIsMultiline){
|
||||
$clientInfoYAxis += 5;
|
||||
}
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, trim(FileExportHelpers::FormatTextForExport($this->factureData['client_adress_city'])));
|
||||
}
|
||||
public function DrawInvoiceInfoTable(){
|
||||
$this->setY(67);
|
||||
$factureDatePaiement = $this->factureData['date_paiement'];
|
||||
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
||||
$factureDateEcheance = $factureDatePaiement;
|
||||
$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->Cell(30, 7, 'DATE', 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(94, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
public function DrawArticlesTableValue(){
|
||||
$this->SetFont('ComicSans','',10);
|
||||
$devisData = $this->factureData['devis'];
|
||||
@ -145,12 +98,8 @@ class InvoiceFunecapPdfHandler extends InvoiceGroupPdfHandler {
|
||||
$this->currentIndexPosition = $currentIndexPosition;
|
||||
$this->initialIndexPosition = $this->currentIndexPosition;
|
||||
$chargedDevisCount = $this->currentIndexPosition + 1;
|
||||
var_dump("CURRENT POSITION : ".$this->currentIndexPosition);
|
||||
var_dump("CHARGED DEVIS COUNT : ".$chargedDevisCount);
|
||||
$devisLeftToGet = $this->devisCount - $chargedDevisCount;
|
||||
var_dump("LEFT TO GET : ".$devisLeftToGet);
|
||||
$this->devisCountToGet = ($devisLeftToGet <= $this->maxArticlePerPage) ? $devisLeftToGet + 1 : $this->maxArticlePerPage;
|
||||
var_dump("DEVIS COUNT TO GET : ".$this->devisCountToGet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
function Footer()
|
||||
{
|
||||
$this->SetY(-35);
|
||||
$this->SetFont('ComicSans', '', 7);
|
||||
$this->SetFont('ComicSans', '', size: 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 ).
|
||||
@ -146,12 +146,6 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$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']);
|
||||
}
|
||||
|
||||
public function DrawInvoiceCompanyAndClientInfo(){
|
||||
@ -169,17 +163,15 @@ class InvoiceGroupPdfHandler extends FPDF {
|
||||
$factureDateEcheance = $factureDateEcheance->format('d-m-Y');
|
||||
$this->SetFont('ComicSans', 'B', 11);
|
||||
$this->Cell(30, 7, 'DATE', 1, 0, 'C');
|
||||
$this->Cell(60, 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, 0, 'C');
|
||||
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
|
||||
$this->Cell(40, 7, 'ECHEANCE', 1, 1, 'C');
|
||||
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
|
||||
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(94, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["order_number"], 1, 1, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Calendar App
|
||||
*
|
||||
* @copyright 2021 Anna Larch <anna.larch@gmx.net>
|
||||
*
|
||||
* @author Anna Larch <anna.larch@gmx.net>
|
||||
* @author Richard Steinmetz <richard@steinmetz.cloud>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Gestion\Service\InvoiceGroupPdfHandler;
|
||||
|
||||
use DateTime;
|
||||
use OCA\Gestion\Helpers\FileExportHelpers;
|
||||
use OCA\Gestion\Helpers\PriceHelpers;
|
||||
|
||||
class InvoiceOgfPdfHandler extends InvoiceGroupPdfHandler {
|
||||
|
||||
public function DrawInvoiceClientInfo(){
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$clientName = $this->factureData['group_name'];
|
||||
$clientInfoXAxis = 125;
|
||||
|
||||
$clientAddress = $this->factureData['client_real_adress'];
|
||||
$clientAdressWidth = $this->GetStringWidth($clientAddress);
|
||||
$maxWidth = $this->GetPageWidth();
|
||||
$availableWidhtForClientInfo = $maxWidth - 10 - $clientInfoXAxis;
|
||||
$clientAdressIsMultiline = $clientAdressWidth > $availableWidhtForClientInfo;
|
||||
|
||||
$clientInfoYAxis = $clientAdressIsMultiline ? 35 : 40;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->Cell(0, 5, FileExportHelpers::FormatTextForExport($clientName));
|
||||
$clientInfoYAxis += 5;
|
||||
$this->SetXY($clientInfoXAxis,$clientInfoYAxis);
|
||||
$this->MultiCell( 0, 5, trim(FileExportHelpers::FormatTextForExport($clientAddress)));
|
||||
if($clientAdressIsMultiline){
|
||||
$clientInfoYAxis += 5;
|
||||
}
|
||||
$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']);
|
||||
}
|
||||
|
||||
public function DrawInvoiceInfoTable(){
|
||||
$this->setY(67);
|
||||
$factureDatePaiement = $this->factureData['date_paiement'];
|
||||
$factureDatePaiement = DateTime::createFromFormat('Y-m-d',$factureDatePaiement);
|
||||
$factureDateEcheance = $factureDatePaiement;
|
||||
$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->Cell(30, 7, 'DATE', 1, 0, 'C');
|
||||
$this->Cell(60, 7, 'CLIENT', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'FACTURE', 1, 0, 'C');
|
||||
$this->Cell(40, 7, 'ECHEANCE', 1, 0, 'C');
|
||||
$this->Cell(34, 7, 'COMMANDE', 1, 1, 'C');
|
||||
|
||||
$this->SetFont('ComicSans', '', 10);
|
||||
$this->Cell(30, 7, $factureDatePaiement, 1, 0, 'C');
|
||||
$this->Cell(60, 7, utf8_decode(html_entity_decode($this->factureData['group_name'])), 1, 0, 'C');
|
||||
$this->Cell(40, 7, $this->factureData['num'], 1, 0, 'C');
|
||||
$this->Cell(40, 7, $factureDateEcheance, 1, 0, 'C');
|
||||
$this->Cell(34, 7, $this->factureData["order_number"], 1, 1, 'C');
|
||||
|
||||
$this->startingYOfArticlesTable = 85;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -35,6 +35,7 @@ use OCA\Gestion\Db\Bdd;
|
||||
use OCA\Gestion\Helpers\DateHelpers;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceFunecapPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceGroupPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceGroupPdfHandler\InvoiceOgfPdfHandler;
|
||||
use OCA\Gestion\Service\InvoiceRecap\InvoiceRecapService;
|
||||
use OCP\DB\Exception;
|
||||
use OCP\Files\IRootFolder;
|
||||
@ -161,11 +162,18 @@ class InvoicePdfService {
|
||||
$templateType = $invoicePdfData['template_type_key'];
|
||||
$clean_folder = html_entity_decode(string: $currentConfig->path).'/';
|
||||
$factureFolders = $this->getGroupFactureFolder($invoicePdfData,$clean_folder);
|
||||
if($templateType == ClientTemplateTypeConstant::FUNECAP){
|
||||
$pdf = new InvoiceFunecapPdfHandler();
|
||||
}
|
||||
else{
|
||||
$pdf = new InvoiceGroupPdfHandler();
|
||||
switch ($templateType) {
|
||||
case ClientTemplateTypeConstant::FUNECAP:
|
||||
$pdf = new InvoiceFunecapPdfHandler();
|
||||
break;
|
||||
|
||||
case ClientTemplateTypeConstant::OGF:
|
||||
$pdf = new InvoiceOgfPdfHandler();
|
||||
break;
|
||||
|
||||
default:
|
||||
$pdf = new InvoiceGroupPdfHandler();
|
||||
break;
|
||||
}
|
||||
$pdf->AddFont('ComicSans','','Comic Sans MS.php');
|
||||
$pdf->AddFont('ComicSans','B','comic-sans-bold.php');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user