diff --git a/client/src/i18n/en/stock.json b/client/src/i18n/en/stock.json index b449d02a52..1dd7dc57d6 100644 --- a/client/src/i18n/en/stock.json +++ b/client/src/i18n/en/stock.json @@ -125,7 +125,7 @@ "ALGO_3" : "Algorithm 3", "ALGO_3_COMMENT" : "The average consumption is obtained by dividing the quantity consumed during the period by the number of days in the period, and by multiplying the result obtained by 30.5.", "ALGO_4" : "Algorithm 4 (MSH)", - "ALGO_4_COMMENT" : "The average consumption is obtained by dividing the quantity consumed during the period by the difference of the number of months in the period minus the total number of days of stock out in the period. The MSH algorithm is recommended by the Management Sciences for Health organization (https://www.msh.org).", + "ALGO_4_COMMENT" : "The average consumption is obtained by dividing the quantity consumed during the period by number of months of stock (found by subtracting the number of days of stock outs divided by 30.5 from the number of months in the period). The MSH algorithm is recommended by the Management Sciences for Health organization (https://www.msh.org).", "FIRST_INVENTORY_MOVEMENT_DATE" : "First Recorded Movement", "LAST_INVENTORY_MOVEMENT_DATE" : "Last Recorded Movement", "DAYS_BEFORE_CONSUMPTION" : "Days before First Consumption", diff --git a/client/src/i18n/fr/stock.json b/client/src/i18n/fr/stock.json index 2d356d6850..127bb1f499 100644 --- a/client/src/i18n/fr/stock.json +++ b/client/src/i18n/fr/stock.json @@ -131,11 +131,11 @@ "LAST_INVENTORY_MOVEMENT_DATE" : "Dernier mouvement enregistré ", "DAYS_BEFORE_CONSUMPTION" : "Jours avant la première consommation ", "NUMBER_OF_MONTHS" : "Nombre de mois", - "SUM_CONSUMPTION_DAY" : "Consommation de stock ", + "SUM_CONSUMPTION_DAY" : "Jours de consommation de stock ", "SUM_CONSUMED_QUANTITY" :"Quantité consommée", "SUM_DAYS" : "Jours au total", "SUM_STOCK_DAY" : "Jours avec stock disponible en dépôt", - "SUM_STOCK_OUT_DAYS" : "Rupture de stock", + "SUM_STOCK_OUT_DAYS" : "Jours de rupture de stock", "NEXT_STOCK_OUT" : "Prochaine rupture de stock", "TITLE" : "Consommation Mensuelle Moyenne", "DAYS" : "Jours", diff --git a/client/src/modules/stock/inventories/modals/amc.modal.js b/client/src/modules/stock/inventories/modals/amc.modal.js index 5593d27a98..93c7802313 100644 --- a/client/src/modules/stock/inventories/modals/amc.modal.js +++ b/client/src/modules/stock/inventories/modals/amc.modal.js @@ -26,13 +26,10 @@ function StockAMCModalController(Stock, Notify, Instance, data, moment, Constant vm.data.avg_consumption = vm.data[vm.settings.average_consumption_algo]; // calculate date when the stock will run out at current consumption rate + // NOTE(@jniles): momentjs does not accept decimals as of 2.12.0. We need to use days, not + // months const daysOfStockLeft = (vm.data.quantity_in_stock / vm.data.avg_consumption) * 30.5; - - // NOTE: momentjs does not accept decimals as of 2.12.0 - const stockOutDate = moment().add(daysOfStockLeft, 'days').toDate(); - - // provide this information to the view. - vm.data.stock_out_date = stockOutDate; + vm.data.stock_out_date = moment().add(daysOfStockLeft, 'days').toDate(); // nicer aliases to use in the HTML vm.isAlgo1 = vm.settings.average_consumption_algo === 'algo1';