From eb44f272e37818100a6c54f11f4ce3cc8379ddef Mon Sep 17 00:00:00 2001 From: simnandez Date: Wed, 11 Sep 2013 17:10:06 +0200 Subject: [PATCH] [ task #1060 ] Register fields localtax(1|2)_type into details tables --- htdocs/fourn/class/fournisseur.facture.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 55f83ea0d03..98608a6af0e 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2010-2011 Juanjo Menent + * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry * @@ -1163,7 +1163,10 @@ class FactureFournisseur extends CommonInvoice // qty, pu, remise_percent et txtva // TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker // la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva. - $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty); + + $localtaxes_type=getLocalTaxesFromRate($vatrate,0,$this->thirdparty); + + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty,$localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1194,6 +1197,13 @@ class FactureFournisseur extends CommonInvoice $sql.= ", tva_tx = ".price2num($vatrate); $sql.= ", localtax1_tx = ".price2num($txlocaltax1); $sql.= ", localtax2_tx = ".price2num($txlocaltax2); + + if(count($localtaxes_type)) + { + $sql.= ", localtax1_type = '".$localtaxes_type[0]."'"; + $sql.= ", localtax2_type = '".$localtaxes_type[2]."'"; + } + $sql.= ", total_ht = ".price2num($total_ht); $sql.= ", tva= ".price2num($total_tva); $sql.= ", total_localtax1= ".price2num($total_localtax1);