diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 748a44459ce..1fe71384c5c 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -1,6 +1,7 @@ * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2010 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 @@ -173,35 +174,35 @@ else print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; $s=2/7;$qty=1;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,'HT',0); +$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[2]."
\n"; $s=10/3;$qty=1;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,'HT',0); +$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,'HT',0); +$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[2]."
\n"; $s=10/3;$qty=1;$vat=10; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,'HT',0); +$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[2]."
\n"; $s=10/3;$qty=2;$vat=10; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,'HT',0); +$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0); print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); print " x ".$langs->trans("Quantity").": ".$qty; print " - ".$langs->trans("VAT").": ".$vat.'%'; diff --git a/htdocs/cashdesk/classes/Facturation.class.php b/htdocs/cashdesk/classes/Facturation.class.php index b20c83690af..4f68821a94f 100644 --- a/htdocs/cashdesk/classes/Facturation.class.php +++ b/htdocs/cashdesk/classes/Facturation.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2008 Laurent Destailleur + * Copyright (C) 2010 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 @@ -106,7 +107,7 @@ class Facturation { // Define part of HT, VAT, TTC - $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remise_percent(),$vat_rate,0,'HT',0); + $resultarray=calcul_price_total($this->qte,$this->prix(),$this->remise_percent(),$vat_rate,0,0,0,'HT',0); // Calcul du total ht sans remise $total_ht = $resultarray[0]; diff --git a/htdocs/comm/propal/propal.class.php b/htdocs/comm/propal/propal.class.php index f033cf25e2b..a2b890803d8 100644 --- a/htdocs/comm/propal/propal.class.php +++ b/htdocs/comm/propal/propal.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2010 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 @@ -307,7 +308,7 @@ class Propal extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -420,7 +421,7 @@ class Propal extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 59d403e7b49..2958044a1e3 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2010 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 @@ -841,7 +842,7 @@ class Commande extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0 ,0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1842,7 +1843,7 @@ class Commande extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index e90544d52e2..e43ac80d362 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2005 Rodolphe Quiedeville * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2009 Regis Houssin + * Copyright (C) 2010 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 @@ -426,7 +427,7 @@ class FactureRec extends Facture // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/compta/facture/facture.class.php b/htdocs/compta/facture/facture.class.php index 9bb3ef585b3..418a33ad8d2 100644 --- a/htdocs/compta/facture/facture.class.php +++ b/htdocs/compta/facture/facture.class.php @@ -7,6 +7,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2010 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 @@ -1611,7 +1612,7 @@ class Facture extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1725,7 +1726,7 @@ class Facture extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index 7b9f3fd41a5..fd8476434f9 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -4,6 +4,8 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * Copyright (C) 2008 Raphael Bertrand (Resultic) + * Copyright (C) 2010 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 * the Free Software Foundation; either version 2 of the License, or @@ -814,7 +816,7 @@ class Contrat extends CommonObject // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 7ad16054373..30a1a9110d9 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke + * Copyright (C) 2010 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 @@ -864,7 +865,7 @@ class CommandeFournisseur extends Commande // 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, $txtva, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1309,7 +1310,7 @@ class CommandeFournisseur extends Commande // 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, $txtva, $price_base_type, $info_bits); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, 0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 1e1e6e66702..8f15623fecd 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2010 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 @@ -773,7 +774,7 @@ class FactureFournisseur extends Facture // 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, 0, $tauxtva, 0, $price_base_type, $info_bits); + $tabprice = calcul_price_total($qty, $pu, 0, $tauxtva, 0,0, 0, $price_base_type, $info_bits); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 577846449c2..ae0bede402b 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2010 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 @@ -1157,7 +1158,7 @@ function migrate_price_facture($db,$langs,$conf) $facligne= new FactureLigne($db); $facligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global,'HT',$info_bits); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva, 0, 0,$remise_percent_global,'HT',$info_bits); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1264,7 +1265,7 @@ function migrate_price_propal($db,$langs,$conf) $propalligne= new PropaleLigne($db); $propalligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global,'HT',$info_bits); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1368,7 +1369,7 @@ function migrate_price_contrat($db,$langs,$conf) //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis $contratligne->rowid=$rowid; - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global,'HT',$info_bits); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1471,7 +1472,7 @@ function migrate_price_commande($db,$langs,$conf) $commandeligne= new OrderLine($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global,'HT',$info_bits); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; @@ -1583,7 +1584,7 @@ function migrate_price_commande_fournisseur($db,$langs,$conf) $commandeligne= new CommandeFournisseurLigne($db); $commandeligne->fetch($rowid); - $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,$remise_percent_global,'HT',$info_bits); + $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,$remise_percent_global,'HT',$info_bits); $total_ht = $result[0]; $total_tva = $result[1]; $total_ttc = $result[2]; diff --git a/htdocs/lib/price.lib.php b/htdocs/lib/price.lib.php index 746b0970285..35f1baebae4 100644 --- a/htdocs/lib/price.lib.php +++ b/htdocs/lib/price.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2006-2008 Laurent Destailleur + * Copyright (C) 2010 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 @@ -30,12 +31,14 @@ * \param pu Unit price (HT or TTC selon price_base_type) * \param remise_percent_ligne Discount for line * \param txtva Vat rate + * \param txlocaltax1 Localtax1 rate + * \param txlocaltax2 Localtax2 rate * \param remise_percent_global 0 * \param price_base_type HT=on calcule sur le HT, TTC=on calcule sur le TTC * \param info_bits Miscellanous informations on line * \return result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount) */ -function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $remise_percent_global=0, $price_base_type='HT', $info_bits=0) +function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $txlocaltax1, $txlocaltax2, $remise_percent_global=0, $price_base_type='HT', $info_bits=0) { global $conf;