Fix: possibility to hide details

This commit is contained in:
Regis Houssin 2011-04-13 09:35:51 +00:00
parent c5307243c8
commit d434dcc85b
7 changed files with 75 additions and 61 deletions

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -203,7 +203,7 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
// Description de la ligne produit
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1,GETPOST('hidedesc'));
//$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
@ -213,19 +213,19 @@ class pdf_edison extends ModelePDFCommandes
$pdf->SetXY (10, $curY);
$pdf->MultiCell(20, 3, $ref, 0, 'C');
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (133, $curY);
$pdf->MultiCell(12, 3, $vat_rate, 0, 'C');
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (145, $curY);
$pdf->MultiCell(10, 3, $qty, 0, 'C');
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (156, $curY);
$pdf->MultiCell(18, 3, $up_excl_tax, 0, 'R', 0);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (174, $curY);
$pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0);

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -251,7 +251,7 @@ class pdf_einstein extends ModelePDFCommandes
// Description of product line
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY,GETPOST('hideref'),GETPOST('hidedesc'));
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@ -259,18 +259,18 @@ class pdf_einstein extends ModelePDFCommandes
// TVA
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
// Prix unitaire HT avant remise
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R');
@ -278,12 +278,12 @@ class pdf_einstein extends ModelePDFCommandes
$pdf->SetXY ($this->posxdiscount, $curY);
if ($object->lines[$i]->remise_percent)
{
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R');
}
// Total HT ligne
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->postotalht, $curY);
$pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0);

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -258,9 +258,7 @@ class pdf_crabe extends ModelePDFFactures
// Description of product line
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
$curX = $this->posxdesc-1;
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY);
//$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,GETPOST('hideref'),GETPOST('hidedesc'));
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@ -268,18 +266,18 @@ class pdf_crabe extends ModelePDFFactures
// VAT Rate
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 3, $vat_rate, 0, 'R');
}
// Prix unitaire HT avant remise
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 3, $qty, 0, 'R'); // Enough for 6 chars
@ -287,12 +285,12 @@ class pdf_crabe extends ModelePDFFactures
$pdf->SetXY ($this->posxdiscount, $curY);
if ($object->lines[$i]->remise_percent)
{
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 3, $remise_percent, 0, 'R');
}
// Total HT ligne
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->postotalht, $curY);
$pdf->MultiCell(26, 3, $total_excl_tax, 0, 'R', 0);

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005 Sylvain SCATTOLINI <sylvain@s-infoservices.com>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
@ -219,9 +219,7 @@ class pdf_oursin extends ModelePDFFactures
$curY = $nexY;
// Description of product line
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY+1);
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY+1,GETPOST('hideref'),GETPOST('hidedesc'));
$nexY = $pdf->GetY();
@ -230,31 +228,31 @@ class pdf_oursin extends ModelePDFFactures
{
if ($this->franchise!=1)
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->marges['g']+118, $curY);
$pdf->MultiCell(12, 3, $vat_rate, 0, 'R');
}
}
// Prix unitaire HT avant remise
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->marges['g']+132, $curY);
$pdf->MultiCell(16, 3, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->marges['g']+150, $curY);
$pdf->MultiCell(10, 3, $qty, 0, 'R');
// Remise sur ligne
$pdf->SetXY ($this->marges['g']+160, $curY);
if ($object->lines[$i]->remise_percent) {
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->MultiCell(14, 3, $remise_percent, 0, 'R');
}
// Total HT
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->marges['g']+168, $curY);
$pdf->MultiCell(21, 3, $total_excl_tax, 0, 'R', 0);

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -247,18 +247,18 @@ class pdf_propale_azur extends ModelePDFPropales
// TVA
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-1, 4, $vat_rate, 0, 'R');
}
// Prix unitaire HT avant remise
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-1, 4, $up_excl_tax, 0, 'R', 0);
// Quantity
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->posxqty, $curY);
$pdf->MultiCell($this->posxdiscount-$this->posxqty-1, 4, $qty, 0, 'R');
@ -266,12 +266,12 @@ class pdf_propale_azur extends ModelePDFPropales
$pdf->SetXY ($this->posxdiscount, $curY);
if ($object->lines[$i]->remise_percent)
{
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs);
$remise_percent = pdf_getlineremisepercent($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->MultiCell($this->postotalht-$this->posxdiscount-1, 4, $remise_percent, 0, 'R');
}
// Total HT ligne
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY ($this->postotalht, $curY);
$pdf->MultiCell(26, 4, $total_excl_tax, 0, 'R', 0);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -192,9 +192,7 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetFont('','', $default_font_size - 1); // Dans boucle pour gerer multi-page
// Description de la ligne produit
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,1);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,102,4,30,$curY,1);
//$pdf->writeHTMLCell(102, 4, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
pdf_writelinedesc($pdf,$object,$i,$outputlangs,102,4,30,$curY,1,GETPOST('hidedesc'));
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
$nexY = $pdf->GetY();
@ -203,19 +201,19 @@ class pdf_propale_jaune extends ModelePDFPropales
$pdf->SetXY (10, $curY );
$pdf->MultiCell(20, 4, $ref, 0, 'L', 0);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs);
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (132, $curY );
$pdf->MultiCell(12, 4, $vat_rate, 0, 'R');
$qty = pdf_getlineqty($object, $i, $outputlangs);
$qty = pdf_getlineqty($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (144, $curY );
$pdf->MultiCell(10, 4, $qty, 0, 'R', 0);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs);
$up_excl_tax = pdf_getlineupexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (154, $curY );
$pdf->MultiCell(22, 4, $up_excl_tax, 0, 'R', 0);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs);
$total_excl_tax = pdf_getlinetotalexcltax($object, $i, $outputlangs, GETPOST('hidedetails'));
$pdf->SetXY (176, $curY );
$pdf->MultiCell(24, 4, $total_excl_tax, 0, 'R', 0);

