log production dv thanato

This commit is contained in:
Tiavina 2025-08-18 14:49:33 +03:00 committed by Tolotsoa
parent 7dd75e4076
commit 458ad6588a
6 changed files with 198 additions and 186 deletions

View File

@ -603,7 +603,7 @@ class PageController extends Controller {
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
// logo : 80 de largeur et 55 de hauteur // logo : 80 de largeur et 55 de hauteur
$pdf->Image($this->src_path."logo.png", 10, 10, 75, 25); $pdf->Image($this->src_path."logo.png", 4, 2, 50, 35);
// adresse du facture // adresse du facture
$pdf->SetFont('Arial','B',11); $_x = 122 ; $_y = 40; $pdf->SetFont('Arial','B',11); $_x = 122 ; $_y = 40;
$pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode('Groupe COGF'), 0, 0, ''); $_y += 8; $pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode('Groupe COGF'), 0, 0, ''); $_y += 8;
@ -658,7 +658,7 @@ class PageController extends Controller {
$pdf->SetAutoPagebreak(False); $pdf->SetAutoPagebreak(False);
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
$pdf->Image($this->src_path."logo.png", 10, 10, 75, 25); $pdf->Image($this->src_path."logo.png", 4, 2, 50, 35);
// n° page en haute à droite // n° page en haute à droite
if($nb_page>1){ if($nb_page>1){
@ -865,7 +865,7 @@ class PageController extends Controller {
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
// logo : 80 de largeur et 55 de hauteur // logo : 80 de largeur et 55 de hauteur
$pdf->Image($this->src_path."logo.png", 10, 10, 75, 25); $pdf->Image($this->src_path."logo.png", 4, 2, 50, 35);
// adresse du facture // adresse du facture
$pdf->SetFont('ComicSans','B',11); $_x = 122 ; $_y = 40; $pdf->SetFont('ComicSans','B',11); $_x = 122 ; $_y = 40;
$pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $_y += 8; $pdf->SetXY( $_x, $_y ); $pdf->Cell( 100, 8, utf8_decode($current_client), 0, 0, ''); $_y += 8;
@ -920,7 +920,7 @@ class PageController extends Controller {
$pdf->SetAutoPagebreak(False); $pdf->SetAutoPagebreak(False);
$pdf->SetMargins(0,0,0); $pdf->SetMargins(0,0,0);
$pdf->Image($this->src_path."logo.png", 10, 10, 75, 25); $pdf->Image($this->src_path."logo.png", 4, 2, 50, 35);
// n° page en haute à droite // n° page en haute à droite
if($nb_page>1){ if($nb_page>1){
@ -2186,7 +2186,7 @@ class PageController extends Controller {
// logo : 80 de largeur et 55 de hauteur // logo : 80 de largeur et 55 de hauteur
$logo = $this->getLogo(); $logo = $this->getLogo();
if($logo != 'nothing'){ if($logo != 'nothing'){
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 4, 2, 50, 35);
} }
$pdf->setXY(15, 15); $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("N : ".$numFacture)), '', 'R'); $pdf->setXY(15, 15); $pdf->SetFont('ComicSans', '', 10); $pdf->MultiCell(0, 5, utf8_decode(html_entity_decode("N : ".$numFacture)), '', 'R');
@ -2474,7 +2474,7 @@ class PageController extends Controller {
// logo : 80 de largeur et 55 de hauteur // logo : 80 de largeur et 55 de hauteur
$logo = $this->getLogo(); $logo = $this->getLogo();
if($logo != 'nothing'){ if($logo != 'nothing'){
$pdf->Image($this->defaultImagePath."logo.png", 10, 10, 75, 25); $pdf->Image($this->defaultImagePath."logo.png", 4, 2, 50, 35);
} }
$pdf->SetY(45); $pdf->SetFont('ComicSans', 'B', 15); $pdf->Cell(0, 10, utf8_decode(html_entity_decode("ATTESTATION BIJOU(X)")), 0, 0, 'C'); $pdf->SetY(45); $pdf->SetFont('ComicSans', 'B', 15); $pdf->Cell(0, 10, utf8_decode(html_entity_decode("ATTESTATION BIJOU(X)")), 0, 0, 'C');

View File

@ -42,7 +42,7 @@ class CareCertificatePdfHandler extends FPDF {
function Header() function Header()
{ {
if($this->logo != "nothing"){ if($this->logo != "nothing"){
$this->Image($this->imagePath."logo.png", 10, 10, 75, 25); $this->Image($this->imagePath."logo.png", 4, 2, 50, 35);
} }
else{ else{
$this->Cell(55,30,''); $this->Cell(55,30,'');

View File

@ -32,7 +32,8 @@ use OCA\Gestion\Helpers\DateHelpers;
use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers; use OCA\Gestion\Helpers\PriceHelpers;
class PacemakerCertificatePdfHandler extends FPDF { class PacemakerCertificatePdfHandler extends FPDF
{
private $devisOfDefunt = []; private $devisOfDefunt = [];
private $logo = null; private $logo = null;
@ -41,11 +42,10 @@ class PacemakerCertificatePdfHandler extends FPDF {
function Header() function Header()
{ {
if($this->logo != "nothing"){ if ($this->logo != "nothing") {
$this->Image($this->imagePath."logo.png", 10, 10, 75, 25); $this->Image($this->imagePath . "logo.png", 4, 2, 50, 35);
} } else {
else{ $this->Cell(55, 30, '');
$this->Cell(55,30,'');
} }
} }
function Footer() function Footer()
@ -53,108 +53,120 @@ class PacemakerCertificatePdfHandler extends FPDF {
$this->SetY(-18); $this->SetY(-18);
$this->SetFont('ComicSans', '', 10); $this->SetFont('ComicSans', '', 10);
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C'); $this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->legal_one)), 0, 'C');
$this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0,'C'); $this->MultiCell(0, 5, utf8_decode(html_entity_decode($this->devisOfDefunt['configuration']->adresse)), 0, 'C');
} }
public function SetPacemakerCertificateData(array $devisOfDefunt,$logo = null,$signatureImageExist = false){ public function SetPacemakerCertificateData(array $devisOfDefunt, $logo = null, $signatureImageExist = false)
{
$this->devisOfDefunt = $devisOfDefunt; $this->devisOfDefunt = $devisOfDefunt;
$this->logo = $logo; $this->logo = $logo;
$this->signatureImageExist = $signatureImageExist; $this->signatureImageExist = $signatureImageExist;
} }
public function SetPacemakerCertificate(){ public function SetPacemakerCertificate()
{
$this->AddPage(); $this->AddPage();
$this->SetMargins(left:20,top:0,right:20); $this->SetMargins(left: 20, top: 0, right: 20);
$this->SetPacemakerCertificateTitle(); $this->SetPacemakerCertificateTitle();
$this->SetPacemakerCertificateContent(); $this->SetPacemakerCertificateContent();
$this->SetSigning(); $this->SetSigning();
} }
private function SetSigning(){ private function SetSigning()
$this->SetXY(140,$this->GetY() + 15); {
$this->Cell(0,10,'Cachet et signature'); $this->SetXY(140, $this->GetY() + 15);
$this->Cell(0, 10, 'Cachet et signature');
if($this->signatureImageExist){ if ($this->signatureImageExist) {
$this->Image($this->imagePath."sign.png", 135, $this->GetY() + 12, 60, 40); $this->Image($this->imagePath . "sign.png", 135, $this->GetY() + 12, 60, 40);
} }
} }
private function SetPacemakerCertificateContent(){ private function SetPacemakerCertificateContent()
{
$this->SetFont('ComicSans', '', 14); $this->SetFont('ComicSans', '', 14);
$this->MultiCell(0,7,FileExportHelpers::FormatTextForExport('La Société '. $this->devisOfDefunt['configuration']->entreprise. ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : ')); $this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('La Société ' . $this->devisOfDefunt['configuration']->entreprise . ' habilitée sous le numéro ' . $this->devisOfDefunt['thanato_reference'] . ', certifie par la présente que : '));
$this->SetFont('ComicSans', 'B', 14); $this->SetFont('ComicSans', 'B', 14);
$this->Cell(0,12, 'Mr/Mme ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']),0,1); $this->Cell(0, 12, 'Mr/Mme ' . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['thanato_nom'] . ' ' . $this->devisOfDefunt['thanato_prenom']), 0, 1);
$this->SetFont('ComicSans', '', 14); $this->SetFont('ComicSans', '', 14);
$this->MultiCell(0,7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, la prothèse fonctionnant à pile implantée sur le corps du défunt :')); $this->MultiCell(0, 7, FileExportHelpers::FormatTextForExport('Employé(e) au sein de notre société et titulaire du diplôme national de Thanatopracteur, a retiré ce jour, la prothèse fonctionnant à pile implantée sur le corps du défunt :'));
$this->SetFont('ComicSans', 'B', 14); $this->SetFont('ComicSans', 'B', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']),0,1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_nom']), 0, 1);
$this->SetFont('ComicSans', '', 14); $this->SetFont('ComicSans', '', 14);
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ',0,1); $this->Cell(0, 12, FileExportHelpers::FormatTextForExport("Qui reposait à l'adresse suivante") . ' : ', 0, 1);
$this->SetFont('ComicSans', 'B', 14); $this->SetFont('ComicSans', 'B', 14);
$this->MultiCell(0,6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis'])); $this->MultiCell(0, 6, FileExportHelpers::FormatTextForExport($this->devisOfDefunt['location_of_devis']));
$this->Ln(6); $this->Ln(6);
$this->SetFont('ComicSans', '', 14); $this->SetFont('ComicSans', '', 14);
$this->Cell(0,6, $this->Cell(
FileExportHelpers::FormatTextForExport("Numéro de série : "). 0,
FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_reference_pacemaker']),0,1); 6,
$this->Cell(0,6, FileExportHelpers::FormatTextForExport("Numéro de série : ") .
FileExportHelpers::FormatTextForExport("Marque du produit : "). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_reference_pacemaker']),
FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_product_brand']),0,1); 0,
$this->Cell(0,12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."),0,5); 1
);
$this->Cell(
0,
6,
FileExportHelpers::FormatTextForExport("Marque du produit : ") .
FileExportHelpers::FormatTextForExport($this->devisOfDefunt['defunt_product_brand']),
0,
1
);
$this->Cell(0, 12, FileExportHelpers::FormatTextForExport("La présente attestation est établie pour faire valoir ce que de droit."), 0, 5);
$this->Ln(5); $this->Ln(5);
$this->MultiAlignCell(120,7,FileExportHelpers::FormatTextForExport('Fait à '). FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->adresse),0); $this->MultiAlignCell(120, 7, FileExportHelpers::FormatTextForExport('Fait à ') . FileExportHelpers::FormatTextForExport($this->devisOfDefunt['configuration']->adresse), 0);
$this->SetX(140); $this->SetX(140);
$this->Cell(0,7,'le '. $this->devisOfDefunt['devis_date']->format('d/m/Y'),0); $this->Cell(0, 7, 'le ' . $this->devisOfDefunt['devis_date']->format('d/m/Y'), 0);
} }
private function SetPacemakerCertificateTitle(){ private function SetPacemakerCertificateTitle()
{
$this->SetY(y: 50); $this->SetY(y: 50);
$this->SetFont('ComicSans', 'B', 20); $this->SetFont('ComicSans', 'B', 20);
$this->Cell(0,10,'ATTESTATION DE RETRAIT DE LA',0,1,'C'); $this->Cell(0, 10, 'ATTESTATION DE RETRAIT DE LA', 0, 1, 'C');
$this->Cell(0,10,'PROTHESE FONCTIONNANT A PILE',0,1,'C'); $this->Cell(0, 10, 'PROTHESE FONCTIONNANT A PILE', 0, 1, 'C');
$this->Ln(20); $this->Ln(20);
} }
function MultiAlignCell($w,$h,$text,$border=0,$ln=0,$align='L',$fill=false) function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
{ {
// Store reset values for (x,y) positions // Store reset values for (x,y) positions
$x = $this->GetX() + $w; $x = $this->GetX() + $w;
$y = $this->GetY(); $y = $this->GetY();
// Make a call to FPDF's MultiCell // Make a call to FPDF's MultiCell
$this->MultiCell($w,$h,$text,$border,$align,$fill); $this->MultiCell($w, $h, $text, $border, $align, $fill);
// Reset the line position to the right, like in Cell // Reset the line position to the right, like in Cell
if( $ln==0 ) if ($ln == 0) {
{ $this->SetXY($x, $y);
$this->SetXY($x,$y); }
} }
}
function NbLines($w, $txt) function NbLines($w, $txt)
{ {
// Compute the number of lines a MultiCell of width w will take // Compute the number of lines a MultiCell of width w will take
if(!isset($this->CurrentFont)) if (!isset($this->CurrentFont))
$this->Error('No font has been set'); $this->Error('No font has been set');
$cw = $this->CurrentFont['cw']; $cw = $this->CurrentFont['cw'];
if($w==0) if ($w == 0)
$w = $this->w-$this->rMargin-$this->x; $w = $this->w - $this->rMargin - $this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r",'',(string)$txt); $s = str_replace("\r", '', (string) $txt);
$nb = strlen($s); $nb = strlen($s);
if($nb>0 && $s[$nb-1]=="\n") if ($nb > 0 && $s[$nb - 1] == "\n")
$nb--; $nb--;
$sep = -1; $sep = -1;
$i = 0; $i = 0;
$j = 0; $j = 0;
$l = 0; $l = 0;
$nl = 1; $nl = 1;
while($i<$nb) while ($i < $nb) {
{
$c = $s[$i]; $c = $s[$i];
if($c=="\n") if ($c == "\n") {
{
$i++; $i++;
$sep = -1; $sep = -1;
$j = $i; $j = $i;
@ -162,24 +174,20 @@ class PacemakerCertificatePdfHandler extends FPDF {
$nl++; $nl++;
continue; continue;
} }
if($c==' ') if ($c == ' ')
$sep = $i; $sep = $i;
$l += $cw[$c]; $l += $cw[$c];
if($l>$wmax) if ($l > $wmax) {
{ if ($sep == -1) {
if($sep==-1) if ($i == $j)
{
if($i==$j)
$i++; $i++;
} } else
else $i = $sep + 1;
$i = $sep+1;
$sep = -1; $sep = -1;
$j = $i; $j = $i;
$l = 0; $l = 0;
$nl++; $nl++;
} } else
else
$i++; $i++;
} }
return $nl; return $nl;

View File

@ -31,7 +31,8 @@ use \FPDF;
use OCA\Gestion\Helpers\FileExportHelpers; use OCA\Gestion\Helpers\FileExportHelpers;
use OCA\Gestion\Helpers\PriceHelpers; use OCA\Gestion\Helpers\PriceHelpers;
class DevisPdfHandler extends FPDF { class DevisPdfHandler extends FPDF
{
private $multipleDevisData = []; private $multipleDevisData = [];
private $devisData = []; private $devisData = [];
@ -39,53 +40,57 @@ class DevisPdfHandler extends FPDF {
private $logoPath = "/var/www/html/data/admin/files/.gestion/"; private $logoPath = "/var/www/html/data/admin/files/.gestion/";
function Header() function Header()
{ {
if($this->logo != "nothing"){ if ($this->logo != "nothing") {
$this->Image($this->logoPath."logo.png", 10, 10, 75, 25); $this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
} } else {
else{ $this->Cell(55, 30, '');
$this->Cell(55,30,'');
} }
} }
function Footer() function Footer()
{ {
$this->SetY(-40); $this->SetY(-40);
$this->SetFont('ComicSans', '', 7); $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->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->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->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->SetY(-15);
$this->SetFont('ComicSans', 'B', 8); $this->SetFont('ComicSans', 'B', 8);
$this->Cell(0, 10, utf8_decode(html_entity_decode($this->devisData['configuration']->legal_one)), 0, 0, 'C'); $this->Cell(0, 10, utf8_decode(html_entity_decode($this->devisData['configuration']->legal_one)), 0, 0, 'C');
} }
public function SetDevisPdfData(array $devisData,$logo = null){ public function SetDevisPdfData(array $devisData, $logo = null)
{
$this->devisData = $devisData; $this->devisData = $devisData;
$this->logo = $logo; $this->logo = $logo;
} }
public function SetMultipleDevisPdfData(array $multipleDevisData,$logo = null){ public function SetMultipleDevisPdfData(array $multipleDevisData, $logo = null)
{
$this->multipleDevisData = $multipleDevisData; $this->multipleDevisData = $multipleDevisData;
$this->logo = $logo; $this->logo = $logo;
} }
private function DrawDevisCompanyAndClientInfo(){ private function DrawDevisCompanyAndClientInfo()
{
$this->SetY(40); $this->SetY(40);
$this->SetFont('ComicSans', '', 12); $this->SetFont('ComicSans', '', 12);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration']->entreprise), 0, 0); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration']->entreprise), 0, 0);
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['client_nom']), 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['client_nom']), 0, 1, 'R');
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration_adresse']), 0, 0); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration_adresse']), 0, 0);
$this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->devisData['client_real_adress'])), 0, 1,'R'); $this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->devisData['client_real_adress'])), 0, 1, 'R');
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration_adresse_city']), 0, 0);border: $this->Cell(0, 7, FileExportHelpers::FormatTextForExport($this->devisData['configuration_adresse_city']), 0, 0);
$this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->devisData['client_adress_city'])), 0, 1,'R'); border:
$this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->devisData['configuration']->telephone),0,0); $this->Cell(0, 7, trim(FileExportHelpers::FormatTextForExport($this->devisData['client_adress_city'])), 0, 1, 'R');
$this->Cell(0, 7, 'Siret: ' . $this->devisData['siret'], 0, 1,'R'); $this->Cell(0, 7, FileExportHelpers::FormatTextForExport('Tél : ') . FileExportHelpers::FormatTextForExport($this->devisData['configuration']->telephone), 0, 0);
$this->Cell(0, 7, 'Siret: ' . $this->devisData['siret'], 0, 1, 'R');
$this->Cell(0, 7, 'Mail : ' . $this->devisData['configuration']->mail, 0, 1); $this->Cell(0, 7, 'Mail : ' . $this->devisData['configuration']->mail, 0, 1);
$this->Ln(3); $this->Ln(3);
} }
private function DrawDevisInfoTable(){ private function DrawDevisInfoTable()
{
$this->SetFont('ComicSans', 'B', 11); $this->SetFont('ComicSans', 'B', 11);
$this->Cell(30, 7, 'DATE', 1, 0, 'C'); $this->Cell(30, 7, 'DATE', 1, 0, 'C');
$this->Cell(80, 7, 'CLIENT', 1, 0, 'C'); $this->Cell(80, 7, 'CLIENT', 1, 0, 'C');
@ -99,91 +104,95 @@ class DevisPdfHandler extends FPDF {
$this->Ln(8); $this->Ln(8);
} }
private function DrawArticlesTable(){ private function DrawArticlesTable()
$this->SetLineWidth(0.1); {
$this->SetLineWidth(0.1);
$this->Rect(10, 105, 190, 100, "D"); $this->Rect(10, 105, 190, 100, "D");
// cadre titre des colonnes // cadre titre des colonnes
$this->Line(10, 115, 200,115); $this->Line(10, 115, 200, 115);
// les traits verticaux colonnes // les traits verticaux colonnes
$this->Line(35, 105, 35, 205); $this->Line(35, 105, 35, 205);
$this->Line(135, 105, 135, 205); $this->Line(135, 105, 135, 205);
$this->Line(155, 105, 155, 205); $this->Line(155, 105, 155, 205);
$this->Line(175, 105, 175, 205); $this->Line(175, 105, 175, 205);
} }
private function DrawArticlesTableHeader(){ private function DrawArticlesTableHeader()
{
$tvaValue = $this->devisData["configuration"]->tva_default; $tvaValue = $this->devisData["configuration"]->tva_default;
$this->SetFont('ComicSans','',10); $this->SetFont('ComicSans', '', 10);
$this->SetXY( 10,106 ); $this->SetXY(10, 106);
$this->Cell( 20, 8, "Date", 0, 0, 'C'); $this->Cell(20, 8, "Date", 0, 0, 'C');
$this->SetXY( 35,106 ); $this->SetXY(35, 106);
$this->Cell( 100, 8, "Description", 0, 0, 'C'); $this->Cell(100, 8, "Description", 0, 0, 'C');
$this->SetXY( 135,106 ); $this->SetXY(135, 106);
$this->Cell( 20, 8, "Prix Uni. HT", 0, 0, 'C'); $this->Cell(20, 8, "Prix Uni. HT", 0, 0, 'C');
$this->SetXY( 155,106 ); $this->SetXY(155, 106);
$this->Cell( 20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C'); $this->Cell(20, 8, 'TVA ' . $tvaValue . '%', 0, 0, 'C');
$this->SetXY( 175,106 ); $this->SetXY(175, 106);
$this->Cell( 25, 8, "Prix Uni. TTC", 0, 0, 'C'); $this->Cell(25, 8, "Prix Uni. TTC", 0, 0, 'C');
} }
public function DrawArticlesTableValueAndReturnTotalPrice(){ public function DrawArticlesTableValueAndReturnTotalPrice()
$this->SetFont('ComicSans','',10); {
$this->SetFont('ComicSans', '', 10);
$tvaValue = $this->devisData["configuration"]->tva_default; $tvaValue = $this->devisData["configuration"]->tva_default;
$totalHt = 0; $totalHt = 0;
$totalTtc = 0; $totalTtc = 0;
$totalTva = 0; $totalTva = 0;
$products = $this->devisData["products"]; $products = $this->devisData["products"];
$yValue = 116; $yValue = 116;
foreach($products as $product){ foreach ($products as $product) {
$valueHt = $product['produit_price'] * $product['quantite']; $valueHt = $product['produit_price'] * $product['quantite'];
$valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt,$tvaValue); $valueTtc = PriceHelpers::calculPriceWithVatValue($valueHt, $tvaValue);
$totalHt+=$valueHt; $totalHt += $valueHt;
$totalTtc+=$valueTtc; $totalTtc += $valueTtc;
$productDescription = $product["produit_description"]; $productDescription = $product["produit_description"];
$dateValue = ""; $dateValue = "";
if($product === end($products)){ if ($product === end($products)) {
$dateValue = $this->devisData['devis_date']; $dateValue = $this->devisData['devis_date'];
$productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->devisData['defunt_sexe']) . ' '. $this->devisData["defunt_nom"]; $productDescription .= " de " . FileExportHelpers::GetSexeLabel($this->devisData['defunt_sexe']) . ' ' . $this->devisData["defunt_nom"];
} }
$tvaAmount = $valueTtc - $valueHt; $tvaAmount = $valueTtc - $valueHt;
$this->SetXY( 10,$yValue ); $this->SetXY(10, $yValue);
$this->Cell(20, 6, $dateValue, 0,0); $this->Cell(20, 6, $dateValue, 0, 0);
$this->SetXY( 35,$yValue ); $this->SetXY(35, $yValue);
$this->MultiAlignCell(100, 6, utf8_decode(html_entity_decode($productDescription)),0,'0',); $this->MultiAlignCell(100, 6, utf8_decode(html_entity_decode($productDescription)), 0, '0', );
$this->SetXY( 135,$yValue ); $this->SetXY(135, $yValue);
$this->Cell(20, 6, number_format($valueHt,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($valueHt, 2, '.', '') . chr(128), 0, 0, 'C');
$this->SetXY( 155,$yValue ); $this->SetXY(155, $yValue);
$this->Cell(20, 6, number_format($tvaAmount,2,'.','').chr(128), 0, 0, 'C'); $this->Cell(20, 6, number_format($tvaAmount, 2, '.', '') . chr(128), 0, 0, 'C');
$this->SetXY( 175,$yValue ); $this->SetXY(175, $yValue);
$this->Cell(25, 6, number_format($valueTtc,2,'.','').chr(128), 0, 1, 'C'); $this->Cell(25, 6, number_format($valueTtc, 2, '.', '') . chr(128), 0, 1, 'C');
$yValue += 12; $yValue += 12;
$totalTva += $tvaAmount; $totalTva += $tvaAmount;
} }
return [ return [
"TOTAL HT" => $totalHt, "TOTAL HT" => $totalHt,
"TVA ".$tvaValue. "%" => $totalTva, "TVA " . $tvaValue . "%" => $totalTva,
"TOTAL TTC" => $totalTtc "TOTAL TTC" => $totalTtc
]; ];
} }
private function DrawBankAndTotalPriceInfo($totalPriceArray){ private function DrawBankAndTotalPriceInfo($totalPriceArray)
{
$this->SetY(210); $this->SetY(210);
$this->SetFont('ComicSans', '', 9); $this->SetFont('ComicSans', '', 9);
$this->MultiCell(0,5,utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de ". $this->devisData['configuration']->entreprise))); $this->MultiCell(0, 5, utf8_decode(html_entity_decode("Paiement à votre convenance par chèque à l'ordre de " . $this->devisData['configuration']->entreprise)));
$this->MultiCell(0,5,utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :"))); $this->MultiCell(0, 5, utf8_decode(html_entity_decode("en indiquant le numéro de facture, ou par virement :")));
$this->Ln(1); $this->Ln(1);
//Table IBAN //Table IBAN
$this->SetFont('ComicSans', '', 11); $this->SetFont('ComicSans', '', 11);
$ibanWidth = 90; $ibanWidth = 90;
@ -193,28 +202,30 @@ class DevisPdfHandler extends FPDF {
$this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C'); $this->Cell($ibanWidth, 7, 'Code SWIFT : AGRI FR PP 836', 1, 1, 'C');
//TABLE HT //TABLE HT
$ibanLastPositionX = $ibanCursorX+$ibanWidth + 20; $ibanLastPositionX = $ibanCursorX + $ibanWidth + 20;
$startOfArrayX = $ibanLastPositionX; $startOfArrayX = $ibanLastPositionX;
$startOfArrayY = $ibanCursorY; $startOfArrayY = $ibanCursorY;
foreach($totalPriceArray as $label => $price){ foreach ($totalPriceArray as $label => $price) {
$this->SetXY($startOfArrayX,$startOfArrayY); $this->SetXY($startOfArrayX, $startOfArrayY);
$this->Cell(40, 7, $label, 1, 1, 'C'); $this->Cell(40, 7, $label, 1, 1, 'C');
$this->SetXY($startOfArrayX + 40,$startOfArrayY); $this->SetXY($startOfArrayX + 40, $startOfArrayY);
$this->Cell(40, 7, number_format($price,2,'.','').chr(128), 1, 1, 'C'); $this->Cell(40, 7, number_format($price, 2, '.', '') . chr(128), 1, 1, 'C');
$startOfArrayY += 7; $startOfArrayY += 7;
} }
} }
public function SetMultipleDevisContent(){ public function SetMultipleDevisContent()
foreach($this->multipleDevisData as $devisData){ {
foreach ($this->multipleDevisData as $devisData) {
$this->devisData = $devisData; $this->devisData = $devisData;
$this->SetDevisContent(); $this->SetDevisContent();
} }
} }
public function SetDevisContent(){ public function SetDevisContent()
{
$this->AddPage(); $this->AddPage();
$this->SetMargins(10,0,10); $this->SetMargins(10, 0, 10);
$this->DrawDevisCompanyAndClientInfo(); $this->DrawDevisCompanyAndClientInfo();
$this->DrawDevisInfoTable(); $this->DrawDevisInfoTable();
$this->DrawArticlesTable(); $this->DrawArticlesTable();
@ -223,45 +234,42 @@ class DevisPdfHandler extends FPDF {
$this->DrawBankAndTotalPriceInfo($totalPriceValue); $this->DrawBankAndTotalPriceInfo($totalPriceValue);
} }
function MultiAlignCell($w,$h,$text,$border=0,$ln=0,$align='L',$fill=false) function MultiAlignCell($w, $h, $text, $border = 0, $ln = 0, $align = 'L', $fill = false)
{ {
// Store reset values for (x,y) positions // Store reset values for (x,y) positions
$x = $this->GetX() + $w; $x = $this->GetX() + $w;
$y = $this->GetY(); $y = $this->GetY();
// Make a call to FPDF's MultiCell // Make a call to FPDF's MultiCell
$this->MultiCell($w,$h,$text,$border,$align,$fill); $this->MultiCell($w, $h, $text, $border, $align, $fill);
// Reset the line position to the right, like in Cell // Reset the line position to the right, like in Cell
if( $ln==0 ) if ($ln == 0) {
{ $this->SetXY($x, $y);
$this->SetXY($x,$y); }
} }
}
function NbLines($w, $txt) function NbLines($w, $txt)
{ {
// Compute the number of lines a MultiCell of width w will take // Compute the number of lines a MultiCell of width w will take
if(!isset($this->CurrentFont)) if (!isset($this->CurrentFont))
$this->Error('No font has been set'); $this->Error('No font has been set');
$cw = $this->CurrentFont['cw']; $cw = $this->CurrentFont['cw'];
if($w==0) if ($w == 0)
$w = $this->w-$this->rMargin-$this->x; $w = $this->w - $this->rMargin - $this->x;
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize; $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->FontSize;
$s = str_replace("\r",'',(string)$txt); $s = str_replace("\r", '', (string) $txt);
$nb = strlen($s); $nb = strlen($s);
if($nb>0 && $s[$nb-1]=="\n") if ($nb > 0 && $s[$nb - 1] == "\n")
$nb--; $nb--;
$sep = -1; $sep = -1;
$i = 0; $i = 0;
$j = 0; $j = 0;
$l = 0; $l = 0;
$nl = 1; $nl = 1;
while($i<$nb) while ($i < $nb) {
{
$c = $s[$i]; $c = $s[$i];
if($c=="\n") if ($c == "\n") {
{
$i++; $i++;
$sep = -1; $sep = -1;
$j = $i; $j = $i;
@ -269,24 +277,20 @@ class DevisPdfHandler extends FPDF {
$nl++; $nl++;
continue; continue;
} }
if($c==' ') if ($c == ' ')
$sep = $i; $sep = $i;
$l += $cw[$c]; $l += $cw[$c];
if($l>$wmax) if ($l > $wmax) {
{ if ($sep == -1) {
if($sep==-1) if ($i == $j)
{
if($i==$j)
$i++; $i++;
} } else
else $i = $sep + 1;
$i = $sep+1;
$sep = -1; $sep = -1;
$j = $i; $j = $i;
$l = 0; $l = 0;
$nl++; $nl++;
} } else
else
$i++; $i++;
} }
return $nl; return $nl;

View File

@ -57,7 +57,7 @@ class InvoiceGroupPdfHandler extends FPDF
function Header() function Header()
{ {
if ($this->logo != "nothing") { if ($this->logo != "nothing") {
$this->Image($this->logoPath . "logo.png", 2, 10, 75, 25); $this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
$this->AddWatermark(); $this->AddWatermark();
} else { } else {
$this->Cell(55, 30, ''); $this->Cell(55, 30, '');

View File

@ -52,7 +52,7 @@ class InvoicePdfHandler extends FPDF
function Header() function Header()
{ {
if ($this->logo != "nothing") { if ($this->logo != "nothing") {
$this->Image($this->logoPath . "logo.png", 2, 10, 75, 25); $this->Image($this->logoPath . "logo.png", 4, 2, 50, 35);
$this->AddWatermark(); $this->AddWatermark();
} else { } else {
$this->Cell(55, 30, ''); $this->Cell(55, 30, '');
@ -172,13 +172,13 @@ class InvoicePdfHandler extends FPDF
$addressWidth = $this->GetStringWidth($address); $addressWidth = $this->GetStringWidth($address);
$addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo;
$addressIsMoreThanTwoLines = ($addressWidth / $availableWidhtForClientInfo) > 2; $addressIsMoreThanTwoLines = ($addressWidth / $availableWidhtForClientInfo) > 2;
$clientInfoYAxis = $addressIsMoreThanTwoLines ? 35 : 35;// the old is ? 35 : 39 but not working $clientInfoYAxis = $addressIsMoreThanTwoLines ? 35 : 35;// the old is ? 35 : 39 but not working
$this->SetXY($clientInfoXAxis, $clientInfoYAxis); $this->SetXY($clientInfoXAxis, $clientInfoYAxis);
$this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName)); $this->Cell(0, $this->interLigneHeader, FileExportHelpers::FormatTextForExport($clientName));
$clientInfoYAxis += $this->interLigneHeader; $clientInfoYAxis += $this->interLigneHeader;
$clientAddresses = explode(",", $clientAddress); $clientAddresses = explode(",", $clientAddress);
foreach ($clientAddresses as $address) { foreach ($clientAddresses as $address) {
$address = FileExportHelpers::FormatTextForExport(trim($address)); $address = FileExportHelpers::FormatTextForExport(trim($address));
$addressWidth = $this->GetStringWidth($address); $addressWidth = $this->GetStringWidth($address);
$addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo; $addressWidthGreaterThanMaxWidth = $addressWidth > $availableWidhtForClientInfo;