forked from Wavyzz/dolibarr
Mutualize code and debug for UTF output
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
\version $Revision$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(FPDFI_PATH.'fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
@@ -116,7 +116,6 @@ class BordereauChequeBlochet extends FPDF
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
require_once(FPDFI_PATH.'fpdi_protection.php');
|
||||
$pdf = new FPDI_Protection('P','mm','A4');
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
@@ -125,7 +124,6 @@ class BordereauChequeBlochet extends FPDF
|
||||
}
|
||||
else
|
||||
{
|
||||
require_once(FPDFI_PATH.'fpdi.php');
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
}
|
||||
|
||||
@@ -214,7 +212,7 @@ class BordereauChequeBlochet extends FPDF
|
||||
$pdf->Text(104, 43, $this->account->cle_rib);
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$pdf->Text(114, 19, $outputlangs->transnoentities("Sign"));
|
||||
$pdf->Text(114, 19, $outputlangs->transnoentities("Signature"));
|
||||
|
||||
$pdf->Rect(9, 47, 192, 7);
|
||||
$pdf->line(55, 47, 55, 54);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // requis car utilise par les classes qui heritent
|
||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||
|
||||
@@ -238,51 +238,12 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
|
||||
if ($com->lignes[$i]->desc && $com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
if ($com->lignes[$i]->desc == '(CREDIT_NOTE)' && $com->lignes[$i]->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($com->lignes[$i]->fk_remise_except);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
|
||||
}
|
||||
}
|
||||
// Si ligne associ<63>e <20> un code produit
|
||||
if ($com->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($com->lignes[$i]->fk_product);
|
||||
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
else
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
$libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
|
||||
// Description
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par d<>faut
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<EFBFBD> dans les classes qui h<EFBFBD>ritent
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilise dans les classes qui heritent
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -240,63 +240,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$curY = $nexY;
|
||||
|
||||
// Description of product line
|
||||
$libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
|
||||
if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($fac->lignes[$i]->fk_remise_except);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fac->lignes[$i]->produit_id)
|
||||
{
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$fac->lignes[$i]->desc='<27>zaaaa';
|
||||
//print dol_string_is_good_iso($fac->lignes[$i]->desc);
|
||||
//print dol_htmlentitiesbr($fac->lignes[$i]->desc);
|
||||
//print exit;
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si ligne associee a un code produit
|
||||
if ($fac->lignes[$i]->produit_id)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($fac->lignes[$i]->produit_id);
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
//if ($i==0) { print $libelleproduitservice; exit; }
|
||||
$libelleproduitservice=pdf_getlinedesc($fac->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
@@ -1,603 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/includes/modules/facture/pdf_huitre.modules.php
|
||||
* \ingroup facture
|
||||
* \brief Fichier de la classe permettant de g<>n<EFBFBD>rer les factures au mod<6F>le Huitre
|
||||
* \author Laurent Destailleur
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT."/includes/modules/facture/modules_facture.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
/**
|
||||
* \class pdf_huitre
|
||||
* \brief Classe permettant de g<>n<EFBFBD>rer les factures au mod<6F>le Huitre
|
||||
*/
|
||||
class pdf_huitre extends ModelePDFFactures
|
||||
{
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
|
||||
/** \brief Constructeur
|
||||
* \param db handler acc<63>s base de donn<6E>e
|
||||
*/
|
||||
function pdf_huitre($db)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("products");
|
||||
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "huitre";
|
||||
$this->description = $langs->transnoentities('PDFHuitreDescription');
|
||||
|
||||
// Dimension page pour format A4
|
||||
$this->type = 'pdf';
|
||||
$this->page_largeur = 210;
|
||||
$this->page_hauteur = 297;
|
||||
$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_tva = 0; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_modereg = 0; // Gere choix mode reglement FACTURE_CHQ_NUMBER, FACTURE_RIB_NUMBER
|
||||
$this->option_condreg = 1; // Affiche conditions reglement
|
||||
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||
$this->option_credit_note = 0; // Gere les avoirs
|
||||
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction g<>n<EFBFBD>rant la facture sur le disque
|
||||
* \param fac Objet facture <20> g<>n<EFBFBD>rer (ou id si ancienne methode)
|
||||
* \param outputlangs Lang object for output language
|
||||
* \return int 1=ok, 0=ko
|
||||
*/
|
||||
function write_file($fac,$outputlangs)
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||
// Force output charset to ISO, because, FPDF expect text encoded in ISO
|
||||
$outputlangs->charset_output='ISO-8859-1';
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("companies");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
if ($conf->facture->dir_output)
|
||||
{
|
||||
// D<>finition de l'objet $fac (pour compatibilite ascendante)
|
||||
if (! is_object($fac))
|
||||
{
|
||||
$id = $fac;
|
||||
$fac = new Facture($this->db,"",$id);
|
||||
$ret=$fac->fetch($id);
|
||||
}
|
||||
|
||||
// D<>finition de $dir et $file
|
||||
if ($fac->specimen)
|
||||
{
|
||||
$dir = $conf->facture->dir_output;
|
||||
$file = $dir . "/SPECIMEN.pdf";
|
||||
}
|
||||
else
|
||||
{
|
||||
$facref = sanitizeFileName($fac->ref);
|
||||
$dir = $conf->facture->dir_output . "/" . $facref;
|
||||
$file = $dir . "/" . $facref . ".pdf";
|
||||
}
|
||||
|
||||
if (! file_exists($dir))
|
||||
{
|
||||
if (create_exdir($dir) < 0)
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($dir))
|
||||
{
|
||||
// Protection et encryption du pdf
|
||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||
{
|
||||
$pdf=new FPDI_Protection('P','mm','A4');
|
||||
$pdfrights = array('print'); // Ne permet que l'impression du document
|
||||
$pdfuserpass = ''; // Mot de passe pour l'utilisateur final
|
||||
$pdfownerpass = NULL; // Mot de passe du propri<72>taire, cr<63><72> al<61>atoirement si pas d<>fini
|
||||
$pdf->SetProtection($pdfrights,$pdfuserpass,$pdfownerpass);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf=new FPDI('P','mm',$this->format);
|
||||
}
|
||||
|
||||
$pdf->Open();
|
||||
$pdf->AddPage();
|
||||
|
||||
$this->_pagehead($pdf, $fac, $outputlangs);
|
||||
|
||||
$pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref));
|
||||
$pdf->SetSubject($outputlangs->transnoentities("Invoice"));
|
||||
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
|
||||
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->fullname));
|
||||
$pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Invoice"));
|
||||
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
|
||||
|
||||
$pdf->SetMargins(10, 10, 10);
|
||||
$pdf->SetAutoPageBreak(1,0);
|
||||
$tab_top = 100;
|
||||
$tab_height = 110;
|
||||
|
||||
$pdf->SetFillColor(242,239,119);
|
||||
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
|
||||
$pdf->SetXY (10, $tab_top + 10 );
|
||||
|
||||
$iniY = $pdf->GetY();
|
||||
$curY = $pdf->GetY();
|
||||
$nexY = $pdf->GetY();
|
||||
$nblignes = sizeof($fac->lignes);
|
||||
|
||||
// Boucle sur les lignes de factures
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
$curY = $nexY;
|
||||
|
||||
$pdf->SetXY (11, $curY );
|
||||
$pdf->MultiCell(118, 5, $outputlangs->convToOutputCharset($fac->lignes[$i]->desc), 0, 'J');
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
$pdf->SetXY (133, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_tx, 0, 'C');
|
||||
|
||||
$pdf->SetXY (145, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'C');
|
||||
|
||||
$pdf->SetXY (156, $curY);
|
||||
$pdf->MultiCell(18, 5, price($fac->lignes[$i]->price), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (174, $curY);
|
||||
$total = price($fac->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
|
||||
|
||||
if ($nexY > 200 && $i < $nblignes - 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$pdf->AddPage();
|
||||
$nexY = $iniY;
|
||||
$this->_pagehead($pdf, $fac, $outputlangs);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','', 10);
|
||||
}
|
||||
|
||||
}
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
|
||||
$this->_tableau_tot($pdf, $fac, $outputlangs);
|
||||
|
||||
$this->_tableau_compl($pdf, $fac, $outputlangs);
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
if (defined("FACTURE_RIB_NUMBER"))
|
||||
{
|
||||
if (FACTURE_RIB_NUMBER > 0)
|
||||
{
|
||||
$account = new Account($this->db);
|
||||
$account->fetch(FACTURE_RIB_NUMBER);
|
||||
|
||||
$curx=10;
|
||||
$cury=40;
|
||||
|
||||
$posy=pdf_bank($pdf,$outputlangs,$curx,$cury,$account);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
if (! empty($fac->note_public))
|
||||
{
|
||||
$pdf->SetFont('Arial','',7);
|
||||
$pdf->SetXY(10, 211);
|
||||
$note = $outputlangs->transnoentities("Note").' : '.$outputlangs->convToOutputCharset($fac->note_public);
|
||||
$pdf->MultiCell(110, 3, $note, 0, 'J');
|
||||
}
|
||||
|
||||
$pdf->SetXY(10, 225);
|
||||
|
||||
// Show payments conditions
|
||||
if ($fac->type != 2 && ($fac->cond_reglement_code || $fac->cond_reglement))
|
||||
{
|
||||
$titre = $outputlangs->transnoentities("PaymentConditions").' : ';
|
||||
$lib_condition_paiement=$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code)!=('PaymentCondition'.$fac->cond_reglement_code)?$outputlangs->transnoentities("PaymentCondition".$fac->cond_reglement_code):$outputlangs->convToOutputCharset($fac->cond_reglement);
|
||||
$titre.=$lib_condition_paiement;
|
||||
$pdf->MultiCell(190, 5, $titre, 0, 'J');
|
||||
}
|
||||
|
||||
$this->_pagefoot($pdf, $fac, $outputlangs);
|
||||
$pdf->AliasNbPages();
|
||||
//----
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFillColor(242,239,119);
|
||||
|
||||
$pdf->SetLineWidth(0.5);
|
||||
|
||||
|
||||
$pdf->Close();
|
||||
|
||||
$pdf->Output($file);
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 1; // Pas d'erreur
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->transnoentities("ErrorConstantNotDefined","FAC_OUTPUTDIR");
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0;
|
||||
}
|
||||
$this->error=$langs->transnoentities("ErrorUnknown");
|
||||
$langs->setPhpLang(); // On restaure langue session
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
function RoundedRect($x, $y, $w, $h,$r, $style = '')
|
||||
{
|
||||
$k = $this->k;
|
||||
$hp = $this->h;
|
||||
if($style=='F')
|
||||
$op='f';
|
||||
elseif($style=='FD' or $style=='DF')
|
||||
$op='B';
|
||||
else
|
||||
$op='S';
|
||||
$MyArc = 4/3 * (sqrt(2) - 1);
|
||||
$this->_out(sprintf('%.2f %.2f m',($x+$r)*$k,($hp-$y)*$k ));
|
||||
$xc = $x+$w-$r ;
|
||||
$yc = $y+$r;
|
||||
$this->_out(sprintf('%.2f %.2f l', $xc*$k,($hp-$y)*$k ));
|
||||
|
||||
$this->_Arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc);
|
||||
$xc = $x+$w-$r ;
|
||||
$yc = $y+$h-$r;
|
||||
$this->_out(sprintf('%.2f %.2f l',($x+$w)*$k,($hp-$yc)*$k));
|
||||
$this->_Arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r);
|
||||
$xc = $x+$r ;
|
||||
$yc = $y+$h-$r;
|
||||
$this->_out(sprintf('%.2f %.2f l',$xc*$k,($hp-($y+$h))*$k));
|
||||
$this->_Arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc);
|
||||
$xc = $x+$r ;
|
||||
$yc = $y+$r;
|
||||
$this->_out(sprintf('%.2f %.2f l',($x)*$k,($hp-$yc)*$k ));
|
||||
$this->_Arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r);
|
||||
$this->_out($op);
|
||||
}
|
||||
|
||||
function _Arc($x1, $y1, $x2, $y2, $x3, $y3)
|
||||
{
|
||||
$h = $this->h;
|
||||
$this->_out(sprintf('%.2f %.2f %.2f %.2f %.2f %.2f c ', $x1*$this->k, ($h-$y1)*$this->k,
|
||||
$x2*$this->k, ($h-$y2)*$this->k, $x3*$this->k, ($h-$y3)*$this->k));
|
||||
}
|
||||
|
||||
function _tableau_compl(&$pdf, $fac, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$tab3_top = 240;
|
||||
$tab3_height = 18;
|
||||
$tab3_width = 60;
|
||||
|
||||
$pdf->Rect(10, $tab3_top, $tab3_width, $tab3_height);
|
||||
|
||||
$pdf->line(10, $tab3_top + 6, $tab3_width+10, $tab3_top + 6 );
|
||||
$pdf->line(10, $tab3_top + 12, $tab3_width+10, $tab3_top + 12 );
|
||||
|
||||
$pdf->line(40, $tab3_top, 40, $tab3_top + $tab3_height );
|
||||
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY (10, $tab3_top - 6);
|
||||
$pdf->MultiCell(60, 6, $outputlangs->transnoentities("ExtraInfos"), 0, 'L', 0);
|
||||
$pdf->SetXY (10, $tab3_top );
|
||||
$pdf->MultiCell(20, 6, $outputlangs->transnoentities("RegulatedOn"), 0, 'L', 0);
|
||||
$pdf->SetXY (10, $tab3_top + 6);
|
||||
$pdf->MultiCell(60, 6, $outputlangs->transnoentities("ChequeOrTransferNumber"), 0, 'L', 0);
|
||||
$pdf->SetXY (10, $tab3_top + 12);
|
||||
$pdf->MultiCell(20, 6, $outputlangs->transnoentities("Bank"), 0, 'L', 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche le total <20> payer
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _tableau_tot(&$pdf, $fac, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$tab2_top = 212;
|
||||
$tab2_hl = 5;
|
||||
$tab2_height = $tab2_hl * 4;
|
||||
$pdf->SetFont('Arial','', 9);
|
||||
|
||||
// $pdf->Rect(132, $tab2_top, 68, $tab2_height);
|
||||
// $pdf->line(174, $tab2_top, 174, $tab2_top + $tab2_height);
|
||||
|
||||
// $pdf->line(132, $tab2_top + $tab2_height - 21, 200, $tab2_top + $tab2_height - 21 );
|
||||
// $pdf->line(132, $tab2_top + $tab2_height - 14, 200, $tab2_top + $tab2_height - 14 );
|
||||
// $pdf->line(132, $tab2_top + $tab2_height - 7, 200, $tab2_top + $tab2_height - 7 );
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + 0);
|
||||
$pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalHT"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + 0);
|
||||
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ht + $fac->remise), 0, 'R', 0);
|
||||
|
||||
$index = 1;
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalVAT"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell(26, $tab2_hl, price($fac->total_tva), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+1));
|
||||
$pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("TotalTTC"), 0, 'R', 1);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+1));
|
||||
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc), 0, 'R', 1);
|
||||
|
||||
$deja_regle = $fac->getSommePaiement();
|
||||
|
||||
if ($deja_regle > 0)
|
||||
{
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+2));
|
||||
$pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("AlreadyPayed"), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+2));
|
||||
$pdf->MultiCell(26, $tab2_hl, price($deja_regle), 0, 'R', 0);
|
||||
|
||||
$pdf->SetXY (132, $tab2_top + $tab2_hl * ($index+3));
|
||||
$pdf->MultiCell(42, $tab2_hl, $outputlangs->transnoentities("RemainderToPay"), 0, 'R', 1);
|
||||
|
||||
$pdf->SetXY (174, $tab2_top + $tab2_hl * ($index+3));
|
||||
$pdf->MultiCell(26, $tab2_hl, price($fac->total_ttc - $deja_regle), 0, 'R', 1);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* \brief Affiche la grille des lignes de factures
|
||||
* \param pdf objet PDF
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->SetFont('Arial','',10);
|
||||
|
||||
$pdf->Text(11,$tab_top + 5,$outputlangs->transnoentities("Designation"));
|
||||
|
||||
$pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
$pdf->Text(134,$tab_top + 5,$outputlangs->transnoentities("VAT"));
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->Text(147,$tab_top + 5,$outputlangs->transnoentities("Qty"));
|
||||
|
||||
$pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
|
||||
$pdf->Text(160,$tab_top + 5,$outputlangs->transnoentities("PriceU"));
|
||||
|
||||
$pdf->line(174, $tab_top, 174, $tab_top + $tab_height);
|
||||
$pdf->Text(187,$tab_top + 5,$outputlangs->transnoentities("Total"));
|
||||
|
||||
$pdf->Rect(10, $tab_top, 190, $tab_height);
|
||||
$pdf->line(10, $tab_top + 10, 200, $tab_top + 10 );
|
||||
}
|
||||
|
||||
/*
|
||||
* \brief Affiche en-t<>te facture
|
||||
* \param pdf objet PDF
|
||||
* \param fac objet facture
|
||||
*/
|
||||
function _pagehead(&$pdf, $fac, $outputlangs)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$outputlangs->load("main");
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("propal");
|
||||
$outputlangs->load("companies");
|
||||
|
||||
$tab4_top = 60;
|
||||
$tab4_hl = 6;
|
||||
$tab4_sl = 4;
|
||||
$ligne = 2;
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
if($fac->statut==0 && (! empty($conf->global->FACTURE_DRAFT_WATERMARK)) )
|
||||
{
|
||||
$watermark_angle=atan($this->page_hauteur/$this->page_largeur);
|
||||
$watermark_x=5;
|
||||
$watermark_y=$this->page_hauteur-50;
|
||||
$watermark_width=$this->page_hauteur;
|
||||
$pdf->SetFont('Arial','B',50);
|
||||
$pdf->SetTextColor(255,192,203);
|
||||
//rotate
|
||||
$pdf->_out(sprintf('q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm',cos($watermark_angle),sin($watermark_angle),-sin($watermark_angle),cos($watermark_angle),$watermark_x*$pdf->k,($pdf->h-$watermark_y)*$pdf->k,-$watermark_x*$pdf->k,-($pdf->h-$watermark_y)*$pdf->k));
|
||||
//print watermark
|
||||
$pdf->SetXY($watermark_x,$watermark_y);
|
||||
$pdf->Cell($watermark_width,25,$outputlangs->convToOutputCharset($conf->global->FACTURE_DRAFT_WATERMARK),0,2,"C",0);
|
||||
//antirotate
|
||||
$pdf->_out('Q');
|
||||
}
|
||||
//Print content
|
||||
$pdf->SetXY(10,5);
|
||||
$posy=5;
|
||||
|
||||
// Logo
|
||||
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, 24);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound",$logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else if (defined("FAC_PDF_INTITULE"))
|
||||
{
|
||||
$pdf->MultiCell(100, 4, FAC_PDF_INTITULE, 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->line(9, 5, 200, 5 );
|
||||
$pdf->line(9, 30, 200, 30 );
|
||||
|
||||
// Caracteristiques emetteur
|
||||
$carac_emetteur = '';
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->adresse);
|
||||
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->cp).' '.$outputlangs->convToOutputCharset($this->emetteur->ville);
|
||||
$carac_emetteur .= "\n";
|
||||
// Tel
|
||||
if ($this->emetteur->tel) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone").": ".$outputlangs->convToOutputCharset($this->emetteur->tel);
|
||||
// Fax
|
||||
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Fax").": ".$outputlangs->convToOutputCharset($this->emetteur->fax);
|
||||
// EMail
|
||||
if ($this->emetteur->email) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Email").": ".$outputlangs->convToOutputCharset($this->emetteur->email);
|
||||
// Web
|
||||
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
|
||||
|
||||
$pdf->SetFont('Arial','',9);
|
||||
$pdf->SetXY($tab4_top+28,$tab4_hl);
|
||||
$pdf->MultiCell(110,3, $carac_emetteur);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Definition du document
|
||||
*/
|
||||
$pdf->SetXY(150,16);
|
||||
$pdf->SetFont('Arial','B',16);
|
||||
$pdf->SetTextColor(0,0,200);
|
||||
$pdf->MultiCell(50, 2, strtoupper($outputlangs->transnoentities("Invoice")), '' , 'C');
|
||||
|
||||
/*
|
||||
* Adresse Client
|
||||
*/
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFillColor(242,239,119);
|
||||
|
||||
// $this->RoundedRect(100, 40, 100, 40, 3, 'F');
|
||||
$pdf->rect(100, 40, 100, 40, 'F');
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$fac->fetch_client();
|
||||
$pdf->SetXY(102,42);
|
||||
$pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($fac->client->nom), 0, 'C');
|
||||
$pdf->SetFont('Arial','B',11);
|
||||
$pdf->SetXY(102,$pdf->GetY()+3);
|
||||
$pdf->MultiCell(96,5, $outputlangs->convToOutputCharset($fac->client->adresse) . "\n\n" . $outputlangs->convToOutputCharset($fac->client->cp) . " " . $outputlangs->convToOutputCharset($fac->client->ville), 0, 'C');
|
||||
|
||||
|
||||
|
||||
|
||||
$pdf->SetTextColor(200,0,0);
|
||||
$pdf->SetFont('Arial','B',14);
|
||||
$pdf->Text(11, 88, $outputlangs->transnoentities('Date'));
|
||||
$pdf->Text(35, 88, ": " . dolibarr_print_date($fac->date,'day',false,$outputlangs));
|
||||
$pdf->Text(11, 94, $outputlangs->transnoentities('Invoice'));
|
||||
$pdf->Text(35, 94, ": ".$fac->ref);
|
||||
|
||||
// Montants exprimes en euros
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie));
|
||||
$pdf->Text(200 - $pdf->GetStringWidth($titre), 94, $titre);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Affiche le pied de page de la facture
|
||||
* \param pdf object PDF
|
||||
* \param fac object invoice
|
||||
* \param outputlangs object langs
|
||||
*/
|
||||
function _pagefoot(&$pdf, $fac, $outputlangs)
|
||||
{
|
||||
return pdf_pagefoot($pdf,$outputlangs,'FACTURE_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -84,6 +84,18 @@ class pdf_oursin extends ModelePDFFactures
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
|
||||
// Defini position des colonnes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxtva=113;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=174;
|
||||
|
||||
$this->tva=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
|
||||
|
||||
@@ -195,63 +207,7 @@ class pdf_oursin extends ModelePDFFactures
|
||||
$curY = $nexY;
|
||||
|
||||
// Description of product line
|
||||
$libelleproduitservice=dol_htmlentitiesbr($fac->lignes[$i]->libelle,1);
|
||||
if ($fac->lignes[$i]->desc && $fac->lignes[$i]->desc != $fac->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($fac->lignes[$i]->desc == '(CREDIT_NOTE)' && $fac->lignes[$i]->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($fac->lignes[$i]->fk_remise_except);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($fac->lignes[$i]->produit_id)
|
||||
{
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//$fac->lignes[$i]->desc='<27>zaaaa';
|
||||
//print dol_string_is_good_iso($fac->lignes[$i]->desc);
|
||||
//print dol_htmlentitiesbr($fac->lignes[$i]->desc);
|
||||
//print exit;
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($fac->lignes[$i]->desc,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si ligne associee a un code produit
|
||||
if ($fac->lignes[$i]->produit_id)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($fac->lignes[$i]->produit_id);
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($fac->lignes[$i]->date_start && $fac->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($fac->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($fac->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
//if ($i==0) { print $libelleproduitservice; exit; }
|
||||
$libelleproduitservice=pdf_getlinedesc($fac->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("sendings");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "sirocco";
|
||||
@@ -98,6 +99,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("deliveries");
|
||||
$outputlangs->load("sendings");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
@@ -179,41 +181,11 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1);
|
||||
if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1);
|
||||
}
|
||||
// Si ligne associee a un code produit
|
||||
if ($delivery->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($delivery->lignes[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
{
|
||||
// Un service peur aussi etre livre
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
}
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
}
|
||||
if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
$libelleproduitservice=pdf_getlinedesc($delivery->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetXY (30, $curY );
|
||||
|
||||
$pdf->MultiCell(100, 5, $libelleproduitservice, 0, 'J', 0);
|
||||
$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
@@ -272,19 +244,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
||||
*/
|
||||
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs)
|
||||
{
|
||||
global $langs,$conf;
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
|
||||
$pdf->SetFont('Arial','',11);
|
||||
|
||||
$pdf->Text(30,$tab_top + 5,$langs->transnoentities("Designation"));
|
||||
$pdf->Text(30,$tab_top + 5,$outputlangs->transnoentities("Designation"));
|
||||
|
||||
// $pdf->line(132, $tab_top, 132, $tab_top + $tab_height);
|
||||
// $pdf->Text(134,$tab_top + 5,$langs->transnoentities("VAT"));
|
||||
|
||||
$pdf->line(144, $tab_top, 144, $tab_top + $tab_height);
|
||||
$pdf->Text(147,$tab_top + 5,$langs->transnoentities("QtyShipped"));
|
||||
$pdf->Text(147,$tab_top + 5,$outputlangs->transnoentities("QtyShipped"));
|
||||
|
||||
// $pdf->line(156, $tab_top, 156, $tab_top + $tab_height);
|
||||
// $pdf->Text(160,$tab_top + 5,$langs->transnoentities("PriceU"));
|
||||
|
||||
@@ -52,6 +52,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
|
||||
$langs->load("main");
|
||||
$langs->load("bills");
|
||||
$langs->load("sendings");
|
||||
|
||||
$this->db = $db;
|
||||
$this->name = "typhon";
|
||||
@@ -122,6 +123,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$outputlangs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("deliveries");
|
||||
$outputlangs->load("sendings");
|
||||
|
||||
$outputlangs->setPhpLang();
|
||||
|
||||
@@ -213,41 +215,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($delivery->lignes[$i]->label,1);
|
||||
if ($delivery->lignes[$i]->description && $delivery->lignes[$i]->description!=$delivery->lignes[$i]->label)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($delivery->lignes[$i]->description,1);
|
||||
}
|
||||
// Si ligne associee a un code produit
|
||||
if ($delivery->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($delivery->lignes[$i]->fk_product);
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
{
|
||||
// Un service peur aussi etre livre
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
}
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
}
|
||||
if ($delivery->lignes[$i]->date_start && $delivery->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($delivery->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($delivery->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
$libelleproduitservice=pdf_getlinedesc($delivery->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
|
||||
|
||||
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
|
||||
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(FPDFI_PATH.'fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<69> dans les classes qui h<>ritent
|
||||
|
||||
|
||||
@@ -241,51 +241,12 @@ class pdf_propale_azur extends ModelePDFPropales
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1);
|
||||
if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($propale->lignes[$i]->fk_remise_except);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1);
|
||||
}
|
||||
}
|
||||
// Si ligne associ<63>e <20> un code produit
|
||||
if ($propale->lignes[$i]->fk_product)
|
||||
{
|
||||
$prodser = new Product($this->db);
|
||||
$prodser->fetch($propale->lignes[$i]->fk_product);
|
||||
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Service")." ";
|
||||
else
|
||||
$prefix_prodserv = $outputlangs->transnoentities("Product")." ";
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
|
||||
}
|
||||
if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage dur<75>e si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
$libelleproduitservice=pdf_getlinedesc($propale->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour g<>rer multi-page
|
||||
|
||||
// Description
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
|
||||
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par d<>faut
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
@@ -197,31 +197,10 @@ class pdf_propale_jaune extends ModelePDFPropales
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($propale->lignes[$i]->libelle,1);
|
||||
if ($propale->lignes[$i]->desc && $propale->lignes[$i]->desc!=$propale->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($propale->lignes[$i]->desc == '(CREDIT_NOTE)' && $propale->lignes[$i]->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($propale->lignes[$i]->fk_remise_except);
|
||||
$libelleproduitservice=dol_htmlentitiesbr($langs->trans("DiscountFromCreditNote",$discount->ref_facture_source),1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($propale->lignes[$i]->desc,1);
|
||||
}
|
||||
}
|
||||
if ($propale->lignes[$i]->date_start && $propale->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage dur<75>e si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($propale->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($propale->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
|
||||
$libelleproduitservice=pdf_getlinedesc($propale->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetXY (30, $curY );
|
||||
$pdf->MultiCell(102, 5, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
|
||||
$pdf->writeHTMLCell(102, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
|
||||
|
||||
$nexY = $pdf->GetY();
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
* \brief Fichier de la classe permettant de g<>n<EFBFBD>rer les rapports de paiement
|
||||
* \version $Id$
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
* and parent class for supplier orders numbering models
|
||||
* \version $Id$
|
||||
*/
|
||||
require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php');
|
||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||
|
||||
|
||||
|
||||
@@ -241,26 +241,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$curY = $nexY;
|
||||
|
||||
// Description de la ligne produit
|
||||
$libelleproduitservice=dol_htmlentitiesbr($com->lignes[$i]->libelle,1);
|
||||
if ($com->lignes[$i]->desc&&$com->lignes[$i]->desc!=$com->lignes[$i]->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
$libelleproduitservice.=dol_htmlentitiesbr($com->lignes[$i]->desc,1);
|
||||
}
|
||||
// Si ligne associ<63>e <20> un code produit
|
||||
if ($com->lignes[$i]->fk_product)
|
||||
{
|
||||
$libelleproduitservice=$outputlangs->transnoentities("Product")." ".$outputlangs->convToOutputCharset($com->lignes[$i]->ref_fourn)." - ".$libelleproduitservice;
|
||||
}
|
||||
if ($com->lignes[$i]->date_start && $com->lignes[$i]->date_end)
|
||||
{
|
||||
// Affichage dur<75>e si il y en a une
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr("(".$outputlangs->transnoentities("From")." ".dolibarr_print_date($com->lignes[$i]->date_start,'',false,$outputlangs)." ".$outputlangs->transnoentities("to")." ".dolibarr_print_date($com->lignes[$i]->date_end,'',false,$outputlangs).")",1);
|
||||
}
|
||||
$libelleproduitservice=pdf_getlinedesc($com->lignes[$i],$outputlangs);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // Dans boucle pour g<>rer multi-page
|
||||
|
||||
$pdf->writeHTMLCell(108, 4, $this->posxdesc-1, $curY, $libelleproduitservice, 0, 1);
|
||||
$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||
|
||||
$pdf->SetFont('Arial','', 9); // On repositionne la police par d<>faut
|
||||
|
||||
@@ -268,27 +253,27 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
// TVA
|
||||
$pdf->SetXY ($this->posxtva, $curY);
|
||||
$pdf->MultiCell(10, 4, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
|
||||
$pdf->MultiCell(10, 3, ($com->lignes[$i]->tva_tx < 0 ? '*':'').abs($com->lignes[$i]->tva_tx), 0, 'R');
|
||||
|
||||
// Prix unitaire HT avant remise
|
||||
$pdf->SetXY ($this->posxup, $curY);
|
||||
$pdf->MultiCell(18, 4, price($com->lignes[$i]->subprice), 0, 'R', 0);
|
||||
$pdf->MultiCell(18, 3, price($com->lignes[$i]->subprice), 0, 'R', 0);
|
||||
|
||||
// Quantit<69>
|
||||
$pdf->SetXY ($this->posxqty, $curY);
|
||||
$pdf->MultiCell(10, 4, $com->lignes[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell(10, 3, $com->lignes[$i]->qty, 0, 'R');
|
||||
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY ($this->posxdiscount, $curY);
|
||||
if ($com->lignes[$i]->remise_percent)
|
||||
{
|
||||
$pdf->MultiCell(14, 4, $com->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell(14, 3, $com->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT ligne
|
||||
$pdf->SetXY ($this->postotalht, $curY);
|
||||
$total = price($com->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(23, 4, $total, 0, 'R', 0);
|
||||
$pdf->MultiCell(23, 3, $total, 0, 'R', 0);
|
||||
|
||||
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
|
||||
$tvaligne=$com->lignes[$i]->total_tva;
|
||||
|
||||
@@ -664,167 +664,4 @@ function show_actions_done($conf,$langs,$db,$objsoc,$objcon='')
|
||||
print "<br>\n";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Show bank informations for PDF generation
|
||||
*/
|
||||
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
|
||||
{
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
|
||||
$cury+=4;
|
||||
|
||||
$usedetailedbban=$account->useDetailedBBAN();
|
||||
|
||||
if ($usedetailedbban)
|
||||
{
|
||||
$pdf->SetFont('Arial','B',6);
|
||||
$pdf->line($curx+1, $cury, $curx+1, $cury+10 );
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
||||
$pdf->line($curx+18, $cury, $curx+18, $cury+10 );
|
||||
$pdf->SetXY ($curx+18, $cury);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
||||
$pdf->line($curx+36, $cury, $curx+36, $cury+10 );
|
||||
$pdf->SetXY ($curx+36, $cury);
|
||||
$pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
|
||||
$pdf->line($curx+60, $cury, $curx+60, $cury+10 );
|
||||
$pdf->SetXY ($curx+60, $cury);
|
||||
$pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
|
||||
$pdf->line($curx+73, $cury, $curx+73, $cury+10 );
|
||||
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY ($curx, $cury+6);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+18, $cury+6);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+36, $cury+6);
|
||||
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+60, $cury+6);
|
||||
$pdf->MultiCell(13, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetFont('Arial','B',6);
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
|
||||
$cury-=9;
|
||||
}
|
||||
|
||||
$pdf->SetXY ($curx, $cury+12);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation), 0, 'L', 0);
|
||||
$pdf->SetXY ($curx, $cury+22);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("IBANNumber").': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
|
||||
$pdf->SetXY ($curx, $cury+25);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BICNumber").': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
|
||||
|
||||
return $pdf->getY();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \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;
|
||||
|
||||
$outputlangs->load("dict");
|
||||
|
||||
// Line of free text
|
||||
$ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
|
||||
|
||||
// First line of company infos
|
||||
|
||||
// Juridical status
|
||||
$ligne1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1);
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->profid2)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2);
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
$ligne2="";
|
||||
// Prof Id 3
|
||||
if ($fromcompany->profid3)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3);
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->profid4)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4);
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($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
|
||||
$nbofligne=dol_nboflines($ligne);
|
||||
//print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
|
||||
$posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
if ($ligne)
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
|
||||
$posy-=($nbofligne*3); // 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);
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -368,7 +368,7 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='')
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Output date in a string format according to language $conf->language
|
||||
* \brief Output date in a string format according to outputlang (or lang if not defined)
|
||||
* \param time GM Timestamps date (or 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' in server TZ)
|
||||
* \param format Output date format
|
||||
* "%d %b %Y",
|
||||
@@ -2456,7 +2456,7 @@ function dol_nl2br($stringtoencode,$nl2brmode=0)
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief This function is called to encode a string into a HTML string
|
||||
* \brief This function is called to encode a string into a HTML string. All entities except <> are converted.
|
||||
* \param stringtoencode String to encode
|
||||
* \param nl2brmode 0=Adding br before \n, 1=Replacing \n by br (for use with FPDF writeHTMLCell function for example)
|
||||
* \remarks For PDF usage, you can show text by 2 ways:
|
||||
@@ -2469,17 +2469,19 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
|
||||
{
|
||||
if (dol_textishtml($stringtoencode))
|
||||
{
|
||||
// Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
||||
$stringtoencode=eregi_replace('<br( [ a-zA-Z_="]*)?/?>','<br>',$stringtoencode);
|
||||
return $stringtoencode;
|
||||
//$trans = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT); var_dump($trans);
|
||||
$newstring=strtr($stringtoencode,array('<'=>'__lt__','>'=>'__gt__'));
|
||||
$newstring=@htmlentities($newstring,ENT_COMPAT,$pagecodefrom); // Make entity encoding
|
||||
$newstring=eregi_replace('<br( [ a-zA-Z_="]*)?/?>','<br>',$newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
||||
$newstring=strtr($newstring,array('__lt__'=>'<','__gt__'=>'>'));
|
||||
}
|
||||
else {
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
// We use @ to avoid warning on PHP4 that does not support entity encoding from UTF8;
|
||||
$newstring=dol_nl2br(@htmlentities($stringtoencode,ENT_COMPAT,$pagecodefrom),$nl2brmode);
|
||||
// Other substitutions that htmlentities does not do
|
||||
$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80
|
||||
return $newstring;
|
||||
}
|
||||
$newstring=str_replace(chr(128),'€',$newstring); // 128 = 0x80. Not in html entity table.
|
||||
return $newstring;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
267
htdocs/lib/pdf.lib.php
Normal file
267
htdocs/lib/pdf.lib.php
Normal file
@@ -0,0 +1,267 @@
|
||||
<?php
|
||||
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
* or see http://www.gnu.org/
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/lib/company.lib.php
|
||||
* \brief Ensemble de fonctions de base pour le module societe
|
||||
* \ingroup societe
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Show bank informations for PDF generation
|
||||
*/
|
||||
function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account)
|
||||
{
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->SetFont('Arial','B',8);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByTransferOnThisBankAccount').':', 0, 'L', 0);
|
||||
$cury+=4;
|
||||
|
||||
$usedetailedbban=$account->useDetailedBBAN();
|
||||
|
||||
if ($usedetailedbban)
|
||||
{
|
||||
$pdf->SetFont('Arial','B',6);
|
||||
$pdf->line($curx+1, $cury, $curx+1, $cury+10 );
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("BankCode"), 0, 'C', 0);
|
||||
$pdf->line($curx+18, $cury, $curx+18, $cury+10 );
|
||||
$pdf->SetXY ($curx+18, $cury);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->transnoentities("DeskCode"), 0, 'C', 0);
|
||||
$pdf->line($curx+36, $cury, $curx+36, $cury+10 );
|
||||
$pdf->SetXY ($curx+36, $cury);
|
||||
$pdf->MultiCell(24, 3, $outputlangs->transnoentities("BankAccountNumber"), 0, 'C', 0);
|
||||
$pdf->line($curx+60, $cury, $curx+60, $cury+10 );
|
||||
$pdf->SetXY ($curx+60, $cury);
|
||||
$pdf->MultiCell(13, 3, $outputlangs->transnoentities("BankAccountNumberKey"), 0, 'C', 0);
|
||||
$pdf->line($curx+73, $cury, $curx+73, $cury+10 );
|
||||
|
||||
$pdf->SetFont('Arial','',8);
|
||||
$pdf->SetXY ($curx, $cury+6);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_banque), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+18, $cury+6);
|
||||
$pdf->MultiCell(18, 3, $outputlangs->convToOutputCharset($account->code_guichet), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+36, $cury+6);
|
||||
$pdf->MultiCell(24, 3, $outputlangs->convToOutputCharset($account->number), 0, 'C', 0);
|
||||
$pdf->SetXY ($curx+60, $cury+6);
|
||||
$pdf->MultiCell(13, 3, $outputlangs->convToOutputCharset($account->cle_rib), 0, 'C', 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetFont('Arial','B',6);
|
||||
$pdf->SetXY ($curx, $cury);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
|
||||
$cury-=9;
|
||||
}
|
||||
|
||||
$pdf->SetXY ($curx, $cury+12);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("Residence").': ' . $outputlangs->convToOutputCharset($account->domiciliation), 0, 'L', 0);
|
||||
$pdf->SetXY ($curx, $cury+22);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("IBANNumber").': ' . $outputlangs->convToOutputCharset($account->iban), 0, 'L', 0);
|
||||
$pdf->SetXY ($curx, $cury+25);
|
||||
$pdf->MultiCell(90, 3, $outputlangs->transnoentities("BICNumber").': ' . $outputlangs->convToOutputCharset($account->bic), 0, 'L', 0);
|
||||
|
||||
return $pdf->getY();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \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;
|
||||
|
||||
$outputlangs->load("dict");
|
||||
|
||||
// Line of free text
|
||||
$ligne=(! empty($conf->global->$paramfreetext))?$outputlangs->convToOutputCharset($conf->global->$paramfreetext):"";
|
||||
|
||||
// First line of company infos
|
||||
|
||||
// Juridical status
|
||||
$ligne1="";
|
||||
if ($fromcompany->forme_juridique_code)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
|
||||
}
|
||||
// Capital
|
||||
if ($fromcompany->capital)
|
||||
{
|
||||
$ligne1.=($ligne1?" - ":"").$outputlangs->transnoentities("CapitalOf",$fromcompany->capital)." ".$outputlangs->transnoentities("Currency".$conf->monnaie);
|
||||
}
|
||||
// Prof Id 1
|
||||
if ($fromcompany->profid1 && ($fromcompany->pays_code != 'FR' || ! $fromcompany->profid2))
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId1",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid1);
|
||||
}
|
||||
// Prof Id 2
|
||||
if ($fromcompany->profid2)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId2",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne1.=($ligne1?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid2);
|
||||
}
|
||||
|
||||
// Second line of company infos
|
||||
$ligne2="";
|
||||
// Prof Id 3
|
||||
if ($fromcompany->profid3)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId3",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid3);
|
||||
}
|
||||
// Prof Id 4
|
||||
if ($fromcompany->profid4)
|
||||
{
|
||||
$field=$outputlangs->transcountrynoentities("ProfId4",$fromcompany->pays_code);
|
||||
if (eregi('\((.*)\)',$field,$reg)) $field=$reg[1];
|
||||
$ligne2.=($ligne2?" - ":"").$field.": ".$outputlangs->convToOutputCharset($fromcompany->profid4);
|
||||
}
|
||||
// IntraCommunautary VAT
|
||||
if ($fromcompany->tva_intra != '')
|
||||
{
|
||||
$ligne2.=($ligne2?" - ":"").$outputlangs->transnoentities("VATIntraShort").": ".$outputlangs->convToOutputCharset($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
|
||||
$nbofligne=dol_nboflines($ligne);
|
||||
//print 'e'.$ligne.'t'.dol_nboflines($ligne);exit;
|
||||
$posy=$marge_basse + ($nbofligne*3) + ($ligne1?3:0) + ($ligne2?3:0);
|
||||
|
||||
if ($ligne)
|
||||
{
|
||||
$pdf->SetXY($marge_gauche,-$posy);
|
||||
$pdf->MultiCell(190, 3, $ligne, 0, 'L', 0);
|
||||
$posy-=($nbofligne*3); // 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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return line description translated in outputlangs but encoded in UTF8
|
||||
* \param line Line to format
|
||||
* \param outputlang Object lang for output
|
||||
*/
|
||||
function pdf_getlinedesc($line,$outputlangs)
|
||||
{
|
||||
global $db;
|
||||
|
||||
if (empty($line->libelle)) $line->libelle=$line->label;
|
||||
if (empty($line->desc)) $line->desc=$line->description;
|
||||
if (empty($line->produit_id)) $line->produit_id=$line->fk_product;
|
||||
|
||||
// Description of product line
|
||||
$libelleproduitservice=$line->libelle;
|
||||
if ($line->desc && $line->desc != $line->libelle)
|
||||
{
|
||||
if ($libelleproduitservice) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($line->desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$discount->ref_facture_source);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($line->produit_id)
|
||||
{
|
||||
$libelleproduitservice.=$line->desc;
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=$line->desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si ligne associee a un code produit
|
||||
if ($line->produit_id)
|
||||
{
|
||||
$prodser = new Product($db);
|
||||
$prodser->fetch($line->produit_id);
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
$prefix_prodserv = "";
|
||||
if($prodser->isservice())
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||
}
|
||||
else
|
||||
{
|
||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
|
||||
}
|
||||
|
||||
$libelleproduitservice=$prefix_prodserv.$prodser->ref." - ".$libelleproduitservice;
|
||||
}
|
||||
|
||||
}
|
||||
$libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice);
|
||||
|
||||
if ($line->date_start || $line->date_end)
|
||||
{
|
||||
// Affichage duree si il y en a une
|
||||
$period="(";
|
||||
if ($line->date_start) $period.=$outputlangs->transnoentitiesnoconv("From")." ".dolibarr_print_date($line->date_start,'',false);
|
||||
if ($period) $period.=" ";
|
||||
if ($line->date_end) $period.=$outputlangs->transnoentitiesnoconv("to")." ".dolibarr_print_date($line->date_end,'',false);
|
||||
$period.=")";
|
||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr($period,1);
|
||||
}
|
||||
return $libelleproduitservice;
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user