Qual: Removed duplicate code

This commit is contained in:
Laurent Destailleur 2008-07-29 19:20:33 +00:00
parent a37896ae65
commit 897152a924
11 changed files with 3619 additions and 3951 deletions

View File

@ -787,69 +787,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*/ */
function _pagefoot(&$pdf, $outputlangs) function _pagefoot(&$pdf, $outputlangs)
{ {
global $conf; return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
$outputlangs->load("dict");
// Premiere ligne d'info réglementaires
$ligne1="";
if ($this->emetteur->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
}
if ($this->emetteur->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
if ($this->emetteur->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
}
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountry("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info réglementaires
$ligne2="";
if ($this->emetteur->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
}
if ($this->emetteur->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountry("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
}
$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=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0);
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }

View File

@ -22,12 +22,12 @@
/** /**
\file htdocs/includes/modules/commande/pdf_edison.modules.php \file htdocs/includes/modules/commande/pdf_edison.modules.php
\ingroup commande \ingroup commande
\brief Fichier de la classe permettant de g<EFBFBD>n<EFBFBD>rer les commandes au mod<EFBFBD>le Edison \brief Fichier de la classe permettant de generer les commandes au modele Edison
\version $Id$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** /**
\class pdf_edison \class pdf_edison
@ -36,12 +36,19 @@ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/modules_commande.php
class pdf_edison extends ModelePDFCommandes class pdf_edison extends ModelePDFCommandes
{ {
var $emetteur; // Objet societe qui emet
/** \brief Constructeur /**
\param db handler acc<EFBFBD>s base de donn<EFBFBD>e * \brief Constructeur
* \param db handler acc<EFBFBD>s base de donn<EFBFBD>e
*/ */
function pdf_edison($db=0) function pdf_edison($db=0)
{ {
global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bills");
$this->db = $db; $this->db = $db;
$this->name = "edison"; $this->name = "edison";
$this->description = "Modele de commande simple"; $this->description = "Modele de commande simple";
@ -51,6 +58,10 @@ class pdf_edison extends ModelePDFCommandes
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->option_multilang = 0; // Dispo en plusieurs langues $this->option_multilang = 0; // Dispo en plusieurs langues
$this->option_draft_watermark = 1; //Support add of a watermark on drafts $this->option_draft_watermark = 1; //Support add of a watermark on drafts
@ -69,8 +80,8 @@ class pdf_edison extends ModelePDFCommandes
/** /**
\brief Fonction g<EFBFBD>n<EFBFBD>rant la commande sur le disque \brief Fonction generant la commande sur le disque
\param id id de la propale <EFBFBD> g<EFBFBD>n<EFBFBD>rer \param com id de la propale a generer
\return int 1=ok, 0=ko \return int 1=ok, 0=ko
*/ */
function write_file($com,$outputlangs='') function write_file($com,$outputlangs='')
@ -85,7 +96,7 @@ class pdf_edison extends ModelePDFCommandes
$outputlangs->setPhpLang(); $outputlangs->setPhpLang();
// D<EFBFBD>finition de l'objet $com (pour compatibilite ascendante) // Definition de l'objet $com (pour compatibilite ascendante)
if (! is_object($com)) if (! is_object($com))
{ {
$id = $com; $id = $com;
@ -95,7 +106,7 @@ class pdf_edison extends ModelePDFCommandes
if ($conf->commande->dir_output) if ($conf->commande->dir_output)
{ {
// D<EFBFBD>finition de $dir et $file // Definition of $dir and $file
if ($com->specimen) if ($com->specimen)
{ {
$dir = $conf->commande->dir_output; $dir = $conf->commande->dir_output;
@ -229,15 +240,9 @@ class pdf_edison extends ModelePDFCommandes
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalHT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalHT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("Reduction"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*2);
$pdf->MultiCell(42, $tab2_lh, "Total HT apr<70>s remise", 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh*3);
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalVAT"), 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalVAT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalTTC"), 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, $langs->transnoentities("TotalTTC"), 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
@ -255,6 +260,11 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetXY (174, $tab2_top + ($tab2_lh*4)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*4));
$pdf->MultiCell(26, $tab2_lh, price($com->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($com->total_ttc), 1, 'R', 1);
// Pied de page
$this->_pagefoot($pdf,$com,$outputlangs);
$pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file); $pdf->Output($file);
$langs->setPhpLang(); // On restaure langue session $langs->setPhpLang(); // On restaure langue session
@ -383,10 +393,16 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetFont('Arial','B',12); $pdf->SetFont('Arial','B',12);
$pdf->Text(11, 88, "Date : " . dolibarr_print_date($com->date,'day')); $pdf->Text(11, 88, "Date : " . dolibarr_print_date($com->date,'day'));
$pdf->Text(11, 94, $langs->transnoentities("Order")." ".$com->ref); $pdf->Text(11, 94, $langs->transnoentities("Order")." ".$com->ref);
} }
/*
* \brief Affiche le pied de page
* \param pdf objet PDF
*/
function _pagefoot(&$pdf,$object,$outputlangs)
{
return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
}
} }
?> ?>

View File

@ -951,77 +951,7 @@ class pdf_einstein extends ModelePDFCommandes
*/ */
function _pagefoot(&$pdf,$outputlangs) function _pagefoot(&$pdf,$outputlangs)
{ {
global $conf; return pdf_pagefoot($pdf,$outputlangs,'COMMANDE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
// Line of free text
$ligne=(! empty($conf->global->COMMANDE_FREE_TEXT))?$conf->global->COMMANDE_FREE_TEXT:"";
// Premiere ligne d'info réglementaires
$ligne1="";
if ($this->emetteur->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
}
if ($this->emetteur->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
if ($this->emetteur->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
}
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info réglementaires
$ligne2="";
if ($this->emetteur->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
}
if ($this->emetteur->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
}
$pdf->SetFont('Arial','',7);
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$posy=$this->marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
if ($ligne)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
$posy-=9; // 6 of ligne + 3 of MultiCell
}
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }

View File

@ -22,7 +22,7 @@
/** /**
\file htdocs/includes/modules/facture/pdf_crabe.modules.php \file htdocs/includes/modules/facture/pdf_crabe.modules.php
\ingroup facture \ingroup facture
\brief Fichier de la classe permettant de g�n�rer les factures au mod�le Crabe \brief File of class to generate invoices from crab model
\author Laurent Destailleur \author Laurent Destailleur
\version $Id$ \version $Id$
*/ */
@ -43,8 +43,8 @@ class pdf_crabe extends ModelePDFFactures
/** /**
\brief Constructeur * \brief Constructor
\param db Handler accès base de donn�e * \param db Database handler
*/ */
function pdf_crabe($db) function pdf_crabe($db)
{ {
@ -384,7 +384,7 @@ class pdf_crabe extends ModelePDFFactures
} }
// Pied de page // Pied de page
$this->_pagefoot($pdf,$outputlangs); $this->_pagefoot($pdf,$fac,$outputlangs);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
@ -1174,82 +1174,13 @@ class pdf_crabe extends ModelePDFFactures
/** /**
* \brief Show footer of page * \brief Show footer of page
* \param pdf Object PDF * \param pdf Object PDF
* \param object Object invoice
* \param outputlang Object lang for output * \param outputlang Object lang for output
* \remarks Need this->emetteur object
*/ */
function _pagefoot(&$pdf,$outputlangs) function _pagefoot(&$pdf,$object,$outputlangs)
{ {
global $conf; return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
// Line of free text
$ligne=(! empty($conf->global->FACTURE_FREE_TEXT))?$conf->global->FACTURE_FREE_TEXT:"";
// Premiere ligne d'info réglementaires
$ligne1="";
if ($this->emetteur->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
}
if ($this->emetteur->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
// Prof Id
if ($this->emetteur->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
}
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info réglementaires
$ligne2="";
if ($this->emetteur->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
}
if ($this->emetteur->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
}
$pdf->SetFont('Arial','',7);
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$posy=$this->marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
if ($ligne)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
$posy-=9; // 6 of ligne + 3 of MultiCell
}
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }

View File

@ -28,6 +28,7 @@
*/ */
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** /**
@ -61,6 +62,10 @@ class pdf_huitre extends ModelePDFFactures
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 0; // Gere option tva FACTURE_TVAOPTION
@ -254,21 +259,7 @@ class pdf_huitre extends ModelePDFFactures
$titre.=$lib_condition_paiement; $titre.=$lib_condition_paiement;
$pdf->MultiCell(190, 5, $titre, 0, 'J'); $pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetFont('Arial','',6); $this->_pagefoot($pdf, $fac, $outputlangs);
$pdf->SetXY(10, 265);
$pdf->MultiCell(90, 2, $langs->transnoentities('LawApplicationPart1'), 0, 'J');
$pdf->SetXY(10, 267);
$pdf->MultiCell(90, 2, $langs->transnoentities('LawApplicationPart2'), 0, 'J');
$pdf->SetXY(10, 269);
$pdf->MultiCell(90, 2, $langs->transnoentities('LawApplicationPart3'), 0, 'J');
$pdf->SetXY(10, 271);
$pdf->MultiCell(90, 2, $langs->transnoentities('LawApplicationPart4'), 0, 'J');
$pdf->SetFont('Arial','',7);
$pdf->SetXY(85, 271);
$pdf->MultiCell(90, 3, $langs->transnoentities('VATDischarged'), 0, 'J');
$this->_pagefoot($pdf, $fac);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
//---- //----
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
@ -612,52 +603,9 @@ class pdf_huitre extends ModelePDFFactures
* \param pdf objet PDF * \param pdf objet PDF
* \param fac objet facture * \param fac objet facture
*/ */
function _pagefoot(&$pdf, $fac) function _pagefoot(&$pdf, $fac, $outputlangs)
{ {
global $langs, $conf; return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
$langs->load("main");
$langs->load("bills");
$langs->load("companies");
$footy=13;
$pdf->SetFont('Arial','',8);
$ligne="";
if (defined('MAIN_INFO_CAPITAL') && MAIN_INFO_CAPITAL) {
$ligne=$langs->transnoentities('LimitedLiabilityCompanyCapital').' '. MAIN_INFO_CAPITAL." ".$langs->transnoentities("Currency".$conf->monnaie);
}
if (defined('MAIN_INFO_SIREN') && MAIN_INFO_SIREN) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".MAIN_INFO_SIREN;
}
if (defined('MAIN_INFO_SIRET') && MAIN_INFO_SIRET) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".MAIN_INFO_SIRET;
}
if (defined('MAIN_INFO_RCS') && MAIN_INFO_RCS) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".MAIN_INFO_RCS;
}
if ($ligne) {
$pdf->SetY(-$footy);
$pdf->MultiCell(190, 3, $ligne, 0, 'C');
$footy-=3;
}
// Affiche le numéro de TVA intracommunautaire
if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') {
$pdf->SetY(-$footy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorVATIntraNotConfigured"),0,'L',0);
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorGoToGlobalSetup"),0,'L',0);
$pdf->SetTextColor(0,0,0);
}
elseif (MAIN_INFO_TVAINTRA != '') {
$pdf->SetY(-$footy);
$pdf->MultiCell(190, 3, $langs->transnoentities("IntracommunityVATNumber")." : ".MAIN_INFO_TVAINTRA, 0, 'C');
}
$pdf->SetXY(-10,-10);
$pdf->MultiCell(11, 3, $pdf->PageNo().'/{nb}', 0, 'R');
} }
} }

View File

@ -18,8 +18,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
*
* $Id$
*/ */
/** /**
@ -27,11 +25,12 @@
\ingroup facture \ingroup facture
\brief Fichier de la classe permettant de générer les factures au modèle oursin \brief Fichier de la classe permettant de générer les factures au modèle oursin
\author Sylvain SCATTOLINI basé sur un modèle de Laurent Destailleur \author Sylvain SCATTOLINI basé sur un modèle de Laurent Destailleur
\version $Revision$ \version $Id$
*/ */
require_once(DOL_DOCUMENT_ROOT."/product.class.php"); require_once(DOL_DOCUMENT_ROOT."/product.class.php");
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php"); require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** /**
\class pdf_oursin \class pdf_oursin
@ -64,6 +63,10 @@ class pdf_oursin extends ModelePDFFactures
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->option_logo = 1; // Affiche logo FAC_PDF_LOGO $this->option_logo = 1; // Affiche logo FAC_PDF_LOGO
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION $this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
@ -342,7 +345,7 @@ class pdf_oursin extends ModelePDFFactures
} }
// Pied de page // Pied de page
$this->_pagefoot($pdf, $fac); $this->_pagefoot($pdf, $fac, $outputlangs);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
@ -799,51 +802,9 @@ class pdf_oursin extends ModelePDFFactures
* \param pdf objet PDF * \param pdf objet PDF
* \param fac objet facture * \param fac objet facture
*/ */
function _pagefoot(&$pdf, $fac) function _pagefoot(&$pdf, $fac, $outputlangs)
{ {
global $langs, $conf; return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
$langs->load("main");
$langs->load("bills");
$langs->load("companies");
$footy=13;
$pdf->SetFont('Arial','',8);
$ligne="";
if (defined('MAIN_INFO_CAPITAL') && MAIN_INFO_CAPITAL) {
$ligne=$langs->transnoentities('LimitedLiabilityCompanyCapital').' '. MAIN_INFO_CAPITAL." ".$langs->transnoentities("Currency".$conf->monnaie);
}
if (defined('MAIN_INFO_SIREN') && MAIN_INFO_SIREN) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".MAIN_INFO_SIREN;
}
if (defined('MAIN_INFO_SIRET') && MAIN_INFO_SIRET) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".MAIN_INFO_SIRET;
}
if (defined('MAIN_INFO_RCS') && MAIN_INFO_RCS) {
$ligne.=($ligne?" - ":"").$langs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".MAIN_INFO_RCS;
}
if ($ligne) {
$pdf->SetY(-$footy);
$pdf->MultiCell(190, 3, $ligne, 0, 'C');
$footy-=3;
}
// Affiche le numéro de TVA intracommunautaire
if (MAIN_INFO_TVAINTRA == 'MAIN_INFO_TVAINTRA') {
$pdf->SetY(-$footy);
$pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8);
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorVATIntraNotConfigured"),0,'L',0);
$pdf->MultiCell(190, 3, $langs->transnoentities("ErrorGoToGlobalSetup"),0,'L',0);
$pdf->SetTextColor(0,0,0);
}
elseif (MAIN_INFO_TVAINTRA != '') {
$pdf->SetY(-$footy);
$pdf->MultiCell(190, 3, $langs->transnoentities("IntracommunityVATNumber")." : ".MAIN_INFO_TVAINTRA, 0, 'C');
}
$pdf->SetXY(-15,-15);
$pdf->MultiCell(11, 3, $pdf->PageNo().'/{nb}', 0, 'R');
} }
} }

