Change to uniformize code of PDF generators

This commit is contained in:
Laurent Destailleur 2009-01-29 01:57:56 +00:00
parent 745056e6d3
commit 204693b0e8
18 changed files with 319 additions and 175 deletions

View File

@ -1,6 +1,6 @@
English Dolibarr changelog
***** Changelog for 2.5.1 compared to 2.5 *****
***** Changelog for 2.6 compared to 2.5 *****
For users:
- New: Can add bookmarks on all pages.
@ -21,6 +21,7 @@ For users:
- New: Added keywords in PDF
- New: Add hidden option MAIN_DISABLE_PDF_COMPRESSION.
- New: Add attachments on intervention cards
- New: Can add personalised fields in emailing selectors.
- Fix: Author, title and topic are correctly encoded i nPDF.
- Fix: Now HTML output is always UTF8, this solve bad PDF encoding on old users.
- Fix: Save new model when changed on interventions.
@ -38,6 +39,7 @@ For users:
- Fix: Multiprices features works correctly.
- Fix: Project module and task creation.
- Fix: Validation of order if a file was attached.
- Fix: A lot of fixes in PDF generators.
For translators:
- Added ca_ES language files
@ -46,7 +48,7 @@ For translators:
new translation.
For developers:
- Removed som deprecated files.
- Removed some deprecated files.
- Renamed all function dolibarr_xxx into dol_xxx to have same prefix everywhere.
- Rewrite clone feature for supplier invoice to work like other clone features.
- First change to manage a future feature "stock PMP value".

View File

@ -114,7 +114,7 @@ class CommActionRapport
}
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetFillColor(220,220,220);

View File

@ -128,6 +128,8 @@ class BordereauChequeBlochet extends FPDF
}
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pages = intval($lignes / $this->line_per_page);

View File

@ -66,7 +66,21 @@ class pdf_edison extends ModelePDFCommandes
$this->option_multilang = 0; // Dispo en plusieurs langues
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
$this->error = "";
// 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;
}
@ -151,8 +165,7 @@ class pdf_edison extends ModelePDFCommandes
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($com->ref));
@ -165,7 +178,13 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
$this->_pagehead($pdf, $com, $outputlangs);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $com, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 100;
@ -185,24 +204,20 @@ class pdf_edison extends ModelePDFCommandes
for ($i = 0 ; $i < $nblignes ; $i++)
{
$curY = $nexY;
$pdf->SetXY(30, $curY);
$pdf->MultiCell(100, 5, $outputlangs->convToOutputCharset($com->lignes[$i]->desc), 0, 'J', 0);
$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($com->lignes[$i]->desc), 0, 1);
$nexY = $pdf->GetY();
$pdf->SetXY (10, $curY);
$pdf->MultiCell(20, 5, $outputlangs->convToOutputCharset($com->lignes[$i]->ref), 0, 'C');
$pdf->SetXY (133, $curY);
$pdf->MultiCell(10, 5, $outputlangs->convToOutputCharset($com->lignes[$i]->tva_tx), 0, 'C');
$pdf->MultiCell(10, 5, vatrate($com->lignes[$i]->tva_tx), 0, 'C');
$pdf->SetXY (145, $curY);
$pdf->MultiCell(10, 5, $outputlangs->convToOutputCharset($com->lignes[$i]->qty), 0, 'C');
$pdf->MultiCell(10, 5, price2num($com->lignes[$i]->qty), 0, 'C');
$pdf->SetXY (156, $curY);
$pdf->MultiCell(18, 5, price($com->lignes[$i]->price), 0, 'R', 0);
@ -211,23 +226,39 @@ class pdf_edison extends ModelePDFCommandes
$total = price($com->lignes[$i]->total_ht);
$pdf->MultiCell(26, 5, $total, 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY);
$nexY+=2; // Passe espace entre les lignes
if ($nexY > 240 && $i < $nblignes - 1)
// cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $outputlangs->convToOutputCharset($com->lignes[$i+1]->desc);
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52)*4);
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
// New page
$pdf->AddPage();
$nexY = $iniY;
$this->_pagehead($pdf, $com,$outputlangs);
$pagenb++;
$this->_pagehead($pdf, $com, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
$nexY = $tab_top + 8;
}
}
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
/*
*
*/
$tab2_top = 241;
$tab2_lh = 7;
$tab2_height = $tab2_lh * 4;
@ -311,14 +342,16 @@ class pdf_edison extends ModelePDFCommandes
// $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top);
$pdf->Rect(10, $tab_top, 190, $tab_height);
$pdf->line(10, $tab_top + 8, 200, $tab_top + 8);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',10);
$titre = $langs->transnoentities("AmountInCurrency",$langs->transnoentitiesnoconv("Currency".$conf->monnaie));
$titre = $outputlangs->transnoentities("AmountInCurrency",$outputlangs->transnoentitiesnoconv("Currency".$conf->monnaie));
$pdf->Text(200 - $pdf->GetStringWidth($titre), 98, $titre);
}
function _pagehead(&$pdf, $com, $outputlangs)
function _pagehead(&$pdf, $com, $showaddress=1, $outputlangs)
{
global $conf,$langs,$mysoc;
$langs->load("orders");
@ -341,13 +374,36 @@ class pdf_edison extends ModelePDFCommandes
$pdf->_out('Q');
}
$pdf->SetXY(10,8);
if (defined("MAIN_INFO_SOCIETE_NOM"))
$posy=$this->marge_haute;
$pdf->SetXY($this->marge_gauche,$posy);
// Logo
$logo=$conf->societe->dir_logos.'/'.$this->emetteur->logo;
if ($this->emetteur->logo)
{
$pdf->SetTextColor(0,0,200);
$pdf->SetFont('Arial','B',14);
$pdf->MultiCell(76, 4, MAIN_INFO_SOCIETE_NOM, 0, 'L');
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->SetFont('Arial','B',13);
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->SetFont('Arial','B',12);
$posy+=20;
// Caracteristiques emetteur
$carac_emetteur = '';
@ -364,7 +420,7 @@ class pdf_edison extends ModelePDFCommandes
if ($this->emetteur->url) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Web").": ".$outputlangs->convToOutputCharset($this->emetteur->url);
$pdf->SetFont('Arial','',9);
$pdf->SetXY(12,10);
$pdf->SetXY(10,$posy);
$pdf->MultiCell(80,4, $carac_emetteur);
/*

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
*
@ -74,7 +74,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 1; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // G<EFBFBD>re les avoirs
$this->option_credit_note = 1; // Gere les avoirs
$this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; //Support add of a watermark on drafts
@ -172,9 +172,9 @@ class pdf_einstein extends ModelePDFCommandes
$pdf=new FPDI('P','mm',$this->format);
}
$pdf->Open();
$pdf->AddPage();
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($com->ref));
@ -196,10 +196,15 @@ class pdf_einstein extends ModelePDFCommandes
}
}
// Tete de page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $com, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pagenb = 1;
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
@ -210,7 +215,7 @@ class pdf_einstein extends ModelePDFCommandes
{
$tab_top = 88;
$pdf->SetFont('Arial','', 9); // Dans boucle pour g<EFBFBD>rer multi-page
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
$pdf->SetXY ($this->posxdesc-1, $tab_top);
$pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($com->note_public), 0, 'J');
$nexY = $pdf->GetY();
@ -239,13 +244,12 @@ class pdf_einstein extends ModelePDFCommandes
// Description de la ligne produit
$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, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
//if ($i==1) { print $outputlangs->convToOutputCharset($libelleproduitservice);exit; }
$pdf->SetFont('Arial','', 9); // On repositionne la police par d<EFBFBD>faut
$pdf->SetFont('Arial','', 9); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@ -271,7 +275,7 @@ class pdf_einstein extends ModelePDFCommandes
// Total HT ligne
$pdf->SetXY ($this->postotalht, $curY);
$total = price($com->lignes[$i]->total_ht);
$pdf->MultiCell(26, 4, $total, 0, 'R', 0);
$pdf->MultiCell(26, 3, $total, 0, 'R', 0);
// Collecte des totaux par valeur de tva dans $this->tva["taux"]=total_tva
$tvaligne=$com->lignes[$i]->total_tva;
@ -308,14 +312,15 @@ class pdf_einstein extends ModelePDFCommandes
$this->_pagefoot($pdf,$outputlangs);
// Nouvelle page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $com, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}
@ -680,7 +685,7 @@ class pdf_einstein extends ModelePDFCommandes
}
/*
* \brief Affiche en-t<EFBFBD>te commande
* \brief Affiche en-tete commande
* \param pdf Objet PDF
* \param com Objet commande
* \param showadress 0=non, 1=oui
@ -761,7 +766,7 @@ class pdf_einstein extends ModelePDFCommandes
$posy+=5;
$pdf->SetXY(100,$posy);
$pdf->SetTextColor(0,0,60);
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : " . dolibarr_print_date($object->date,"%d %b %Y",false,$outputlangs), '', 'R');
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("OrderDate")." : " . dolibarr_print_date($object->date,"%d %b %Y",false,$outputlangs), '', 'R');
if ($showadress)
{
@ -771,7 +776,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8);
$pdf->SetXY($this->marge_gauche,$posy-5);
$pdf->MultiCell(66,5, $outputlangs->transnoentities("BillFrom").":");
$pdf->MultiCell(66, 4, $outputlangs->transnoentities("BillFrom").":");
$pdf->SetXY($this->marge_gauche,$posy);
@ -809,7 +814,7 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','',8);
$pdf->SetXY(102,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("BillTo").":");
$pdf->MultiCell(80,4, $outputlangs->transnoentities("BillTo").":");
$object->fetch_client();
// Cadre client destinataire

View File

@ -157,7 +157,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
//Generation de l entete du fichier
$pdf->SetTitle($outputlangs->convToOutputCharset($this->expe->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
@ -171,8 +173,13 @@ Class pdf_expedition_merou extends ModelePdfExpedition
$pdf->SetFont('Arial','', 7);
//Insertion de l entete
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, $outputlangs);
$pdf->SetFont('Arial','', 7);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
//Initialisation des coordonn<6E>es
$tab_top = 53;
@ -217,13 +224,19 @@ Class pdf_expedition_merou extends ModelePdfExpedition
//Generation de la page 2
$curY += 4;
$nexY = $curY;
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1){
if ($nexY > ($tab_top+$tab_height-10) && $i < $nblignes - 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$this->_pagefoot($pdf, $outputlangs);
$pdf->AliasNbPages();
$pdf->AddPage();
$nexY = $iniY;
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->expe, $outputlangs);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 7);
}

View File

@ -171,8 +171,10 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
//$this->expe = &$this->expe;
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetTitle($outputlangs->convToOutputCharset($this->expe->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
@ -184,9 +186,12 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
$this->_pagehead($pdf,$this->exp,0,$outputlangs);
$pdf->SetFont('Arial','', 14);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $this->exp, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
@ -222,31 +227,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
}
// Description de la ligne produit
$libelleproduitservice=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1);
if ($this->expe->lignes[$i]->description && $this->expe->lignes[$i]->description!=$com->lignes[$i]->libelle)
{
if ($libelleproduitservice) $libelleproduitservice.="<br>";
$libelleproduitservice.=dol_htmlentitiesbr($this->expe->lignes[$i]->description,1);
}
// Si ligne associ<63>e <20> un code produit
if ($this->expe->lignes[$i]->fk_product)
{
$prodser = new Product($this->db);
$prodser->fetch($this->expe->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.$outputlangs->convToOutputCharset($prodser->ref)." - ".$outputlangs->convToOutputCharset($libelleproduitservice);
}
}
$libelleproduitservice=pdf_getlinedesc($this->expe->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour g<>rer multi-page

View File

@ -176,7 +176,8 @@ class pdf_crabe extends ModelePDFFactures
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref));
@ -198,8 +199,13 @@ class pdf_crabe extends ModelePDFFactures
}
}
// Tete de page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $fac, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pagenb = 1;
$tab_top = 90;
@ -313,10 +319,13 @@ class pdf_crabe extends ModelePDFFactures
$this->_pagefoot($pdf,$fac,$outputlangs);
// Nouvelle page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $fac, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0);

View File

@ -175,9 +175,8 @@ class pdf_oursin extends ModelePDFFactures
}
$pdf->Open();
$pdf->AddPage();
$this->_pagehead($pdf, $fac, $outputlangs);
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($fac->ref));
$pdf->SetSubject($outputlangs->transnoentities("Invoice"));
@ -189,6 +188,14 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetMargins(10, 10, 10);
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $fac, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = $this->marges['h']+90;
$tab_height = 110;
@ -217,7 +224,7 @@ class pdf_oursin extends ModelePDFFactures
if ($this->franchise!=1)
{
$pdf->SetXY ($this->marges['g']+119, $curY);
$pdf->MultiCell(10, 3, $fac->lignes[$i]->tva_tx, 0, 'C');
$pdf->MultiCell(10, 3, $fac->lignes[$i]->tva_tx, 0, 'R');
}
// Prix unitaire HT avant remise
$pdf->SetXY ($this->marges['g']+132, $curY);
@ -242,11 +249,15 @@ class pdf_oursin extends ModelePDFFactures
if ($nexY > 200 && $i < $nblignes - 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $fac, $outputlangs);
$pdf->AddPage();
$nexY = $iniY;
$this->_pagehead($pdf, $fac, $outputlangs);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $fac, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}
@ -676,7 +687,7 @@ class pdf_oursin extends ModelePDFFactures
$pdf->SetFont('Arial','B',10);
$pdf->Text($this->marges['g']+2,$tab_top + 5, $outputlangs->transnoentities("Designation"));
$pdf->Text($this->marges['g']+1,$tab_top + 5, $outputlangs->transnoentities("Designation"));
if ($this->franchise!=1) $pdf->Text($this->marges['g']+120, $tab_top + 5, $outputlangs->transnoentities("VAT"));
$pdf->Text($this->marges['g']+135, $tab_top + 5,$outputlangs->transnoentities("PriceUHT"));
$pdf->Text($this->marges['g']+153, $tab_top + 5, $outputlangs->transnoentities("Qty"));
@ -702,7 +713,7 @@ class pdf_oursin extends ModelePDFFactures
* \param pdf objet PDF
* \param fac objet facture
*/
function _pagehead(&$pdf, $fac, $outputlangs)
function _pagehead(&$pdf, $fac, $showadress=0, $outputlangs)
{
global $langs,$conf;
$langs->load("main");

View File

@ -139,11 +139,19 @@ class pdf_soleil extends ModelePDFFicheinter
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
$pagenb++;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 4
//Affiche le filigrane brouillon - Print Draft Watermark
if($fichinter->statut==0 && (! empty($conf->global->FICHINTER_DRAFT_WATERMARK)) )
{
@ -250,21 +258,23 @@ class pdf_soleil extends ModelePDFFicheinter
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetXY (10, $tab_top + 8 );
$desc=dol_htmlentitiesbr($fichinter->description,1);
//print $outputlangs->convToOutputCharset($desc); exit;
$pdf->writeHTMLCell(180, 1, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1);
$pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1);
$nexY = $pdf->GetY();
$pdf->line(10, $nexY, 200, $nexY);
$tab_height = $nexY - $tab_top;
$tab_height = 0;
$tab_top=$nexY;
$pdf->line(10, $nexY, 200, $nexY);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 4
//dolibarr_syslog("desc=".dol_htmlentitiesbr($fichinter->description));
$num = sizeof($fichinter->lignes);
$i=0;$j=0;
$height=16;
$height=9;
if ($num)
{
while ($i < $num)
@ -275,23 +285,24 @@ class pdf_soleil extends ModelePDFFicheinter
if ($valide>0)
{
$pdf->SetXY (10, $tab_top + $j * $height);
$pdf->writeHTMLCell(0, 4, 20, $tab_top + $j * $height,
dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei,'',false,$outputlangs)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration),1,$outputlangs->charset_output), 0, 0, 0);
$pdf->writeHTMLCell(0, 4, $this->marge_gauche, $tab_top + $j * $height,
dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dolibarr_print_date($fichinterligne->datei,'',false,$outputlangs)." - ".$outputlangs->transnoentities("Duration")." : ".ConvertSecondToTime($fichinterligne->duration),1,$outputlangs->charset_output), 0, 1, 0);
$tab_height+=4;
$pdf->SetXY (10, $tab_top + 4 + $j * $height);
$pdf->writeHTMLCell(0, 4, 20, $tab_top + 4 + $j * $height,
dol_htmlentitiesbr($outputlangs->convToOutputCharset($fichinterligne->desc),1), 0, 0, 0);
//$tab_height+=dol_nboflines_bis($fichinterligne->desc,52)*4;
$tab_height+=($height+4);
$pdf->writeHTMLCell(0, 4, $this->marge_gauche, $tab_top + 4 + $j * $height,
dol_htmlentitiesbr($outputlangs->convToOutputCharset($fichinterligne->desc),1), 0, 1, 0);
$tab_height+=dol_nboflines_bis($fichinterligne->desc,52)*4;
$j++;
}
$i++;
}
}
$pdf->line(10, $tab_top+$tab_height, 200, $tab_top+$tab_height);
// Rectangle for title and all lines
$pdf->Rect(10, 100, 190, $tab_height);
$pdf->Rect(10, 100, 190, $tab_height+ ($tab_top - 100));
$pdf->SetXY (10, $pdf->GetY() + 20);
$pdf->MultiCell(60, 5, '', 0, 'J', 0);

