From a194901edec5c21efeca17e00f62d3eb4e8f295e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Mon, 20 Dec 2010 22:07:04 +0000 Subject: [PATCH] Fix: A lot of fix in TCPDF compatibility --- htdocs/compta/paiement/rapport.php | 6 +- .../modules/commande/pdf_edison.modules.php | 2 +- .../modules/commande/pdf_einstein.modules.php | 12 ++-- .../modules/facture/pdf_crabe.modules.php | 10 ++-- .../modules/facture/pdf_oursin.modules.php | 12 ++-- .../livraison/pdf/pdf_sirocco.modules.php | 30 ++++------ .../livraison/pdf/pdf_typhon.modules.php | 8 +-- .../modules/rapport/pdf_paiement.class.php | 59 +++++++++++-------- 8 files changed, 71 insertions(+), 68 deletions(-) diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 0f5a4cc5f4f..38dbb36817d 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -1,6 +1,6 @@ <?php /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> - * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> + * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * * 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 @@ -92,8 +92,8 @@ print_fiche_titre($titre); print '<form method="post" action="rapport.php?year='.$year.'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="action" value="builddoc">'; -$cmonth = date("n", time()); -$syear = date("Y", time()); +$cmonth = GETPOST("remonth")?GETPOST("remonth"):date("n", time()); +$syear = GETPOST("reyear")?GETPOST("reyear"):date("Y", time()); print '<select name="remonth">'; for ($month = 1 ; $month < 13 ; $month++) diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php index a93380b8a9d..a5cfb589624 100644 --- a/htdocs/includes/modules/commande/pdf_edison.modules.php +++ b/htdocs/includes/modules/commande/pdf_edison.modules.php @@ -458,7 +458,7 @@ class pdf_edison extends ModelePDFCommandes $langs->load("main"); $langs->load("bills"); - $pdf->SetFont('','',11); + $pdf->SetFont('','',10); $pdf->SetXY(30,$tab_top + 2); $pdf->MultiCell(0,4,$outputlangs->transnoentities("Designation"),0,'L'); diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php index 40e25109f9e..d2609e4c08b 100644 --- a/htdocs/includes/modules/commande/pdf_einstein.modules.php +++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php @@ -770,28 +770,28 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('','',9); - $pdf->SetXY ($this->posxdesc-1, $tab_top+2); + $pdf->SetXY ($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxtva-1, $tab_top+2); + $pdf->SetXY ($this->posxtva-1, $tab_top+1); $pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); } $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxup-1, $tab_top+2); + $pdf->SetXY ($this->posxup-1, $tab_top+1); $pdf->MultiCell(18,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxqty-1, $tab_top+2); + $pdf->SetXY ($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if ($this->atleastonediscount) { - $pdf->SetXY ($this->posxdiscount-1, $tab_top+2); + $pdf->SetXY ($this->posxdiscount-1, $tab_top+1); $pdf->MultiCell(14,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } @@ -799,7 +799,7 @@ class pdf_einstein extends ModelePDFCommandes { $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); } - $pdf->SetXY ($this->postotalht-1, $tab_top+2); + $pdf->SetXY ($this->postotalht-1, $tab_top+1); $pdf->MultiCell(28,2, $outputlangs->transnoentities("TotalHT"),'','C'); } diff --git a/htdocs/includes/modules/facture/pdf_crabe.modules.php b/htdocs/includes/modules/facture/pdf_crabe.modules.php index 25b411aaaeb..0670d22311b 100644 --- a/htdocs/includes/modules/facture/pdf_crabe.modules.php +++ b/htdocs/includes/modules/facture/pdf_crabe.modules.php @@ -925,7 +925,7 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('','', $default_font_size - 1); - $pdf->SetXY ($this->posxdesc-1, $tab_top+2); + $pdf->SetXY ($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L'); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) @@ -936,17 +936,17 @@ class pdf_crabe extends ModelePDFFactures } $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxup-1, $tab_top+2); + $pdf->SetXY ($this->posxup-1, $tab_top+1); $pdf->MultiCell(20,2, $outputlangs->transnoentities("PriceUHT"),'','C'); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxqty-1, $tab_top+2); + $pdf->SetXY ($this->posxqty-1, $tab_top+1); $pdf->MultiCell($this->posxdiscount-$this->posxqty-1,2, $outputlangs->transnoentities("Qty"),'','C'); $pdf->line($this->posxdiscount-1, $tab_top, $this->posxdiscount-1, $tab_top + $tab_height); if ($this->atleastonediscount) { - $pdf->SetXY ($this->posxdiscount-1, $tab_top+2); + $pdf->SetXY ($this->posxdiscount-1, $tab_top+1); $pdf->MultiCell(14,2, $outputlangs->transnoentities("ReductionShort"),'','C'); } @@ -954,7 +954,7 @@ class pdf_crabe extends ModelePDFFactures { $pdf->line($this->postotalht, $tab_top, $this->postotalht, $tab_top + $tab_height); } - $pdf->SetXY ($this->postotalht-1, $tab_top+2); + $pdf->SetXY ($this->postotalht-1, $tab_top+1); $pdf->MultiCell(28,2, $outputlangs->transnoentities("TotalHT"),'','C'); } diff --git a/htdocs/includes/modules/facture/pdf_oursin.modules.php b/htdocs/includes/modules/facture/pdf_oursin.modules.php index 0a5f69a64db..be1758e4a66 100644 --- a/htdocs/includes/modules/facture/pdf_oursin.modules.php +++ b/htdocs/includes/modules/facture/pdf_oursin.modules.php @@ -724,19 +724,19 @@ class pdf_oursin extends ModelePDFFactures $pdf->SetFont('','B',10); - $pdf->SetXY($this->marges['g'],$tab_top + 2); + $pdf->SetXY($this->marges['g'],$tab_top + 1); $pdf->MultiCell(0, 4, $outputlangs->transnoentities("Designation"), 0, 'L'); if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { if ($this->franchise!=1) { - $pdf->SetXY($this->marges['g']+120,$tab_top + 2); + $pdf->SetXY($this->marges['g']+120,$tab_top + 1); $pdf->MultiCell(0, 4, $outputlangs->transnoentities("VAT"), 0, 'L'); } } - $pdf->SetXY($this->marges['g']+135,$tab_top + 2); + $pdf->SetXY($this->marges['g']+135,$tab_top + 1); $pdf->MultiCell(0, 4, $outputlangs->transnoentities("PriceUHT"), 0, 'L'); - $pdf->SetXY($this->marges['g']+153,$tab_top + 2); + $pdf->SetXY($this->marges['g']+153,$tab_top + 1); $pdf->MultiCell(0, 4, $outputlangs->transnoentities("Qty"), 0, 'L'); $nblignes = sizeof($object->lines); @@ -750,10 +750,10 @@ class pdf_oursin extends ModelePDFFactures } if ($rem==1) { - $pdf->SetXY($this->marges['g']+165,$tab_top + 2); + $pdf->SetXY($this->marges['g']+165,$tab_top + 1); $pdf->MultiCell(0, 4, $outputlangs->transnoentities("%"), 0, 'L'); } - $pdf->SetXY($this->marges['g']+170,$tab_top + 2); + $pdf->SetXY($this->marges['g']+170,$tab_top + 1); $pdf->MultiCell(20, 4, $outputlangs->transnoentities("TotalHTShort"), 0, 'R'); return $pdf->GetY(); diff --git a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php index b45fd6aa971..2325eb35496 100644 --- a/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php +++ b/htdocs/includes/modules/livraison/pdf/pdf_sirocco.modules.php @@ -309,23 +309,15 @@ class pdf_sirocco extends ModelePDFDeliveryOrder */ function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) { - $pdf->SetFont('','',11); + $pdf->SetFont('','',10); - $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->SetXY(30, $tab_top+1); + $pdf->MultiCell(60, 2, $outputlangs->transnoentities("Designation"), 0, 'L'); $pdf->line(144, $tab_top, 144, $tab_top + $tab_height); - $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")); + $pdf->SetXY(147, $tab_top+1); + $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"), 0, 'L'); - // $pdf->line(174, $tab_top, 174, $tab_top + $tab_height); - // $pdf->Text(187,$tab_top + 5,$langs->transnoentities("Total")); - - // $pdf->Rect(10, $tab_top, 190, $nexY - $tab_top); $pdf->Rect(10, $tab_top, 190, $tab_height); } @@ -403,16 +395,18 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $pdf->SetTextColor(200,0,0); - $pdf->SetFont('','B',12); - $pdf->Text(11, 88, $outputlangs->transnoentities("Date")." : " . dol_print_date(($object->date_delivery?$object->date_delivery:$date->valid),"day",false,$outputlangs,true)); - $pdf->Text(11, 94, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref)); + $pdf->SetFont('','B',11); + $pdf->SetXY($this->page_largeur - $this->marge_droite - 100, 86); + $pdf->MultiCell(100, 2, $outputlangs->transnoentities("Date")." : " . dol_print_date(($object->date_delivery?$object->date_delivery:$date->valid),"day",false,$outputlangs,true), 0, 'R'); + $pdf->SetXY($this->page_largeur - $this->marge_droite - 100, 92); + $pdf->MultiCell(100, 2, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), 0, 'R'); if ($object->client->code_client) { $posy+=7; - $pdf->SetXY(102,$posy); + $pdf->SetXY($this->page_largeur - $this->marge_droite - 100, $posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(96, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("CustomerCode")." : " . $outputlangs->transnoentities($object->client->code_client), '', 'R'); } $pdf->SetFont('','B',9); diff --git a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php index 468080774b8..46bde86d934 100644 --- a/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php +++ b/htdocs/includes/modules/livraison/pdf/pdf_typhon.modules.php @@ -448,17 +448,17 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->SetFont('','',10); - $pdf->SetXY ($this->posxdesc-1, $tab_top+2); + $pdf->SetXY ($this->posxdesc-1, $tab_top+1); $pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L'); // Modif SEB pour avoir une col en plus pour les commentaires clients $pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height); - $pdf->SetXY ($this->posxcomm, $tab_top+2); + $pdf->SetXY ($this->posxcomm, $tab_top+1); $pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L'); // Qty $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); - $pdf->SetXY ($this->posxqty-1, $tab_top+2); + $pdf->SetXY ($this->posxqty-1, $tab_top+1); $pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R'); // Modif Seb cadres signatures @@ -606,7 +606,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->SetFont('','',8); $pdf->SetXY(102,$posy-5); - $pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":"); + $pdf->MultiCell(80,5, $outputlangs->transnoentities("DeliveryAddress").":", 0, 'L'); // Cadre client destinataire $pdf->rect(100, $posy, 100, $hautcadre); diff --git a/htdocs/includes/modules/rapport/pdf_paiement.class.php b/htdocs/includes/modules/rapport/pdf_paiement.class.php index 2875a974e90..c1325950db0 100644 --- a/htdocs/includes/modules/rapport/pdf_paiement.class.php +++ b/htdocs/includes/modules/rapport/pdf_paiement.class.php @@ -21,7 +21,7 @@ /** * \file htdocs/includes/modules/rapport/pdf_paiement.class.php * \ingroup banque - * \brief Fichier de la classe permettant de generer les rapports de paiement + * \brief File to build payment reports * \version $Id$ */ require_once(DOL_DOCUMENT_ROOT.'/lib/pdf.lib.php'); @@ -124,14 +124,17 @@ class pdf_paiement } $pdf->SetFont(pdf_getPDFFont($outputlangs)); + $num=0; + $lines=array(); + $sql = "SELECT p.datep as dp, f.facnumber"; //$sql .= ", c.libelle as paiement_type, p.num_paiement"; $sql .= ", c.code as paiement_code, p.num_paiement"; $sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount "; $sql .= ", pf.amount as pf_amount "; $sql .= ", p.rowid as prowid"; - $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f, "; - $sql .= MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf"; + $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."facture as f,"; + $sql .= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiement_facture as pf"; $sql .= " WHERE pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid"; $sql .= " AND p.fk_paiement = c.id "; $sql .= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'"; @@ -141,18 +144,17 @@ class pdf_paiement $result = $this->db->query($sql); if ($result) { - $lines = $this->db->num_rows($result); + $num = $this->db->num_rows($result); $i = 0; $var=True; - while ($i < $lines) + while ($i < $num) { $objp = $this->db->fetch_object($result); $var=!$var; $lines[$i][0] = $objp->facnumber; $lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"%d %B %Y",false,$outputlangs,true); - //$lines[$i][2] = $objp->paiement_type ; $lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code); $lines[$i][3] = $objp->num_paiement; $lines[$i][4] = price($objp->paiement_amount); @@ -167,7 +169,7 @@ class pdf_paiement dol_print_error($this->db); } - $pages = intval($lines / $this->line_per_page); + $pages = intval($num / $this->line_per_page); if (($lines % $this->line_per_page)>0) { @@ -232,31 +234,37 @@ class pdf_paiement $title=$outputlangs->transnoentities("ListOfCustomerPayments"); $title.=' - '.dol_print_date(dol_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs,true); $pdf->SetFont('','B',12); - $pdf->Text(70, 10, $title); + $pdf->SetXY(10,10); + $pdf->MultiCell(200, 2, $title, 0, 'C'); + + $pdf->SetFont('','',10); - $pdf->SetFont('','',12); - $pdf->Text(11, 16, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true)); + $pdf->SetXY (11, 16); + $pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true), 0, 'L'); - $pdf->SetFont('','',12); - $pdf->Text(11, 22, $outputlangs->transnoentities("Page")." : ".$page); + $pdf->SetXY (11, 22); + $pdf->MultiCell(80, 2, $outputlangs->transnoentities("Page")." : ".$page, 0, 'L'); - $pdf->SetFont('','',12); + // Title line - $pdf->Text(11,$this->tab_top + 6,'Date'); + $pdf->SetXY (11, $this->tab_top+2); + $pdf->MultiCell(30, 2, 'Date'); $pdf->line(40, $this->tab_top, 40, $this->tab_top + $this->tab_height + 10); - $pdf->Text(42, $this->tab_top + 6, $outputlangs->transnoentities("PaymentMode")); + $pdf->SetXY (42, $this->tab_top+2); + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L'); $pdf->line(80, $this->tab_top, 80, $this->tab_top + $this->tab_height + 10); - $pdf->Text(82, $this->tab_top + 6, $outputlangs->transnoentities("Invoice")); + $pdf->SetXY (82, $this->tab_top+2); + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("Invoice"), 0, 'L'); $pdf->line(120, $this->tab_top, 120, $this->tab_top + $this->tab_height + 10); - $pdf->Text(122, $this->tab_top + 6, $outputlangs->transnoentities("AmountInvoice")); + $pdf->SetXY (122, $this->tab_top+2); + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'L'); $pdf->line(160, $this->tab_top, 160, $this->tab_top + $this->tab_height + 10); - - $pdf->SetXY (160, $this->tab_top); - $pdf->MultiCell(40, 10, $outputlangs->transnoentities("AmountPayment"), 0, 'R'); + $pdf->SetXY (162, $this->tab_top+2); + $pdf->MultiCell(40, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'L'); $pdf->line(10, $this->tab_top + 10, 200, $this->tab_top + 10 ); @@ -289,24 +297,25 @@ class pdf_paiement } $pdf->SetXY (10, $this->tab_top + 10 + $yp); - $pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'J', 1); + $pdf->MultiCell(30, $this->line_height, $lines[$j][1], 0, 'L', 1); $pdf->SetXY (40, $this->tab_top + 10 + $yp); - $pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'J', 1); + $pdf->MultiCell(80, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'L', 1); $pdf->SetXY (120, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, '', 0, 'J', 1); + $pdf->MultiCell(40, $this->line_height, '', 0, 'R', 1); $pdf->SetXY (160, $this->tab_top + 10 + $yp); $pdf->MultiCell(40, $this->line_height, $lines[$j][4], 0, 'R', 1); $yp = $yp + 5; } + // Invoice number $pdf->SetXY (80, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'J', 0); + $pdf->MultiCell(40, $this->line_height, $lines[$j][0], 0, 'L', 0); $pdf->SetXY (120, $this->tab_top + 10 + $yp); - $pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'J', 0); + $pdf->MultiCell(40, $this->line_height, $lines[$j][5], 0, 'R', 0); $pdf->SetXY (160, $this->tab_top + 10 + $yp); $pdf->MultiCell(40, $this->line_height, $lines[$j][6], 0, 'R', 0); -- GitLab