View File

@ -137,6 +137,9 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
//Affiche le filigrane brouillon - Print Draft Watermark //Affiche le filigrane brouillon - Print Draft Watermark
if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) ) if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) )
{ {
@ -299,11 +302,15 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->MultiCell(80,30, '', 1); $pdf->MultiCell(80,30, '', 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut $pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
$this->_pagefoot($pdf,$outputlangs); $this->_pagefoot($pdf,$outputlangs);
$pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
$pdf->Output($file); $pdf->Output($file);
$langs->setPhpLang(); // On restaure langue session
return 1; return 1;
} }
else else
@ -327,69 +334,7 @@ class pdf_soleil extends ModelePDFFicheinter
*/ */
function _pagefoot(&$pdf,$outputlangs) function _pagefoot(&$pdf,$outputlangs)
{ {
global $conf; return pdf_pagefoot($pdf,$outputlangs,'FICHEINTER_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
// Premiere ligne d'info reglementaires
$ligne1="";
if ($this->emetteur->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
}
if ($this->emetteur->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
if ($this->emetteur->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
}
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info reglementaires
$ligne2="";
if ($this->emetteur->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
}
if ($this->emetteur->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
}
$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
//Todo: correction provisoire afin de régler le problème du bas de page
//$posy=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0);
$posy=$this->marge_basse + 11 + ($ligne1?3:0) + ($ligne2?3:0);
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
//$pdf->SetXY(-20,-$posy);
//$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }

View File

@ -977,77 +977,7 @@ class pdf_propale_azur extends ModelePDFPropales
*/ */
function _pagefoot(&$pdf,$outputlangs) function _pagefoot(&$pdf,$outputlangs)
{ {
global $conf; return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
// Line of free text
$ligne=(! empty($conf->global->PROPALE_FREE_TEXT))?$conf->global->PROPALE_FREE_TEXT:"";
// Premiere ligne d'info réglementaires
$ligne1="";
if ($this->emetteur->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($this->emetteur->forme_juridique_code);
}
if ($this->emetteur->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$this->emetteur->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
if ($this->emetteur->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$this->emetteur->profid2;
}
if ($this->emetteur->profid1 && (! $this->emetteur->profid2 || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$this->emetteur->profid1;
}
// Deuxieme ligne d'info réglementaires
$ligne2="";
if ($this->emetteur->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".$this->emetteur->profid3;
}
if ($this->emetteur->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$this->emetteur->profid4;
}
if ($this->emetteur->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$this->emetteur->tva_intra;
}
$pdf->SetFont('Arial','',7);
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$posy=$this->marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
if ($ligne)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
$posy-=9; // 6 of ligne + 3 of MultiCell
}
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }

View File

@ -26,10 +26,12 @@
*/ */
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/propale/modules_propale.php");
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
/** \class pdf_propale_jaune /**
\brief Classe permettant de générer les propales au modèle Jaune * \class pdf_propale_jaune
* \brief Classe permettant de générer les propales au modèle Jaune
*/ */
class pdf_propale_jaune extends ModelePDFPropales class pdf_propale_jaune extends ModelePDFPropales
@ -37,13 +39,17 @@ class pdf_propale_jaune extends ModelePDFPropales
var $emetteur; // Objet societe qui emet var $emetteur; // Objet societe qui emet
/** \brief Constructeur /**
\param db handler accès base de donnée * \brief Constructeur
* \param db handler accès base de donnée
*/ */
function pdf_propale_jaune($db=0) function pdf_propale_jaune($db=0)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bills");
$this->db = $db; $this->db = $db;
$this->name = "jaune"; $this->name = "jaune";
$this->description = "Modèle de proposition Jaune"; $this->description = "Modèle de proposition Jaune";
@ -53,6 +59,10 @@ class pdf_propale_jaune extends ModelePDFPropales
$this->page_largeur = 210; $this->page_largeur = 210;
$this->page_hauteur = 297; $this->page_hauteur = 297;
$this->format = array($this->page_largeur,$this->page_hauteur); $this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=10;
$this->marge_droite=10;
$this->marge_haute=10;
$this->marge_basse=10;
$this->option_draft_watermark = 1; //Support add of a watermark on drafts $this->option_draft_watermark = 1; //Support add of a watermark on drafts
@ -81,7 +91,17 @@ class pdf_propale_jaune extends ModelePDFPropales
*/ */
function write_file($propale,$outputlangs='') function write_file($propale,$outputlangs='')
{ {
global $user,$conf,$langs; global $user,$langs,$conf;
if (! is_object($outputlangs)) $outputlangs=$langs;
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("products");
$outputlangs->setPhpLang();
if ($conf->propal->dir_output) if ($conf->propal->dir_output)
{ {
@ -132,15 +152,18 @@ class pdf_propale_jaune extends ModelePDFPropales
} }
$pdf->Open(); $pdf->Open();
$pdf->AddPage();
$pdf->SetTitle($propale->ref); $pdf->SetTitle($propale->ref);
$pdf->SetSubject("Proposition commerciale"); $pdf->SetSubject("Proposition commerciale");
$pdf->SetCreator("Dolibarr ".DOL_VERSION); $pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($user->fullname); $pdf->SetAuthor($user->fullname);
$pdf->AddPage(); $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
$this->_pagehead($pdf, $propale); // Tete de page
$this->_pagehead($pdf, $propale, $outputlangs);
/* /*
*/ */
@ -190,10 +213,12 @@ class pdf_propale_jaune extends ModelePDFPropales
if ($nexY > 240 && $i < $nblignes - 1) if ($nexY > 240 && $i < $nblignes - 1)
{ {
$this->_pagefoot($pdf,$propale,$outputlangs);
$this->_tableau($pdf, $tab_top, $tab_height, $nexY); $this->_tableau($pdf, $tab_top, $tab_height, $nexY);
$pdf->AddPage(); $pdf->AddPage();
$nexY = $iniY; $nexY = $iniY;
$this->_pagehead($pdf, $propale); $this->_pagehead($pdf, $propale, $outputlangs);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
@ -218,13 +243,13 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height); $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
$pdf->SetXY (132, $tab2_top + 0); $pdf->SetXY (132, $tab2_top + 0);
$pdf->MultiCell(42, $tab2_lh, "Total HT", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalHT"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + $tab2_lh); $pdf->SetXY (132, $tab2_top + $tab2_lh);
$pdf->MultiCell(42, $tab2_lh, "Total TVA", 0, 'R', 0); $pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalTVA"), 0, 'R', 0);
$pdf->SetXY (132, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (132, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(42, $tab2_lh, "Total TTC", 1, 'R', 1); $pdf->MultiCell(42, $tab2_lh, $outputlangs->trans("TotalTTC"), 1, 'R', 1);
$pdf->SetXY (174, $tab2_top + 0); $pdf->SetXY (174, $tab2_top + 0);
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ht), 0, 'R', 0);
@ -235,11 +260,15 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY (174, $tab2_top + ($tab2_lh*2)); $pdf->SetXY (174, $tab2_top + ($tab2_lh*2));
$pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1); $pdf->MultiCell(26, $tab2_lh, price($propale->total_ttc), 1, 'R', 1);
/* // Pied de page
* $this->_pagefoot($pdf,$propale,$outputlangs);
*/ $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file); $pdf->Output($file);
$langs->setPhpLang(); // On restaure langue session
return 1; return 1;
} }
} }
@ -279,11 +308,9 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentities("Currency".$conf->monnaie));
$pdf->Text(10,280, $titre);
} }
function _pagehead(&$pdf, $propale) function _pagehead(&$pdf, $propale, $outputlangs)
{ {
//Affiche le filigrane brouillon - Print Draft Watermark //Affiche le filigrane brouillon - Print Draft Watermark
if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") ) if($propale->statut==0 && defined("PROPALE_DRAFT_WATERMARK") )
@ -359,9 +386,20 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->rect(110, 90, 90, 10); $pdf->rect(110, 90, 90, 10);
$pdf->SetXY(10,90); $pdf->SetXY(10,90);
$pdf->MultiCell(110, 10, "Numéro : ".$propale->ref); $pdf->MultiCell(110, 10, $outputlangs->trans("Ref")." : ".$propale->ref);
$pdf->SetXY(110,90); $pdf->SetXY(110,90);
$pdf->MultiCell(100, 10, "Date : " . dolibarr_print_date($propale->date,'day')); $pdf->MultiCell(100, 10, $outputlangs->trans("Date")." : " . dolibarr_print_date($propale->date,'day'));
} }
/*
* \brief Affiche le pied de page
* \param pdf Object PDF
* \param object Object proposal
*/
function _pagefoot(&$pdf,$object,$outputlangs)
{
return pdf_pagefoot($pdf,$outputlangs,'PROPALE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
}
} }
?> ?>

View File

@ -599,4 +599,93 @@ function show_actions_done($conf,$langs,$db,$objsoc)
print "<br>\n"; print "<br>\n";
} }
} }
/**
* \brief Show footer of page for PDF generation
* \param pdf Object PDF
* \param outputlang Object lang for output
* \param paramfreetext Constant name of free text
* \param fromcompany Object company
* \param marge_basse
* \param marge_gauche
* \param page_hauteur
*/
function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_basse,$marge_gauche,$page_hauteur)
{
global $conf;
//$paramfreetext='FACTURE_FREE_TEXT';
// Line of free text
$ligne=(! empty($conf->global->$paramfreetext))?$conf->global->$paramfreetext:"";
// First line of company infos
$ligne1="";
if ($fromcompany->forme_juridique_code)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($fromcompany->forme_juridique_code);
}
if ($fromcompany->capital)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
}
// Prof Id
if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code).": ".$fromcompany->profid1;
}
if ($fromcompany->profid2)
{
$ligne1.=($ligne1?" - ":"").$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code).": ".$fromcompany->profid2;
}
// Second line of company infos
$ligne2="";
if ($fromcompany->profid3)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code).": ".$fromcompany->profid3;
}
if ($fromcompany->profid4)
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code).": ".$fromcompany->profid4;
}
if ($fromcompany->tva_intra != '')
{
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$fromcompany->tva_intra;
}
$pdf->SetFont('Arial','',7);
$pdf->SetDrawColor(224,224,224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$posy=$marge_basse + 1 + ($ligne?6:0) + ($ligne1?3:0) + ($ligne2?3:0);
if ($ligne)
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
$posy-=9; // 6 of ligne + 3 of MultiCell
}
$pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur-$posy, 200, $page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
}
?> ?>

