Commit 310ce8a3 by François C.

Ticket 2473 : If a product stock value is 0 and sales average value is 0, set 1 package to order

parent afe5a5e8
Pipeline #1889 passed with stage
in 1 minute 29 seconds
......@@ -191,7 +191,13 @@ function add_product() {
return 0;
}
function compute_purchase_qty_for_coverage(product, coeff, stock, incoming_qty, daily_conso, days) {
let purchase_qty_for_coverage = null;
let purchase_qty_for_coverage = 0,
purchase_package_qty_for_coverage = 0;
if (stock == 0 && daily_conso == 0) {
purchase_package_qty_for_coverage = 1;
} else {
purchase_qty_for_coverage = days * daily_conso - stock - incoming_qty + product.minimal_stock;
purchase_qty_for_coverage = (purchase_qty_for_coverage < 0) ? 0 : purchase_qty_for_coverage;
......@@ -201,6 +207,7 @@ function compute_purchase_qty_for_coverage(product, coeff, stock, incoming_qty,
if (coeff != 1) {
purchase_package_qty_for_coverage *= coeff;
}
}
// return Round up to unit for all products
return Math.ceil(purchase_package_qty_for_coverage);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment