Skip to content
Snippets Groups Projects
Commit 9ad2a9ac authored by Laurent Destailleur's avatar Laurent Destailleur Committed by GitHub
Browse files

Merge pull request #7248 from fappels/4.0_fix_best_buy_price_calculation

FIX Best buy price calculation
parents 2a59dbbc ca3cdfab
No related branches found
No related tags found
No related merge requests found
......@@ -581,7 +581,8 @@ class ProductFournisseur extends Product
foreach($record_array as $record)
{
$fourn_price = $record["price"];
$fourn_unitprice = $record["unitprice"];
// discount calculated buy price
$fourn_unitprice = $record["unitprice"] * (1 - $record["remise_percent"] / 100) + $record["unitcharges"] - $record["remise"];
if (!empty($conf->dynamicprices->enabled) && !empty($record["fk_supplier_price_expression"])) {
$prod_supplier = new ProductFournisseur($this->db);
$prod_supplier->product_fourn_price_id = $record["product_fourn_price_id"];
......@@ -613,7 +614,7 @@ class ProductFournisseur extends Product
$this->fourn_qty = $record["quantity"];
$this->fourn_remise_percent = $record["remise_percent"];
$this->fourn_remise = $record["remise"];
$this->fourn_unitprice = $fourn_unitprice;
$this->fourn_unitprice = $record["unitprice"];
$this->fourn_charges = $record["charges"]; // deprecated
$this->fourn_unitcharges = $record["unitcharges"]; // deprecated
$this->fourn_tva_tx = $record["tva_tx"];
......@@ -622,7 +623,7 @@ class ProductFournisseur extends Product
$this->delivery_time_days = $record["delivery_time_days"];
$this->fk_supplier_price_expression = $record["fk_supplier_price_expression"];
$this->id = $prodid;
$min = $this->fourn_unitprice;
$min = $fourn_unitprice;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment