From 3679a4ba909ae0c90ee81a9927ada2a97083df67 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Fri, 4 Jul 2014 13:11:51 +0200 Subject: [PATCH] [ task #1063 ] Allow edit localtaxes rate for thirds. Works documents pdf --- .../commande/doc/pdf_einstein.modules.php | 2 +- .../commande/doc/pdf_proforma.modules.php | 2 +- .../modules/facture/doc/pdf_crabe.modules.php | 4 ++-- .../modules/propale/doc/pdf_azur.modules.php | 4 ++-- .../pdf/pdf_muscadet.modules.php | 22 +++++++++++++------ 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 68266f2cef9..712dd0b765c 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -403,7 +403,7 @@ class pdf_einstein extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php index eb599c2a214..408fd543c93 100644 --- a/htdocs/core/modules/commande/doc/pdf_proforma.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_proforma.modules.php @@ -402,7 +402,7 @@ class pdf_proforma extends ModelePDFCommandes if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 9186e51b954..d40d93fad36 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -404,7 +404,7 @@ class pdf_crabe extends ModelePDFFactures if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0, $object->thirdparty, $mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index fe952fb9903..4ac15330b42 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2008 Raphael Bertrand - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2012 Christophe Battarel * * This program is free software; you can redistribute it and/or modify @@ -458,7 +458,7 @@ class pdf_azur extends ModelePDFPropales if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$object->thirdparty,$mysoc); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index f15cab9cb6b..d601167c26d 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke - * Copyright (C) 2010-2013 Juanjo Menent + * Copyright (C) 2010-2014 Juanjo Menent * * 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 @@ -393,7 +393,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders if ((! isset($localtax1_type) || $localtax1_type=='' || ! isset($localtax2_type) || $localtax2_type=='') // if tax type not defined && (! empty($localtax1_rate) || ! empty($localtax2_rate))) // and there is local tax { - $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc); + $localtaxtmp_array=getLocalTaxesFromRate($vatrate,0,$mysoc,$object->thirdparty); $localtax1_type = $localtaxtmp_array[0]; $localtax2_type = $localtaxtmp_array[2]; } @@ -698,7 +698,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 - foreach( $this->localtax1 as $tvakey => $tvaval ) + foreach( $this->localtax1 as $localtax_type => $localtax_rate ) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -718,15 +722,19 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } } - //} + } //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ //Local tax 2 - foreach( $this->localtax2 as $tvakey => $tvaval ) + foreach( $this->localtax2 as $localtax_type => $localtax_rate ) + { + if (in_array((string) $localtax_type, array('2','4','6'))) continue; + + foreach( $localtax_rate as $tvakey => $tvaval ) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -749,7 +757,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval), 0, 'R', 1); } } - //} + } } // Total TTC