fix a lot of beug

This commit is contained in:
philippe grand 2016-03-25 18:16:58 +01:00
parent 884ba3a0ba
commit 08970e67d7

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com> * Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2016 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -68,7 +69,6 @@ class pdf_standard extends ModeleExpenseReport
$langs->load("main"); $langs->load("main");
$langs->load("trips"); $langs->load("trips");
$langs->load("project"); $langs->load("project");
$langs->load("trips");
$this->db = $db; $this->db = $db;
$this->name = ""; $this->name = "";
@ -91,8 +91,8 @@ class pdf_standard extends ModeleExpenseReport
$this->option_condreg = 1; // Affiche conditions reglement $this->option_condreg = 1; // Affiche conditions reglement
$this->option_codeproduitservice = 1; // Affiche code produit-service $this->option_codeproduitservice = 1; // Affiche code produit-service
$this->option_multilang = 1; // Dispo en plusieurs langues $this->option_multilang = 1; // Dispo en plusieurs langues
$this->option_escompte = 1; // Affiche si il y a eu escompte $this->option_escompte = 0; // Affiche si il y a eu escompte
$this->option_credit_note = 1; // Support credit notes $this->option_credit_note = 0; // Support credit notes
$this->option_freetext = 1; // Support add of a personalised text $this->option_freetext = 1; // Support add of a personalised text
$this->option_draft_watermark = 1; // Support add of a watermark on drafts $this->option_draft_watermark = 1; // Support add of a watermark on drafts
@ -104,14 +104,14 @@ class pdf_standard extends ModeleExpenseReport
// Define position of columns // Define position of columns
$this->posxpiece=$this->marge_gauche+1; $this->posxpiece=$this->marge_gauche+1;
$this->posxdesc=20; $this->posxcomment=$this->marge_gauche+10;
$this->posxdate=85; $this->posxdate=80;
$this->posxtype=105; $this->posxtype=97;
$this->posxprojet=125; $this->posxprojet=116;
$this->posxtva=145; $this->posxtva=136;
$this->posxup=162; $this->posxup=148;
$this->posxqty=176; $this->posxqty=166;
$this->postotalttc=186; $this->postotalttc=178;
if ($this->page_largeur < 210) // To work with US executive format if ($this->page_largeur < 210) // To work with US executive format
{ {
$this->posxdate-=20; $this->posxdate-=20;
@ -127,7 +127,6 @@ class pdf_standard extends ModeleExpenseReport
$this->localtax1=array(); $this->localtax1=array();
$this->localtax2=array(); $this->localtax2=array();
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
$this->atleastonediscount=0;
} }
@ -199,7 +198,7 @@ class pdf_standard extends ModeleExpenseReport
// Create pdf instance // Create pdf instance
$pdf=pdf_getInstance($this->format); $pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance $default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
$heightforinfotot = 50; // Height reserved to output the info and total part $heightforinfotot = 40; // Height reserved to output the info and total part
$heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page $heightforfreetext= (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT)?$conf->global->MAIN_PDF_FREETEXT_HEIGHT:5); // Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1,0); $pdf->SetAutoPageBreak(1,0);
@ -230,15 +229,6 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
{
if ($object->lines[$i]->remise_percent)
{
$this->atleastonediscount++;
}
}
// New page // New page
$pdf->AddPage(); $pdf->AddPage();
if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (! empty($tplidx)) $pdf->useTemplate($tplidx);
@ -249,9 +239,9 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$tab_top = 95; $tab_top = 95;
$tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?95:10); $tab_top_newpage = (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)?65:10);
$tab_height = 110; $tab_height = 130;
$tab_height_newpage = 110; $tab_height_newpage = 150;
// Show notes // Show notes
$notetoshow=empty($object->note_public)?'':$object->note_public; $notetoshow=empty($object->note_public)?'':$object->note_public;
@ -297,7 +287,7 @@ class pdf_standard extends ModeleExpenseReport
$piece_comptable = $i +1; $piece_comptable = $i +1;
$curY = $nexY; $curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage $pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage); $pdf->setTopMargin($tab_top_newpage);
@ -305,18 +295,17 @@ class pdf_standard extends ModeleExpenseReport
$pageposbefore=$pdf->getPage(); $pageposbefore=$pdf->getPage();
// Description of product line // Description of product line
$curX = $this->posxdesc-1; $curX = $this->posxcomment-1;
$showpricebeforepagebreak=1; $showpricebeforepagebreak=1;
// Accountancy piece // Accountancy piece
$pdf->SetFont('','', $default_font_size - 1); $pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-1, 3, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); $pdf->MultiCell($this->posxcomment-$this->posxpiece-0.8, 4, $piece_comptable, 0, 'C');
// Comments // Comments
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxcomment, $curY); $pdf->SetXY($this->posxcomment, $curY);
$pdf->writeHTMLCell($this->posxdate-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $object->lines[$i]->comments, 0, 1); $pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1);
//nexY //nexY
$nexY = $pdf->GetY(); $nexY = $pdf->GetY();
@ -326,65 +315,51 @@ class pdf_standard extends ModeleExpenseReport
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// Date // Date
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxdate, $curY); $pdf->SetXY($this->posxdate, $curY);
$pdf->MultiCell($this->posxtype-$this->posxdate-1, 3,dol_print_date($object->lines[$i]->date,"day",false,$outpulangs), 0, 'C'); $pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4,dol_print_date($object->lines[$i]->date,"day",false,$outpulangs), 0, 'C');
// Type // Type
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtype, $curY); $pdf->SetXY($this->posxtype, $curY);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1, 3,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C'); $pdf->MultiCell($this->posxprojet-$this->posxtype-0.8, 4,$outputlangs->transnoentities($object->lines[$i]->type_fees_code), 0, 'C');
// Project // Project
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxprojet, $curY); $pdf->SetXY($this->posxprojet, $curY);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1, 3,$object->lines[$i]->projet_ref, 0, 'C'); $pdf->MultiCell($this->posxtva-$this->posxprojet-0.8, 4,$object->lines[$i]->projet_ref, 0, 'C');
// VAT Rate // VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxtva, $curY); $pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3,$vat_rate, 0, 'R'); $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C');
} }
// Unit price // Unit price
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxup, $curY); $pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3,price($object->lines[$i]->value_unit), 0, 'R'); $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R');
// Quantity // Quantity
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->posxqty, $curY); $pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty, 3,$object->lines[$i]->qty, 0, 'C'); $pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'C');
// Total with all taxes // Total with all taxes
$pdf->SetFont('','', $default_font_size - 1);
$pdf->SetXY($this->postotalttc-1, $curY); $pdf->SetXY($this->postotalttc-1, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 3, price($object->lines[$i]->total_ttc), 0, 'R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
$nexY+=5;
// Cherche nombre de lignes a venir pour savoir si place suffisante // Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line if ($i < ($nblignes - 1)) // If it's not last line
{ {
//on recupere la description du produit suivant //on recupere la description du produit suivant
$follow_descproduitservice = $object->lines[$i+1]->desc; $follow_comment = $object->lines[$i+1]->comments;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowDesc = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4; $nblineFollowComment = dol_nboflines_bis($follow_descproduitservice,52,$outputlangs->charset_output)*4;
// Et si on affiche dates de validite, on ajoute encore une ligne
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
{
$nblineFollowDesc += 4;
}
} }
else // If it's last line else // If it's last line
{ {
$nblineFollowDesc = 0; $nblineFollowComment = 0;
} }
$nexY+=2; // Passe espace entre les lignes $nexY+=4; // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages // Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter) while ($pagenb < $pageposafter)
@ -590,130 +565,133 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','B',18); $pdf->SetFont('','B',18);
$pdf->SetTextColor(111,81,124); $pdf->SetTextColor(111,81,124);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R'); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$posx, 3, $object->getLibStatut(0), '', 'R');
if ($showaddress)
{
// Sender properties
$carac_emetteur = '';
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address);
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town);
$carac_emetteur .= "\n";
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\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);
// Sender properties // Show sender
$carac_emetteur = ''; $posy=50;
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->address); $posx=$this->marge_gauche;
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->convToOutputCharset($this->emetteur->zip).' '.$outputlangs->convToOutputCharset($this->emetteur->town); $hautcadre=40;
$carac_emetteur .= "\n"; if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118;
// Phone
if ($this->emetteur->phone) $carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Phone")." : ".$outputlangs->convToOutputCharset($this->emetteur->phone);
// Fax
if ($this->emetteur->fax) $carac_emetteur .= ($carac_emetteur ? ($this->emetteur->tel ? " - " : "\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);
// Show sender // Show sender frame
$posy=50; $pdf->SetTextColor(0,0,0);
$posx=$this->marge_gauche; $pdf->SetFont('','B', $default_font_size - 2);
$hautcadre=40; $pdf->SetXY($posx,$posy-5);
if (! empty($conf->global->MAIN_INVERT_SENDER_RECIPIENT)) $posx=118; $pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender frame // Show sender name
$pdf->SetTextColor(0,0,0); $pdf->SetXY($posx+2,$posy+3);
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size);
$pdf->SetXY($posx,$posy-5); $pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L');
$pdf->MultiCell(66,5, $outputlangs->transnoentities("TripSociete")." :",'','L');
$pdf->SetXY($posx,$posy);
$pdf->SetFillColor(224,224,224);
$pdf->MultiCell(82, $hautcadre, "", 0, 'R', 1);
$pdf->SetTextColor(0,0,60);
// Show sender name // Show sender information
$pdf->SetXY($posx+2,$posy+3); $pdf->SetXY($posx+2,$posy+8);
$pdf->SetFont('','B', $default_font_size); $pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(80, 4, $outputlangs->convToOutputCharset($this->emetteur->name), 0, 'L'); $pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Show sender information // Show recipient
$pdf->SetXY($posx+2,$posy+8); $posy=50;
$pdf->SetFont('','', $default_font_size - 1); $posx=100;
$pdf->MultiCell(80, 4, $carac_emetteur, 0, 'L');
// Show recipient // Show recipient frame
$posy=50; $pdf->SetTextColor(0,0,0);
$posx=100; $pdf->SetFont('','B',8);
$pdf->SetXY($posx,$posy-5);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L');
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre);
// Show recipient frame // Informations for trip (dates and users workflow)
$pdf->SetTextColor(0,0,0); if ($object->fk_user_author > 0)
$pdf->SetFont('','B',8); {
$pdf->SetXY($posx,$posy-5); $userfee=new User($this->db);
$pdf->MultiCell(80,5, $outputlangs->transnoentities("TripNDF")." :", 0, 'L'); $userfee->fetch($object->fk_user_author); $posy+=3;
$pdf->rect($posx, $posy, $this->page_largeur - $this->marge_gauche - $posx, $hautcadre); $pdf->SetXY($posx+2,$posy);
$pdf->SetFont('','',10);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L');
}
// Informations for trip (dates and users workflow) if ($object->fk_statut==99)
if ($object->fk_user_author > 0) {
{ if ($object->fk_user_refuse > 0)
$userfee=new User($this->db); {
$userfee->fetch($object->fk_user_author); $posy+=3; $userfee=new User($this->db);
$pdf->SetXY($posx+2,$posy); $userfee->fetch($object->fk_user_refuse); $posy+=6;
$pdf->SetFont('','',10); $pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L'); $pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5; $posy+=5;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateCreation")." : ".dol_print_date($object->date_create,"day",false,$outpulangs),0,'L'); $pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L');
} $posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L');
}
}
else if($object->fk_statut==4)
{
if ($object->fk_user_cancel > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_cancel); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
}
}
else
{
if ($object->fk_user_approve > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_approve); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outpulangs),0,'L');
}
}
if ($object->fk_statut==99) if($object->fk_statut==6)
{ {
if ($object->fk_user_refuse > 0) if ($object->fk_user_paid > 0)
{ {
$userfee=new User($this->db); $userfee=new User($this->db);
$userfee->fetch($object->fk_user_refuse); $posy+=6; $userfee->fetch($object->fk_user_paid); $posy+=6;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L'); $pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5; $posy+=5;
$pdf->SetXY($posx+2,$posy); $pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_REFUS")." : ".$outputlangs->convToOutputCharset($object->detail_refuse),0,'L'); $pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
$posy+=5; }
$pdf->SetXY($posx+2,$posy); }
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_REFUS")." : ".dol_print_date($object->date_refuse,"day",false,$outpulangs),0,'L'); }
}
}
else if($object->fk_statut==4)
{
if ($object->fk_user_cancel > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_cancel); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("MOTIF_CANCEL")." : ".$outputlangs->convToOutputCharset($object->detail_cancel),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel,"day",false,$outpulangs),0,'L');
}
}
else
{
if ($object->fk_user_approve > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_approve); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DateApprove")." : ".dol_print_date($object->date_approve,"day",false,$outpulangs),0,'L');
}
}
if($object->fk_statut==6)
{
if ($object->fk_user_paid > 0)
{
$userfee=new User($this->db);
$userfee->fetch($object->fk_user_paid); $posy+=6;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname,$userfee->lastname),0,'L');
$posy+=5;
$pdf->SetXY($posx+2,$posy);
$pdf->MultiCell(96,4,$outputlangs->transnoentities("DATE_PAIEMENT")." : ".dol_print_date($object->date_paiement,"day",false,$outpulangs),0,'L');
}
}
} }
@ -727,9 +705,13 @@ class pdf_standard extends ModeleExpenseReport
* @param Translate $outputlangs Output langs * @param Translate $outputlangs Output langs
* @return void * @return void
*/ */
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs) function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop=0, $hidebottom=0)
{ {
global $conf; global $conf;
// Force to disable hidetop and hidebottom
$hidebottom=0;
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
@ -745,56 +727,86 @@ class pdf_standard extends ModeleExpenseReport
// Rect prend une longueur en 3eme param // Rect prend une longueur en 3eme param
$pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height); $pdf->Rect($this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height);
// line prend une position y en 3eme param // line prend une position y en 3eme param
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5); if (empty($hidetop))
{
$pdf->line($this->marge_gauche, $tab_top+5, $this->page_largeur-$this->marge_droite, $tab_top+5);
}
$pdf->SetFont('','',8); $pdf->SetFont('','',8);
// Accountancy piece // Accountancy piece
$pdf->SetXY($this->posxpiece-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxdesc-$this->posxpiece-1,1,'','','R'); {
$pdf->SetXY($this->posxpiece-1, $tab_top+1);
$pdf->MultiCell($this->posxcomment-$this->posxpiece-1,1,'','','R');
}
// Comments // Comments
$pdf->line($this->posxdesc-1, $tab_top, $this->posxdesc-1, $tab_top + $tab_height); $pdf->line($this->posxcomment-1, $tab_top, $this->posxcomment-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdesc-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxdate-$this->posxdesc-1,1,$outputlangs->transnoentities("Description"),'','L'); {
$pdf->SetXY($this->posxcomment-1, $tab_top+1);
$pdf->MultiCell($this->posxdate-$this->posxcomment-1,1,$outputlangs->transnoentities("Description"),'','L');
}
// Date // Date
$pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height); $pdf->line($this->posxdate-1, $tab_top, $this->posxdate-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxdate-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C'); {
$pdf->SetXY($this->posxdate-1, $tab_top+1);
$pdf->MultiCell($this->posxtype-$this->posxdate-1,2, $outputlangs->transnoentities("Date"),'','C');
}
// Type // Type
$pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height); $pdf->line($this->posxtype-1, $tab_top, $this->posxtype-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtype-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C'); {
$pdf->SetXY($this->posxtype-1, $tab_top+1);
$pdf->MultiCell($this->posxprojet-$this->posxtype-1,2, $outputlangs->transnoentities("Type"),'','C');
}
// Project // Project
$pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height); $pdf->line($this->posxprojet-1, $tab_top, $this->posxprojet-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxprojet-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C'); {
$pdf->SetXY($this->posxprojet-1, $tab_top+1);
$pdf->MultiCell($this->posxtva-$this->posxprojet-1,2, $outputlangs->transnoentities("Project"),'','C');
}
// VAT // VAT
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height); $pdf->line($this->posxtva-1, $tab_top, $this->posxtva-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxtva-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C'); {
$pdf->SetXY($this->posxtva-1, $tab_top+1);
$pdf->MultiCell($this->posxup-$this->posxtva-1,2, $outputlangs->transnoentities("VAT"),'','C');
}
} }
// Unit price // Unit price
$pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height); $pdf->line($this->posxup-1, $tab_top, $this->posxup-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxup-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C'); {
$pdf->SetXY($this->posxup-1, $tab_top+1);
$pdf->MultiCell($this->posxqty-$this->posxup-1,2, $outputlangs->transnoentities("PriceU"),'','C');
}
// Quantity // Quantity
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height); $pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
$pdf->SetXY($this->posxqty-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R'); {
$pdf->SetXY($this->posxqty-1, $tab_top+1);
$pdf->MultiCell($this->postotalttc-$this->posxqty,2, $outputlangs->transnoentities("Qty"),'','R');
}
// Total with all taxes // Total with all taxes
$pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height); $pdf->line($this->postotalttc, $tab_top, $this->postotalttc, $tab_top + $tab_height);
$pdf->SetXY($this->postotalttc-1, $tab_top+1); if (empty($hidetop))
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R'); {
$pdf->SetXY($this->postotalttc-1, $tab_top+1);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 2, $outputlangs->transnoentities("TotalTTC"),'','R');
}
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
} }