Commit f39147fa by Damien Moulard Committed by Alexis Aoun

display fixes

parent bd194cd1
......@@ -91,11 +91,11 @@
#supplier_input {
width: 350px;
border-radius: 8px;
border-radius: 3px;
}
#date_planned_input, #coverage_days_input {
border-radius: 8px;
border-radius: 3px;
}
/* -- Table */
......@@ -106,7 +106,7 @@
#products_table_filter input{
height: 35px;
width: 300px;
border-radius: 10px;
border-radius: 3px;
}
#products_table .help {cursor: help;}
#table_header_select_all{
......
......@@ -166,28 +166,26 @@ function compute_products_coverage_qties() {
key,
product
] of Object.entries(products)) {
let purchase_qty_for_coverage = null;
// Durée couverture produit = (stock + qté entrante + qté commandée ) / conso quotidienne
const stock = product.qty_available;
const incoming_qty = product.incoming_qty;
const daily_conso = product.daily_conso;
purchase_qty_for_coverage = order_doc.coverage_days * daily_conso - stock - incoming_qty;
purchase_qty_for_coverage = (purchase_qty_for_coverage < 0) ? 0 : purchase_qty_for_coverage;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage = purchase_qty_for_coverage / product.suppliersinfo[0].package_qty;
// Round according to uom
if (product.uom_id[0] == 1 || product.uom_id[0] == 20) {
purchase_package_qty_for_coverage = parseFloat(purchase_package_qty_for_coverage).toFixed(0);
} else {
purchase_package_qty_for_coverage = parseFloat(purchase_package_qty_for_coverage).toFixed(2);
if ('suppliersinfo' in product && product.suppliersinfo.length > 0) {
let purchase_qty_for_coverage = null;
// Durée couverture produit = (stock + qté entrante + qté commandée ) / conso quotidienne
const stock = product.qty_available;
const incoming_qty = product.incoming_qty;
const daily_conso = product.daily_conso;
purchase_qty_for_coverage = order_doc.coverage_days * daily_conso - stock - incoming_qty;
purchase_qty_for_coverage = (purchase_qty_for_coverage < 0) ? 0 : purchase_qty_for_coverage;
// Reduce to nb of packages to purchase
purchase_package_qty_for_coverage = purchase_qty_for_coverage / product.suppliersinfo[0].package_qty;
// Round up to unit for all products
purchase_package_qty_for_coverage = Math.ceil(purchase_package_qty_for_coverage);
// Set qty to purchase for first supplier only
products[key].suppliersinfo[0].qty = purchase_package_qty_for_coverage;
}
// Set qty to purchase for first supplier only
products[key].suppliersinfo[0].qty = purchase_package_qty_for_coverage;
}
}
......@@ -199,6 +197,14 @@ function check_products_data() {
const product_ids = products.map(p => p.id);
if (product_ids.length > 0) {
$.notify(
"Vérfication des informations produits...",
{
globalPosition:"top left",
className: "warning"
}
);
clicked_order_pill.find('.pill_order_name').empty().append(`<i class="fas fa-spinner fa-spin"></i>`);
$.ajax({
......@@ -216,6 +222,7 @@ function check_products_data() {
products[p_index] = { ...products[p_index], ...product };
}
$('.notifyjs-wrapper').trigger('notify-hide');
resolve();
},
error: function(data) {
......@@ -226,6 +233,7 @@ function check_products_data() {
report_JS_error(err, 'orders');
alert(`Erreur lors de la vérification des données des articles. Certaines données peuvent être erronées`);
$('.notifyjs-wrapper').trigger('notify-hide');
// Don't block process if this call fails
resolve();
}
......@@ -991,7 +999,7 @@ function prepare_datatable_data(product_ids = []) {
daily_conso: product.daily_conso,
purchase_ok: product.purchase_ok,
uom: product.uom_id[1],
stats: "Ecart type: " + product.sigma + ", % jours sans vente = " + (product.vpc) * 100
stats: `Ecart type: ${product.sigma} / Jours sans vente: ${(product.vpc) * 100}%`
};
const computed_data = _compute_product_data(product);
......@@ -1025,7 +1033,7 @@ function prepare_datatable_columns() {
},
{
data: "default_code",
title: "Référence Produit",
title: "Ref",
width: "8%",
render: function (data) {
return (data === false) ? "" : data;
......@@ -1114,7 +1122,7 @@ function prepare_datatable_columns() {
columns.push({
data: "days_not_covered",
title: "Besoin non couvert",
title: "Besoin non couvert (jours)",
className: "dt-body-center",
width: "4%"
});
......
......@@ -503,8 +503,8 @@ class CagetteProducts(models.Model):
sales_average_params = {
'ids': ptids,
# 'from': '2019-06-10',
# 'to': '2019-08-10',
'from': '2019-04-10',
'to': '2019-08-10',
}
sales = CagetteProducts.get_template_products_sales_average(sales_average_params)
......
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