Fix: Le libellé "FACTURE" se superposait au logo

This commit is contained in:
Laurent Destailleur 2006-07-13 15:18:48 +00:00
parent c329c7b71e
commit d2ac095945
2 changed files with 129 additions and 122 deletions

View File

@ -430,7 +430,7 @@ class pdf_crabe extends ModelePDFFactures
/* /*
* Conditions de règlements * Conditions de règlements
*/ */
if ($fac->cond_reglement_code) if ($fac->cond_reglement_code || $fac->cond_reglement)
{ {
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->SetXY($this->marge_gauche, 217); $pdf->SetXY($this->marge_gauche, 217);
@ -438,7 +438,7 @@ class pdf_crabe extends ModelePDFFactures
$pdf->MultiCell(80, 5, $titre, 0, 'L'); $pdf->MultiCell(80, 5, $titre, 0, 'L');
$pdf->SetFont('Arial','',8); $pdf->SetFont('Arial','',8);
$pdf->SetXY(50, 217); $pdf->SetXY(50, 217);
$lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement; $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement;
$pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L'); $pdf->MultiCell(80, 5, $lib_condition_paiement,0,'L');
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -64,6 +64,8 @@ class pdf_huitre extends ModelePDFFactures
$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->option_logo = 1; // Affiche logo
// Recupere emmetteur // Recupere emmetteur
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'était pas défini
@ -127,7 +129,7 @@ class pdf_huitre extends ModelePDFFactures
$pdf->Open(); $pdf->Open();
$pdf->AddPage(); $pdf->AddPage();
$this->_pagehead($pdf, $fac); $this->_pagehead($pdf, $fac, $outputlangs);
$pdf->SetTitle($fac->ref); $pdf->SetTitle($fac->ref);
$pdf->SetSubject($langs->trans("Bill")); $pdf->SetSubject($langs->trans("Bill"));
@ -177,7 +179,7 @@ class pdf_huitre extends ModelePDFFactures
$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, $fac); $this->_pagehead($pdf, $fac, $outputlangs);
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10); $pdf->SetFont('Arial','', 10);
} }
@ -228,8 +230,9 @@ class pdf_huitre extends ModelePDFFactures
$pdf->SetFont('Arial','U',11); $pdf->SetFont('Arial','U',11);
$pdf->SetXY(10, 225); $pdf->SetXY(10, 225);
$titre = $langs->trans("PaymentConditions").' : '; $titre = $outputlangs->trans("PaymentConditions").' : ';
$titre.=$lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement; $lib_condition_paiement=$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->trans("PaymentCondition".$fac->cond_reglement_code):$fac->cond_reglement;
$titre.=$lib_condition_paiement;
$pdf->MultiCell(190, 5, $titre, 0, 'J'); $pdf->MultiCell(190, 5, $titre, 0, 'J');
$pdf->SetFont('Arial','',6); $pdf->SetFont('Arial','',6);
@ -470,32 +473,36 @@ class pdf_huitre extends ModelePDFFactures
* \param pdf objet PDF * \param pdf objet PDF
* \param fac objet facture * \param fac objet facture
*/ */
function _pagehead(&$pdf, $fac) function _pagehead(&$pdf, $fac, $outputlangs)
{ {
global $langs,$conf; global $conf;
$langs->load("main");
$langs->load("bills"); $outputlangs->load("main");
$langs->load("companies"); $outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("companies");
$tab4_top = 60; $tab4_top = 60;
$tab4_hl = 6; $tab4_hl = 6;
$tab4_sl = 4; $tab4_sl = 4;
$ligne = 2; $ligne = 2;
$pdf->SetXY(10,5);
// Logo // Logo
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo; $logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
if ($this->emetteur->logo) if ($this->emetteur->logo)
{ {
if (is_readable($logo)) if (is_readable($logo))
{ {
$pdf->SetXY(10,5);
$pdf->Image($logo, 10, 5,45.0, 25.0); $pdf->Image($logo, 10, 5,45.0, 25.0);
} }
else { else
{
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',8); $pdf->SetFont('Arial','B',8);
$pdf->MultiCell(80, 3, $langs->trans("ErrorLogoFileNotFound",$logo), 0, 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans("ErrorLogoFileNotFound",$logo), 0, 'L');
$pdf->MultiCell(80, 3, $langs->trans("ErrorGoToModuleSetup"), 0, 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans("ErrorGoToModuleSetup"), 0, 'L');
} }
} }
else if (defined("FAC_PDF_INTITULE")) else if (defined("FAC_PDF_INTITULE"))
@ -519,22 +526,22 @@ class pdf_huitre extends ModelePDFFactures
if (defined("FAC_PDF_TEL")) if (defined("FAC_PDF_TEL"))
{ {
$pdf->SetXY( $tab4_top , $tab4_hl + 2*$tab4_sl ); $pdf->SetXY( $tab4_top , $tab4_hl + 2*$tab4_sl );
$pdf->MultiCell(80, 3, $langs->trans('FullPhoneNumber').' : ' . FAC_PDF_TEL, '' , 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans('FullPhoneNumber').' : ' . FAC_PDF_TEL, '' , 'L');
} }
if (defined("FAC_PDF_FAX")) if (defined("FAC_PDF_FAX"))
{ {
$pdf->SetXY( $tab4_top , $tab4_hl + 3*$tab4_sl ); $pdf->SetXY( $tab4_top , $tab4_hl + 3*$tab4_sl );
$pdf->MultiCell(80, 3, $langs->trans('TeleFax').' : ' . FAC_PDF_FAX, '' , 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans('TeleFax').' : ' . FAC_PDF_FAX, '' , 'L');
} }
if (defined("FAC_PDF_MEL")) if (defined("FAC_PDF_MEL"))
{ {
$pdf->SetXY( $tab4_top , $tab4_hl + 4*$tab4_sl ); $pdf->SetXY( $tab4_top , $tab4_hl + 4*$tab4_sl );
$pdf->MultiCell(80, 3, $langs->trans('Email').' : ' . FAC_PDF_MEL, '' , 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans('Email').' : ' . FAC_PDF_MEL, '' , 'L');
} }
if (defined("FAC_PDF_WWW")) if (defined("FAC_PDF_WWW"))
{ {
$pdf->SetXY( $tab4_top , $tab4_hl + 5*$tab4_sl ); $pdf->SetXY( $tab4_top , $tab4_hl + 5*$tab4_sl );
$pdf->MultiCell(80, 3, $langs->trans('Web').' : ' . FAC_PDF_WWW, '' , 'L'); $pdf->MultiCell(80, 3, $outputlangs->trans('Web').' : ' . FAC_PDF_WWW, '' , 'L');
} }
$pdf->SetTextColor(70,70,170); $pdf->SetTextColor(70,70,170);
@ -542,10 +549,10 @@ class pdf_huitre extends ModelePDFFactures
/* /*
* Definition du document * Definition du document
*/ */
$pdf->SetXY(10,16); $pdf->SetXY(150,16);
$pdf->SetFont('Arial','B',16); $pdf->SetFont('Arial','B',16);
$pdf->SetTextColor(0,0,200); $pdf->SetTextColor(0,0,200);
$pdf->MultiCell(50, 2, "FACTURE", '' , 'C'); $pdf->MultiCell(50, 2, strtoupper($outputlangs->trans("Invoice")), '' , 'C');
/* /*
* Adresse Client * Adresse Client
@ -568,15 +575,15 @@ class pdf_huitre extends ModelePDFFactures
$pdf->SetTextColor(200,0,0); $pdf->SetTextColor(200,0,0);
$pdf->SetFont('Arial','B',14); $pdf->SetFont('Arial','B',14);
$pdf->Text(11, 88, $langs->trans('Date')); $pdf->Text(11, 88, $outputlangs->trans('Date'));
$pdf->Text(35, 88, ": " . strftime("%d %b %Y", $fac->date)); $pdf->Text(35, 88, ": " . strftime("%d %b %Y", $fac->date));
$pdf->Text(11, 94, $langs->trans('Invoice')); $pdf->Text(11, 94, $outputlangs->trans('Invoice'));
$pdf->Text(35, 94, ": ".$fac->ref); $pdf->Text(35, 94, ": ".$fac->ref);
// Montants exprimes en euros // Montants exprimes en euros
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10); $pdf->SetFont('Arial','',10);
$titre = $langs->trans("AmountInCurrency",$langs->trans("Currency".$conf->monnaie)); $titre = $outputlangs->trans("AmountInCurrency",$outputlangs->trans("Currency".$conf->monnaie));
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre); $pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
} }