From 09c4f7bb93549d98f024fe18c66f425b1fbc6f3e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 4 Nov 2005 01:07:33 +0000 Subject: [PATCH] Modif gestion marges sur modele propales --- .../modules/facture/pdf_bernique.modules.php | 10 +- .../modules/facture/pdf_bigorneau.modules.php | 10 +- .../modules/facture/pdf_bulot.modules.php | 10 +- .../modules/facture/pdf_crabe.modules.php | 101 ++++++++++-------- .../modules/facture/pdf_huitre.modules.php | 10 +- .../modules/facture/pdf_oursin.modules.php | 67 ++++++------ .../modules/facture/pdf_tourteau.modules.php | 9 +- .../propale/pdf_propale_adytek.modules.php | 17 +-- .../propale/pdf_propale_azur.modules.php | 99 +++++++++-------- .../propale/pdf_propale_bleu.modules.php | 17 +-- .../propale/pdf_propale_jaune.modules.php | 17 +-- .../propale/pdf_propale_rouge.modules.php | 17 +-- .../propale/pdf_propale_vert.modules.php | 17 +-- 13 files changed, 233 insertions(+), 168 deletions(-) diff --git a/htdocs/includes/modules/facture/pdf_bernique.modules.php b/htdocs/includes/modules/facture/pdf_bernique.modules.php index c373e006e66..48ef80974ff 100644 --- a/htdocs/includes/modules/facture/pdf_bernique.modules.php +++ b/htdocs/includes/modules/facture/pdf_bernique.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** @@ -40,8 +39,13 @@ class pdf_bernique extends ModelePDFFactures { function pdf_bernique($db=0) { - $this->db = $db; - $this->description = "Modèle pour les factures avec plusieurs taux de tva, inclus aussi le numéro de TVA Intracommunautaire"; + $this->db = $db; + $this->description = "Modèle pour les factures avec plusieurs taux de tva, inclus aussi le numéro de TVA Intracommunautaire"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); } function write_pdf_file($facid) diff --git a/htdocs/includes/modules/facture/pdf_bigorneau.modules.php b/htdocs/includes/modules/facture/pdf_bigorneau.modules.php index 4eba65fe689..62286fc2e6e 100644 --- a/htdocs/includes/modules/facture/pdf_bigorneau.modules.php +++ b/htdocs/includes/modules/facture/pdf_bigorneau.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/facture/pdf_bigorneau.modules.php @@ -38,8 +37,13 @@ class pdf_bigorneau extends ModelePDFFactures { function pdf_bigorneau($db=0) { - $this->db = $db; - $this->description = "Modèle de facture sans boite info réglement"; + $this->db = $db; + $this->description = "Modèle de facture sans boite info réglement"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); } function write_pdf_file($facid) diff --git a/htdocs/includes/modules/facture/pdf_bulot.modules.php b/htdocs/includes/modules/facture/pdf_bulot.modules.php index 05b279253bd..f765f19aeac 100644 --- a/htdocs/includes/modules/facture/pdf_bulot.modules.php +++ b/htdocs/includes/modules/facture/pdf_bulot.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/facture/pdf_bulot.modules.php @@ -41,8 +40,13 @@ class pdf_bulot extends ModelePDFFactures { */ function pdf_bulot($db) { - $this->db = $db; - $this->description = "Modèle de facture avec remise et infos réglement"; + $this->db = $db; + $this->description = "Modèle de facture avec remise et infos réglement"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); } diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 76d16c37652..75bbbd791fb 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -50,7 +50,11 @@ class pdf_crabe extends ModelePDFFactures $this->db = $db; $this->name = "crabe"; $this->description = "Modèle de facture complet (Gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, logo...)"; - $this->format="A4"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION @@ -135,7 +139,7 @@ class pdf_crabe extends ModelePDFFactures if (file_exists($dir)) { // Initialisation facture vierge - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->AddPage(); @@ -146,7 +150,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($user->fullname); - $pdf->SetMargins(10, 10, 10); + $pdf->SetMargins(10, 8, 10); // Top, Bottom, Left $pdf->SetAutoPageBreak(1,0); $this->_pagehead($pdf, $fac); @@ -345,7 +349,7 @@ class pdf_crabe extends ModelePDFFactures /* * Pied de page */ - $this->_pagefoot($pdf, $fac); + $this->_pagefoot($pdf); $pdf->AliasNbPages(); $pdf->Close(); @@ -646,36 +650,38 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetTextColor(0,0,60); $pdf->SetFont('Arial','B',13); - $pdf->SetXY(10,6); + $posy=10; // La marge Top est de 10, on commence donc a 10 + + $pdf->SetXY(10,$posy); // Logo if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) { - if (file_exists(FAC_PDF_LOGO)) + if (is_readable(FAC_PDF_LOGO)) { - $pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24); + $pdf->Image(FAC_PDF_LOGO, 10, $posy, 0, 24); } else { $pdf->SetTextColor(200,0,0); $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); - $pdf->MultiCell(80, 3, $langs->trans("ErrorGoToModuleSetup"), 0, 'L'); + $pdf->MultiCell(100, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); + $pdf->MultiCell(100, 3, $langs->trans("ErrorGoToModuleSetup"), 0, 'L'); } } else if (defined("FAC_PDF_INTITULE")) { - $pdf->MultiCell(80, 6, FAC_PDF_INTITULE, 0, 'L'); + $pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L'); } $pdf->SetFont('Arial','B',13); - $pdf->SetXY(100,5); + $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 10, $langs->trans("Bill")." ".$fac->ref, '' , 'R'); + $pdf->MultiCell(100, 4, $langs->trans("Bill")." ".$fac->ref, '' , 'R'); $pdf->SetFont('Arial','',12); - $pdf->SetXY(100,11); + $pdf->SetXY(100,$posy+6); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 10, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 4, $langs->trans("Date")." : " . dolibarr_print_date($fac->date,"%d %b %Y"), '', 'R'); // Emetteur $posy=42; @@ -764,11 +770,10 @@ class pdf_crabe extends ModelePDFFactures } /* - * \brief Affiche le pied de page de la facture - * \param pdf objet PDF - * \param fac objet facture - */ - function _pagefoot(&$pdf, $fac) + * \brief Affiche le pied de page + * \param pdf objet PDF + */ + function _pagefoot(&$pdf) { global $langs, $conf; $langs->load("main"); @@ -777,62 +782,64 @@ class pdf_crabe extends ModelePDFFactures $html=new Form($this->db); - $footy=14; - $pdf->SetY(-$footy); - $pdf->SetDrawColor(224,224,224); - $pdf->line(10, 282, 200, 282); - - $footy=13; - $pdf->SetFont('Arial','',8); - // Premiere ligne d'info réglementaires - $ligne=""; + $ligne1=""; if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) { - $ligne.=($ligne?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); + $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); } if ($conf->global->MAIN_INFO_CAPITAL) { - $ligne.=($ligne?" - ":"").$langs->trans("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->trans("Currency".$conf->monnaie); + $ligne1.=($ligne1?" - ":"").$langs->trans("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->trans("Currency".$conf->monnaie); } if ($conf->global->MAIN_INFO_SIRET) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; } if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; } if ($conf->global->MAIN_INFO_APE) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; } - if ($ligne) - { - $pdf->SetXY(8,-$footy); - $pdf->MultiCell(200, 2, $ligne, 0, 'C', 0); - } - // Deuxieme ligne d'info réglementaires - $ligne=""; + $ligne2=""; if ($conf->global->MAIN_INFO_RCS) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; + $ligne2.=($ligne2?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; } if ($conf->global->MAIN_INFO_TVAINTRA != '') { - $ligne.=($ligne?" - ":"").$langs->trans("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; + $ligne2.=($ligne2?" - ":"").$langs->trans("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; } + + $pdf->SetFont('Arial','',8); + $pdf->SetDrawColor(224,224,224); + + // On positionne le debut du bas de page selon nbre de lignes de ce bas de page + $posy=11 + ($ligne1?3:0) + ($ligne2?3:0); + + $pdf->SetY(-$posy); + $pdf->line(10, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); + $posy--; - if ($ligne) + if ($ligne1) { - $footy-=3; - $pdf->SetXY(8,-$footy); - $pdf->MultiCell(200, 2, $ligne , 0, 'C', 0); + $pdf->SetXY(8,-$posy); + $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); + } + + if ($ligne2) + { + $posy-=3; + $pdf->SetXY(8,-$posy); + $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); } - $pdf->SetXY(-20,-$footy); + $pdf->SetXY(-20,-$posy); $pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); } diff --git a/htdocs/includes/modules/facture/pdf_huitre.modules.php b/htdocs/includes/modules/facture/pdf_huitre.modules.php index a215864bd4b..ebe1495d237 100644 --- a/htdocs/includes/modules/facture/pdf_huitre.modules.php +++ b/htdocs/includes/modules/facture/pdf_huitre.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** @@ -43,8 +42,13 @@ class pdf_huitre extends ModelePDFFactures { */ function pdf_huitre($db) { - $this->db = $db; - $this->description = "Modèle de facture avec remise et infos réglement"; + $this->db = $db; + $this->description = "Modèle de facture avec remise et infos réglement"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); } function write_pdf_file($facid) diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 8df782d25f4..af6d6570841 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ -* */ /** @@ -40,40 +39,46 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php"); class pdf_oursin extends ModelePDFFactures { - var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15); - + var $marges=array("g"=>10,"h"=>5,"d"=>10,"b"=>15); - /** - \brief Constructeur + + /** + \brief Constructeur \param db handler accès base de donnée - */ - function pdf_oursin($db) - { - $this->db = $db; - $this->description = "Modèle de facture complet (basé sur crabe, gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, les remises, le nom du projet, la reference propal, logo...)"; - $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO - $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION - $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER - $this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE - $this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA - $this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL - if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') - $this->franchise=1; + */ + function pdf_oursin($db) + { + $this->db = $db; + $this->description = "Modèle de facture complet (basé sur crabe, gère l'option fiscale de facturation TVA, le choix du mode de règlement à afficher, les remises, le nom du projet, la reference propal, logo...)"; - // Recupere code pays - $this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation - $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; - $sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; - $result=$this->db->query($sql); - if ($result) { - $obj = $this->db->fetch_object($result); - if ($obj->code) $this->code_pays=$obj->code; + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO + $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION + $this->option_modereg = 1; // Gere choix mode règlement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER + $this->option_codeproduitservice = 1; // Affiche code produit-service FACTURE_CODEPRODUITSERVICE + $this->option_tvaintra = 1; // Affiche tva intra MAIN_INFO_TVAINTRA + $this->option_capital = 1; // Affiche capital MAIN_INFO_CAPITAL + if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') + $this->franchise=1; + + // Recupere code pays + $this->code_pays=substr($langs->defaultlang,-2); // Par defaut, pays de la localisation + $sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays"; + $sql .= " WHERE rowid = ".MAIN_INFO_SOCIETE_PAYS; + $result=$this->db->query($sql); + if ($result) { + $obj = $this->db->fetch_object($result); + if ($obj->code) $this->code_pays=$obj->code; + } + else { + dolibarr_print_error($this->db); + } + $this->db->free($result); } - else { - dolibarr_print_error($this->db); - } - $this->db->free($result); - } /** diff --git a/htdocs/includes/modules/facture/pdf_tourteau.modules.php b/htdocs/includes/modules/facture/pdf_tourteau.modules.php index a2aa447f9a2..5d22fadcea8 100644 --- a/htdocs/includes/modules/facture/pdf_tourteau.modules.php +++ b/htdocs/includes/modules/facture/pdf_tourteau.modules.php @@ -37,8 +37,13 @@ class pdf_tourteau extends ModelePDFFactures { function pdf_tourteau($db=0) { - $this->db = $db; - $this->description = "Modèle de facture sans remise"; + $this->db = $db; + $this->description = "Modèle de facture sans remise"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); } function write_pdf_file($facid) diff --git a/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php b/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php index 84c3b1c81d3..fe7aff042d6 100644 --- a/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_adytek.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/propale/pdf_propale_adytek.modules.php @@ -41,10 +40,16 @@ class pdf_propale_adytek extends ModelePDFPropales */ function pdf_propale_adytek($db=0) { - $this->db = $db; - $this->name = "Adytek"; - $this->description = "Modèle de proposition Adytek"; - $this->error = ""; + $this->db = $db; + $this->name = "Adytek"; + $this->description = "Modèle de proposition Adytek"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->error = ""; } @@ -96,7 +101,7 @@ class pdf_propale_adytek extends ModelePDFPropales if (file_exists($dir)) { - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->SetTitle($fac->ref); diff --git a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php index 8ce1f39f581..f7828396c67 100644 --- a/htdocs/includes/modules/propale/pdf_propale_azur.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_azur.modules.php @@ -50,7 +50,11 @@ class pdf_propale_azur extends ModelePDFPropales $this->db = $db; $this->name = "azur"; $this->description = "Modèle de propositions commerciales complet (logo...)"; - $this->format="A4"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION @@ -143,7 +147,7 @@ class pdf_propale_azur extends ModelePDFPropales if (file_exists($dir)) { // Initialisation propale vierge - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->AddPage(); @@ -154,7 +158,7 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetAuthor($user->fullname); - $pdf->SetMargins(10, 10, 10); + $pdf->SetMargins(10, 8, 10); $pdf->SetAutoPageBreak(1,0); $this->_pagehead($pdf, $prop); @@ -356,7 +360,7 @@ class pdf_propale_azur extends ModelePDFPropales /* * Pied de page */ - $this->_pagefoot($pdf, $prop); + $this->_pagefoot($pdf); $pdf->AliasNbPages(); $pdf->Close(); @@ -562,36 +566,38 @@ class pdf_propale_azur extends ModelePDFPropales $pdf->SetTextColor(0,0,60); $pdf->SetFont('Arial','B',13); - $pdf->SetXY(10,6); + $posy=10; // La marge est de 10, on commence donc a 10 + + $pdf->SetXY(10,$posy); // Logo if (defined("FAC_PDF_LOGO") && FAC_PDF_LOGO) { if (file_exists(FAC_PDF_LOGO)) { - $pdf->Image(FAC_PDF_LOGO, 10, 5, 0, 24); + $pdf->Image(FAC_PDF_LOGO, 10, $posy, 0, 24); } else { $pdf->SetTextColor(200,0,0); $pdf->SetFont('Arial','B',8); - $pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); - $pdf->MultiCell(80, 3, $langs->trans("ErrorGoToModuleSetup"), 0, 'L'); + $pdf->MultiCell(100, 3, $langs->trans("ErrorLogoFileNotFound",FAC_PDF_LOGO), 0, 'L'); + $pdf->MultiCell(100, 3, $langs->trans("ErrorGoToModuleSetup"), 0, 'L'); } } else if (defined("FAC_PDF_INTITULE")) { - $pdf->MultiCell(80, 6, FAC_PDF_INTITULE, 0, 'L'); + $pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L'); } $pdf->SetFont('Arial','B',13); - $pdf->SetXY(100,5); + $pdf->SetXY(100,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 10, $langs->trans("Proposal")." ".$prop->ref, '' , 'R'); + $pdf->MultiCell(100, 4, $langs->trans("Proposal")." ".$prop->ref, '' , 'R'); $pdf->SetFont('Arial','',12); - $pdf->SetXY(100,11); + $pdf->SetXY(100,$posy+6); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 10, $langs->trans("Date")." : " . dolibarr_print_date($prop->date,"%d %b %Y"), '', 'R'); + $pdf->MultiCell(100, 4, $langs->trans("Date")." : " . dolibarr_print_date($prop->date,"%d %b %Y"), '', 'R'); // Emetteur $posy=42; @@ -681,11 +687,10 @@ class pdf_propale_azur extends ModelePDFPropales } /* - * \brief Affiche le pied de page de la propale - * \param pdf objet PDF - * \param prop objet propale - */ - function _pagefoot(&$pdf, $prop) + * \brief Affiche le pied de page + * \param pdf objet PDF + */ + function _pagefoot(&$pdf) { global $langs, $conf; $langs->load("main"); @@ -694,62 +699,64 @@ class pdf_propale_azur extends ModelePDFPropales $html=new Form($this->db); - $footy=14; - $pdf->SetY(-$footy); - $pdf->SetDrawColor(224,224,224); - $pdf->line(10, 282, 200, 282); - - $footy=13; - $pdf->SetFont('Arial','',8); - // Premiere ligne d'info réglementaires - $ligne=""; + $ligne1=""; if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) { - $ligne.=($ligne?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); + $ligne1.=($ligne1?" - ":"").$html->forme_juridique_name($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE); } if ($conf->global->MAIN_INFO_CAPITAL) { - $ligne.=($ligne?" - ":"").$langs->trans("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->trans("Currency".$conf->monnaie); + $ligne1.=($ligne1?" - ":"").$langs->trans("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->trans("Currency".$conf->monnaie); } if ($conf->global->MAIN_INFO_SIRET) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId2",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIRET; } if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->code_pays != 'FR')) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId1",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_SIREN; } if ($conf->global->MAIN_INFO_APE) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; - } - - if ($ligne) - { - $pdf->SetXY(8,-$footy); - $pdf->MultiCell(200, 2, $ligne, 0, 'C', 0); + $ligne1.=($ligne1?" - ":"").$langs->transcountry("ProfId3",$this->emetteur->code_pays).": ".MAIN_INFO_APE; } // Deuxieme ligne d'info réglementaires - $ligne=""; + $ligne2=""; if ($conf->global->MAIN_INFO_RCS) { - $ligne.=($ligne?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; + $ligne2.=($ligne2?" - ":"").$langs->transcountry("ProfId4",$this->emetteur->code_pays).": ".$conf->global->MAIN_INFO_RCS; } if ($conf->global->MAIN_INFO_TVAINTRA != '') { - $ligne.=($ligne?" - ":"").$langs->trans("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; + $ligne2.=($ligne2?" - ":"").$langs->trans("VATIntraShort").": ".$conf->global->MAIN_INFO_TVAINTRA; } - if ($ligne) + $pdf->SetFont('Arial','',8); + $pdf->SetDrawColor(224,224,224); + + // On positionne le debut du bas de page selon nbre de lignes de ce bas de page + $posy=11 + ($ligne1?3:0) + ($ligne2?3:0); + + $pdf->SetY(-$posy); + $pdf->line(10, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy); + $posy--; + + if ($ligne1) { - $footy-=3; - $pdf->SetXY(8,-$footy); - $pdf->MultiCell(200, 2, $ligne , 0, 'C', 0); + $pdf->SetXY(8,-$posy); + $pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0); + } + + if ($ligne2) + { + $posy-=3; + $pdf->SetXY(8,-$posy); + $pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0); } - $pdf->SetXY(-20,-$footy); + $pdf->SetXY(-20,-$posy); $pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0); } diff --git a/htdocs/includes/modules/propale/pdf_propale_bleu.modules.php b/htdocs/includes/modules/propale/pdf_propale_bleu.modules.php index 4289dd7be87..9c1f8364f12 100644 --- a/htdocs/includes/modules/propale/pdf_propale_bleu.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_bleu.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/propale/pdf_propale_bleu.modules.php @@ -41,10 +40,16 @@ class pdf_propale_bleu extends ModelePDFPropales */ function pdf_propale_bleu($db=0) { - $this->db = $db; - $this->name = "bleu"; - $this->description = "Modèle de propale sans remise."; - $this->error = ""; + $this->db = $db; + $this->name = "bleu"; + $this->description = "Modèle de propale sans remise."; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->error = ""; } @@ -96,7 +101,7 @@ class pdf_propale_bleu extends ModelePDFPropales if (file_exists($dir)) { - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->AddPage(); diff --git a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php index ae5d1e73250..c881bed57d0 100644 --- a/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/propale/pdf_propale_jaune.modules.php @@ -41,10 +40,16 @@ class pdf_propale_jaune extends ModelePDFPropales */ function pdf_propale_jaune($db=0) { - $this->db = $db; - $this->name = "jaune"; - $this->description = "Modèle de proposition Jaune"; - $this->error = ""; + $this->db = $db; + $this->name = "jaune"; + $this->description = "Modèle de proposition Jaune"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->error = ""; } @@ -95,7 +100,7 @@ class pdf_propale_jaune extends ModelePDFPropales if (file_exists($dir)) { - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->SetTitle($propale->ref); diff --git a/htdocs/includes/modules/propale/pdf_propale_rouge.modules.php b/htdocs/includes/modules/propale/pdf_propale_rouge.modules.php index e9831dd0f0d..1f6280f923f 100644 --- a/htdocs/includes/modules/propale/pdf_propale_rouge.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_rouge.modules.php @@ -19,7 +19,6 @@ * * $Id$ * $Source$ - * */ /** @@ -43,10 +42,16 @@ class pdf_propale_rouge extends ModelePDFPropales */ function pdf_propale_rouge($db=0) { - $this->db = $db; - $this->name = "rouge"; - $this->description = "Modèle de propale par défaut"; - $this->error = ""; + $this->db = $db; + $this->name = "rouge"; + $this->description = "Modèle de propale par défaut"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->error = ""; } @@ -98,7 +103,7 @@ class pdf_propale_rouge extends ModelePDFPropales if (file_exists($dir)) { - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->AddPage(); diff --git a/htdocs/includes/modules/propale/pdf_propale_vert.modules.php b/htdocs/includes/modules/propale/pdf_propale_vert.modules.php index 00deb3a18de..e5dc9a026e5 100644 --- a/htdocs/includes/modules/propale/pdf_propale_vert.modules.php +++ b/htdocs/includes/modules/propale/pdf_propale_vert.modules.php @@ -20,7 +20,6 @@ * * $Id$ * $Source$ - * */ /** \file htdocs/includes/modules/propale/pdf_propale_vert.modules.php @@ -42,10 +41,16 @@ class pdf_propale_vert extends ModelePDFPropales */ function pdf_propale_vert($db=0) { - $this->db = $db; - $this->name = "vert"; - $this->description = "Affichage de la remise par produit"; - $this->error = ""; + $this->db = $db; + $this->name = "vert"; + $this->description = "Affichage de la remise par produit"; + + // Dimension page pour format A4 + $this->page_largeur = 210; + $this->page_hauteur = 297; + $this->format = array($this->page_largeur,$this->page_hauteur); + + $this->error = ""; } @@ -96,7 +101,7 @@ class pdf_propale_vert extends ModelePDFPropales if (file_exists($dir)) { - $pdf=new FPDF('P','mm','A4'); + $pdf=new FPDF('P','mm',$this->format); $pdf->Open(); $pdf->AddPage();