View File

@ -149,7 +149,8 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($delivery->ref));
$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
@ -158,9 +159,14 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetKeyWords($outputlangs->convToOutputCharset($delivery->ref)." ".$outputlangs->transnoentities("DeliveryOrder"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $delivery, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pagenb = 1;
$tab_top = 100;
$tab_height = 140;
@ -185,7 +191,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
$pdf->SetXY (30, $curY );
$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$nexY = $pdf->GetY();
@ -214,11 +220,16 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
if ($nexY > 240 && $i < $nblignes - 1)
{
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
$pdf->AddPage();
$nexY = $iniY;
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $delivery, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}

View File

@ -175,8 +175,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($delivery->ref));
@ -188,6 +187,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
/*
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
@ -198,9 +198,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
}
}
*/
$this->_pagehead($pdf, $delivery, 1, $outputlangs);
$pagenb = 1;
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $delivery, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 150;
@ -262,14 +268,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_pagefoot($pdf, $outputlangs);
// Nouvelle page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $delivery, 0, $outputlangs);
$this->_pagehead($pdf, $delivery, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}

View File

@ -175,8 +175,7 @@ class pdf_propale_azur extends ModelePDFPropales
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($propale->ref));
@ -198,10 +197,14 @@ class pdf_propale_azur extends ModelePDFPropales
}
}
// Tete de page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $propale, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pagenb = 1;
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
@ -215,7 +218,7 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
$pdf->SetXY ($this->posxdesc-1, $tab_top);
$pdf->MultiCell(190, 3, $outputlangs->convToOutputCharset($propale->note_public), 0, 'J');
$pdf->MultiCell(190, 4, $outputlangs->convToOutputCharset($propale->note_public), 0, 'J');
$nexY = $pdf->GetY();
$height_note=$nexY-$tab_top;
@ -246,18 +249,19 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetFont('Arial','', 9); // Dans boucle pour gérer multi-page
// Description
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 4, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY();
print $nexY; exit;
// TVA
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, vatrate($propale->lignes[$i]->tva_tx,1,$propale->lignes[$i]->info_bits), 0, 'R');
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, vatrate($propale->lignes[$i]->tva_tx,1,$propale->lignes[$i]->info_bits), 0, 'R');
// Prix unitaire HT avant remise
$pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, price($propale->lignes[$i]->subprice), 0, 'R', 0);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, price($propale->lignes[$i]->subprice), 0, 'R', 0);
// Quantity
$pdf->SetXY ($this->posxqty, $curY);
@ -319,14 +323,15 @@ class pdf_propale_azur extends ModelePDFPropales
$this->_pagefoot($pdf,$outputlangs);
// Nouvelle page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $propale, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}

