Finalisation de l'ajout de la gestion du HT et TTC avec l'option multiprix

This commit is contained in:
Regis Houssin 2006-12-19 18:24:33 +00:00
parent 6c286ab6f8
commit 1b5ceef29c

View File

@ -607,6 +607,17 @@ class Product
} }
else else
{ {
if ($this->price_base_type == 'TTC')
{
$price_ttc = $this->price;
$price = $this->price / (1 + ($this->tva_tx / 100));
}
else
{
$price = $this->price;
$price_ttc = $this->price * (1 + ($this->tva_tx / 100));
}
// On supprimme ligne existante au cas ou // On supprimme ligne existante au cas ou
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
$sql .= "WHERE date_price = now()"; $sql .= "WHERE date_price = now()";
@ -619,8 +630,8 @@ class Product
$this->db->query($sql); $this->db->query($sql);
// On ajoute nouveau tarif // On ajoute nouveau tarif
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) "; $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,price_ttc,price_base_type,envente,tva_tx) ";
$sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($this->price).",".$this->status.",".$this->tva_tx; $sql .= " VALUES(now(),".$this->id.",".$user->id.",".price2num($price).",'".$price_ttc."','".$this->price_base_type."',".$this->status.",".$this->tva_tx;
$sql .= ")"; $sql .= ")";
if ($this->db->query($sql) ) if ($this->db->query($sql) )