ability to define margin rate on quotes, orders, invoices

more to come : same on edit, user permissions
This commit is contained in:
Christophe Battarel
2013-08-12 15:34:09 +02:00
parent 5c2e626338
commit 29d329a1d2
5 changed files with 246 additions and 24 deletions

View File

@@ -6,7 +6,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
@@ -666,9 +666,16 @@ else if ($action == 'addline' && $user->rights->commande->creer)
$price_base_type = $prod->price_base_type;
}
// if price ht is forced (ie: calculated by margin rate and cost price)
if (!empty($price_ht))
{
$pu_ht = price2num($price_ht, 'MU');
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $prod->tva_tx)
elseif ($tva_tx != $prod->tva_tx)
{
if ($price_base_type != 'HT')
{
@@ -806,6 +813,8 @@ else if ($action == 'addline' && $user->rights->commande->creer)
unset($_POST['product_desc']);
unset($_POST['fournprice']);
unset($_POST['buying_price']);
unset($_POST['np_marginRate']);
unset($_POST['np_markRate']);
// old method
unset($_POST['np_desc']);