View File

@ -156,7 +156,8 @@ class pdf_propale_jaune extends ModelePDFPropales
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($propale->ref));
$pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
@ -168,27 +169,23 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// Tete de page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $propale, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
/*
*/
$tab_top = 100;
$tab_height = 150;
/*
*
*/
$pdf->SetFillColor(242,239,119);
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
$pdf->SetXY (10, $tab_top + 10 );
$iniY = $pdf->GetY();
$curY = $pdf->GetY();
$nexY = $pdf->GetY();
$iniY = $tab_top + 12;
$curY = $tab_top + 12;
$nexY = $tab_top + 12;
$nblignes = sizeof($propale->lignes);
// Loop on each lines
@ -198,53 +195,74 @@ class pdf_propale_jaune extends ModelePDFPropales
// Description de la ligne produit
$libelleproduitservice=pdf_getlinedesc($propale->lignes[$i],$outputlangs);
$pdf->SetFont('Arial','', 9); // Dans boucle pour gerer multi-page
$pdf->SetXY (30, $curY );
$pdf->writeHTMLCell(102, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'J', 0);
$pdf->writeHTMLCell(102, 4, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('Arial','', 9); // On repositionne la police par défaut
$nexY = $pdf->GetY();
$ref=dol_htmlentitiesbr($propale->lignes[$i]->ref);
$pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 5, $outputlangs->convToOutputCharset($ref), 0, 'C', 0);
$pdf->MultiCell(20, 4, $outputlangs->convToOutputCharset($ref), 0, 'L', 0);
$pdf->SetXY (132, $curY );
$pdf->MultiCell(12, 5, vatrate($propale->lignes[$i]->tva_tx,0,$propale->lignes[$i]->info_bits), 0, 'C', 0);
$pdf->MultiCell(12, 4, vatrate($propale->lignes[$i]->tva_tx,0,$propale->lignes[$i]->info_bits), 0, 'R');
$pdf->SetXY (144, $curY );
$pdf->MultiCell(10, 5, $propale->lignes[$i]->qty, 0, 'C', 0);
$pdf->MultiCell(10, 4, price($propale->lignes[$i]->qty), 0, 'R', 0);
$pdf->SetXY (154, $curY );
$pdf->MultiCell(22, 5, price($propale->lignes[$i]->price), 0, 'R', 0);
$pdf->MultiCell(22, 4, price($propale->lignes[$i]->price), 0, 'R', 0);
$pdf->SetXY (176, $curY );
$pdf->MultiCell(24, 5, price($propale->lignes[$i]->total_ht), 0, 'R', 0);
$pdf->MultiCell(24, 4, price($propale->lignes[$i]->total_ht), 0, 'R', 0);
$pdf->line(10, $curY, 200, $curY );
//$pdf->line(10, $curY, 200, $curY );
if ($nexY > 240 && $i < $nblignes - 1)
$nexY+=2; // Passe espace entre les lignes
// cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_descproduitservice = $outputlangs->convToOutputCharset($propale->lignes[$i+1]->desc);
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = (dol_nboflines_bis($follow_descproduitservice,52)*4);
}
else // If it's last line
{
$nblineFollowDesc = 0;
}
// test si besoin nouvelle page
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
{
$this->_pagefoot($pdf,$propale,$outputlangs);
$this->_tableau($pdf, $tab_top, $tab_height, $nexY);
// New page
$pdf->AddPage();
$nexY = $iniY;
$pagenb++;
$this->_pagehead($pdf, $propale, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 4, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
$nexY = $tab_top + 8;
}
}
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
/*
*
*/
$tab2_top = 254;
$tab2_lh = 7;
$tab2_height = $tab2_lh * 3;
$pdf->SetFont('Arial','', 11);
$pdf->SetFont('Arial','', 10);
$pdf->Rect(132, $tab2_top, 68, $tab2_height);