View File

@ -39,14 +39,18 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
class pdf_typhon extends ModelePDFDeliveryOrder class pdf_typhon extends ModelePDFDeliveryOrder
{ {
var $emetteur; // Objet societe qui emet
/** /**
\brief Constructeur * \brief Constructor
\param db Handler acc<EFBFBD>s base de donn<EFBFBD>e * \param db Database handler
*/ */
function pdf_typhon($db) function pdf_typhon($db)
{ {
global $conf,$langs; global $conf,$langs,$mysoc;
$langs->load("main");
$langs->load("bills");
$this->db = $db; $this->db = $db;
$this->name = "typhon"; $this->name = "typhon";
@ -69,8 +73,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise') if (defined("FACTURE_TVAOPTION") && FACTURE_TVAOPTION == 'franchise')
$this->franchise=1; $this->franchise=1;
// Recupere code pays de l'emmetteur // Recupere emmetteur
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini $this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
$this->tva=array(); $this->tva=array();
@ -271,7 +276,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
if ($nexY > 200 && $i < ($nblignes - 1)) if ($nexY > 200 && $i < ($nblignes - 1))
{ {
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY); $this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY);
$this->_pagefoot($pdf); $this->_pagefoot($pdf,$outputlangs);
// Nouvelle page // Nouvelle page
$pdf->AddPage(); $pdf->AddPage();
@ -300,7 +305,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
/* /*
* Pied de page * Pied de page
*/ */
$this->_pagefoot($pdf); $this->_pagefoot($pdf,$outputlangs);
$pdf->AliasNbPages(); $pdf->AliasNbPages();
$pdf->Close(); $pdf->Close();
@ -518,76 +523,13 @@ class pdf_typhon extends ModelePDFDeliveryOrder
} }
/* /**
* \brief Affiche le pied de page * \brief Affiche le pied de page
* \param pdf objet PDF * \param pdf objet PDF
*/ */
function _pagefoot(&$pdf) function _pagefoot(&$pdf,$outputlangs)
{ {
global $langs, $conf; return pdf_pagefoot($pdf,$outputlangs,'DELIVERY_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
$langs->load("main");
$langs->load("bills");
$langs->load("companies");
// Premiere ligne d'info r<>glementaires
$ligne1="";
if ($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)
{
$ligne1.=($ligne1?" - ":"").getFormeJuridiqueLabel($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE);
}
if ($conf->global->MAIN_INFO_CAPITAL)
{
$ligne1.=($ligne1?" - ":"").$langs->transnoentities("CapitalOf",$conf->global->MAIN_INFO_CAPITAL)." ".$langs->transnoentities("Currency".$conf->monnaie);
}
if ($conf->global->MAIN_INFO_SIRET)
{
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId2",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_SIRET;
}
if ($conf->global->MAIN_INFO_SIREN && (! $conf->global->MAIN_INFO_SIRET || $this->emetteur->pays_code != 'FR'))
{
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId1",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_SIREN;
}
if ($conf->global->MAIN_INFO_APE)
{
$ligne1.=($ligne1?" - ":"").$langs->transcountrynoentities("ProfId3",$this->emetteur->pays_code).": ".MAIN_INFO_APE;
}
// Deuxieme ligne d'info reglementaires
$ligne2="";
if ($conf->global->MAIN_INFO_RCS)
{
$ligne2.=($ligne2?" - ":"").$langs->transcountrynoentities("ProfId4",$this->emetteur->pays_code).": ".$conf->global->MAIN_INFO_RCS;
}
if ($conf->global->MAIN_INFO_TVAINTRA != '')
{
$ligne2.=($ligne2?" - ":"").$langs->transnoentities("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=$this->marge_basse + 1 + ($ligne1?3:0) + ($ligne2?3:0);
$pdf->SetY(-$posy);
$pdf->line($this->marge_gauche, $this->page_hauteur-$posy, 200, $this->page_hauteur-$posy);
$posy--;
if ($ligne1)
{
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne1, 0, 'C', 0);
}
if ($ligne2)
{
$posy-=3;
$pdf->SetXY($this->marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $ligne2, 0, 'C', 0);
}
$pdf->SetXY(-20,-$posy);
$pdf->MultiCell(10, 2, $pdf->PageNo().'/{nb}', 0, 'R', 0);
} }
} }