Gestion du prix de reliure
This commit is contained in:
parent
b26f15dff6
commit
07d6aa6411
@ -98,6 +98,7 @@ class ProductLivre extends Product
|
|||||||
$this->pages = abs(trim($datas["pages"]));
|
$this->pages = abs(trim($datas["pages"]));
|
||||||
$this->px_feuillet = str_replace(',','.',abs(trim($datas["px_feuillet"])));
|
$this->px_feuillet = str_replace(',','.',abs(trim($datas["px_feuillet"])));
|
||||||
$this->px_couverture = str_replace(',','.',abs(trim($datas["px_couverture"])));
|
$this->px_couverture = str_replace(',','.',abs(trim($datas["px_couverture"])));
|
||||||
|
$this->px_reliure = str_replace(',','.',abs(trim($datas["px_reliure"])));
|
||||||
$this->stock_loc = trim($datas["stock_loc"]);
|
$this->stock_loc = trim($datas["stock_loc"]);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@ -207,7 +208,7 @@ class ProductLivre extends Product
|
|||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid,isbn,ean,pages,fk_couverture,format,fk_contrat";
|
$sql = "SELECT rowid,isbn,ean,pages,fk_couverture,format,fk_contrat";
|
||||||
$sql.= ",px_feuillet,px_revient,px_couverture";
|
$sql.= ",px_feuillet,px_revient,px_couverture,px_reliure";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre";
|
$sql.= " FROM ".MAIN_DB_PREFIX."product_cnv_livre";
|
||||||
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
if ($id) $sql.= " WHERE rowid = '".$id."'";
|
||||||
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
|
if ($ref) $sql.= " WHERE ref = '".addslashes($ref)."'";
|
||||||
@ -223,6 +224,7 @@ class ProductLivre extends Product
|
|||||||
$this->pages = $result["pages"];
|
$this->pages = $result["pages"];
|
||||||
$this->format = $result["format"];
|
$this->format = $result["format"];
|
||||||
$this->px_feuillet = $result["px_feuillet"];
|
$this->px_feuillet = $result["px_feuillet"];
|
||||||
|
$this->px_reliure = $result["px_reliure"];
|
||||||
$this->px_revient = $result["px_revient"];
|
$this->px_revient = $result["px_revient"];
|
||||||
$this->px_couverture = $result["px_couverture"];
|
$this->px_couverture = $result["px_couverture"];
|
||||||
$this->couverture_id = $result["fk_couverture"];
|
$this->couverture_id = $result["fk_couverture"];
|
||||||
@ -260,13 +262,14 @@ class ProductLivre extends Product
|
|||||||
|
|
||||||
$this->pages = abs(trim($datas["pages"]));
|
$this->pages = abs(trim($datas["pages"]));
|
||||||
$this->px_feuillet = str_replace(',','.',abs(trim($datas["px_feuillet"])));
|
$this->px_feuillet = str_replace(',','.',abs(trim($datas["px_feuillet"])));
|
||||||
|
$this->px_reliure = str_replace(',','.',abs(trim($datas["px_reliure"])));
|
||||||
$this->px_couverture = str_replace(',','.',abs(trim($datas["px_couverture"])));
|
$this->px_couverture = str_replace(',','.',abs(trim($datas["px_couverture"])));
|
||||||
|
|
||||||
$price_ht = $this->price / (1 + ($this->tva_tx / 100));
|
$price_ht = $this->price / (1 + ($this->tva_tx / 100));
|
||||||
|
|
||||||
$contrat_taux = str_replace(',','.',abs(trim($datas["contrat_taux"])));
|
$contrat_taux = str_replace(',','.',abs(trim($datas["contrat_taux"])));
|
||||||
|
|
||||||
$this->px_revient = $this->_calculate_prix_revient($this->pages, $this->px_couverture, $this->px_feuillet, $price_ht, $contrat_taux);
|
$this->px_revient = $this->_calculate_prix_revient($this->pages, $this->px_couverture, $this->px_feuillet, $price_ht, $this->px_reliure, $contrat_taux);
|
||||||
|
|
||||||
$this->stock_loc = trim($datas["stock_loc"]);
|
$this->stock_loc = trim($datas["stock_loc"]);
|
||||||
$format = trim($datas["format"]);
|
$format = trim($datas["format"]);
|
||||||
@ -277,6 +280,7 @@ class ProductLivre extends Product
|
|||||||
$sql.= " , pages = '".$this->pages."'";
|
$sql.= " , pages = '".$this->pages."'";
|
||||||
$sql.= " , px_feuillet = '".$this->px_feuillet."'";
|
$sql.= " , px_feuillet = '".$this->px_feuillet."'";
|
||||||
$sql.= " , px_revient = '".ereg_replace(",",".",$this->px_revient)."'";
|
$sql.= " , px_revient = '".ereg_replace(",",".",$this->px_revient)."'";
|
||||||
|
$sql.= " , px_reliure = '".ereg_replace(",",".",$this->px_reliure)."'";
|
||||||
$sql.= " , px_couverture = '".ereg_replace(",",".",$this->px_couverture)."'";
|
$sql.= " , px_couverture = '".ereg_replace(",",".",$this->px_couverture)."'";
|
||||||
$sql.= " , fk_couverture = '".$this->couverture->id."'";
|
$sql.= " , fk_couverture = '".$this->couverture->id."'";
|
||||||
$sql.= " , fk_contrat = '".$this->contrat->id."'";
|
$sql.= " , fk_contrat = '".$this->contrat->id."'";
|
||||||
@ -307,11 +311,11 @@ class ProductLivre extends Product
|
|||||||
\param price_ht Prix public HT
|
\param price_ht Prix public HT
|
||||||
\param taux Taux du contrat
|
\param taux Taux du contrat
|
||||||
*/
|
*/
|
||||||
function _calculate_prix_revient($pages, $couv, $feuil, $price_ht, $taux)
|
function _calculate_prix_revient($pages, $couv, $feuil, $price_ht, $reliure, $taux)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("ProductLivre::UpdateCanvas $pages, $couv, $feuil, $price_ht, $taux", LOG_DEBUG);
|
dolibarr_syslog("ProductLivre::UpdateCanvas $pages, $couv, $feuil, $price_ht, $taux", LOG_DEBUG);
|
||||||
|
|
||||||
$cost = ($pages / 2 * $feuil) + $couv + ($price_ht * $taux / 100);
|
$cost = ($pages / 2 * $feuil) + $couv + $reliure + ($price_ht * $taux / 100);
|
||||||
|
|
||||||
return $cost;
|
return $cost;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user