View File

@ -848,6 +848,10 @@ function pdf_getlineref($object,$i,$outputlangs)
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
{
@ -859,7 +863,7 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
}
else
{
return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits);
if (empty($hidedetails) || $hidedetails > 1) return vatrate($object->lines[$i]->tva_tx,1,$object->lines[$i]->info_bits);
}
}
@ -868,6 +872,10 @@ function pdf_getlinevatrate($object,$i,$outputlangs,$hidedetails=0)
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
{
@ -879,7 +887,7 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
return price($object->lines[$i]->subprice);
if (empty($hidedetails) || $hidedetails > 1) return price($object->lines[$i]->subprice);
}
}
@ -888,6 +896,10 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0)
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
{
@ -901,7 +913,7 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
}
else
{
return $object->lines[$i]->qty;
if (empty($hidedetails) || $hidedetails > 1) return $object->lines[$i]->qty;
}
}
}
@ -911,6 +923,10 @@ function pdf_getlineqty($object,$i,$outputlangs,$hidedetails=0)
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
{
@ -926,7 +942,7 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
}
else
{
return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
if (empty($hidedetails) || $hidedetails > 1) return dol_print_reduction($object->lines[$i]->remise_percent,$outputlangs);
}
}
}
@ -936,6 +952,10 @@ function pdf_getlineremisepercent($object,$i,$outputlangs,$hidedetails=0)
* @param object Object
* @param $i Current line number
* @param outputlang Object lang for output
* @param hidedetails Hide value
* 0 = no
* 1 = yes
* 2 = just special lines
*/
function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
{
@ -945,7 +965,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
if (! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -953,7 +973,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0)
}
else
{
return price($object->lines[$i]->total_ht);
if (empty($hidedetails) || $hidedetails > 1) return price($object->lines[$i]->total_ht);
}
}
}
@ -978,7 +998,7 @@ function pdf_getTotalQty($object,$type='',$outputlangs)
{
$total += $object->lines[$i]->qty;
}
else if ($type==9 && ! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
else if ($type==9 && ! empty($object->hooks) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) )
{
$special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);