View File

@ -116,7 +116,9 @@ class pdf_paiement extends FPDF
$pdf=new FPDI('P','mm',$this->format);
}
$pdf->Open();
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$sql = "SELECT ".$this->db->pdate("p.datep")." as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
@ -182,9 +184,14 @@ class pdf_paiement extends FPDF
}
*/
$pdf->AddPage();
// New page
$this->AddPage();
$pagenb++;
$this->Header($pdf, 1, $pages, $outputlangs);
$this->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$this->SetTextColor(0,0,0);
$this->Body($pdf, 1, $lines, $outputlangs);

View File

@ -177,8 +177,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
$pdf->Open();
$pdf->AddPage();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($com->ref));
@ -200,9 +199,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
}
}
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $com, 1, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$pagenb = 1;
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
@ -289,14 +293,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
$this->_pagefoot($pdf, $outputlangs);
// Nouvelle page
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $com, 0, $outputlangs);
$pdf->SetFont('Arial','', 9);
$pdf->MultiCell(0, 3, '', 0, 'J'); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$nexY = $tab_top_newpage + 8;
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','', 10);
}
}

View File

@ -2474,12 +2474,13 @@ function dol_htmlentitiesbr($stringtoencode,$nl2brmode=0,$pagecodefrom='UTF-8')
$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__'=>'>'));
// If already HTML, CR should be <br> so we don't change \n
}
else {
// 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
}
// Other substitutions that htmlentities does not do
$newstring=str_replace(chr(128),'&euro;',$newstring); // 128 = 0x80. Not in html entity table.
return $newstring;
}

View File

@ -226,9 +226,9 @@ function pdf_getlinedesc($line,$outputlangs)
$libelleproduitservice=$label;
// Description long of product line
if ($desc && $desc != $label)
if ($desc && ($desc != $label))
{
if ($libelleproduitservice) $libelleproduitservice.="<br>";
if ($libelleproduitservice) $libelleproduitservice.="\n";
if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
{
@ -269,7 +269,7 @@ function pdf_getlinedesc($line,$outputlangs)
}
}
$libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice);
$libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice,1);
if ($line->date_start || $line->date_end)
{