Skip to content

Commit

Permalink
fix the CMJ to CMM
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed May 12, 2020
1 parent 9855908 commit 6654d72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/controllers/stock/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,14 @@ async function getStockConsumptionAverage(periodId, periodDate, monthAverageCons
GROUP BY i.uuid, d.uuid;
`;

// the value (w.quantity/w.days) is the CMM
// the value ((w.quantity/w.days) * 30.5) is the CMM
// is mentionned here as quantity to fit into the expected values
// for returned values
const queryConsumptionByDays = `
SELECT
w.consumption AS counted_consumption,
w.quantity AS consumed_quantity,
ROUND(w.quantity/w.days) AS quantity,
ROUND((w.quantity / w.days) * 30.5) AS quantity,
w.depot_text, w.code, w.text, w.days,
BUID(w.depot_uuid) depot_uuid, BUID(w.inventory_uuid) uuid
FROM
Expand Down
3 changes: 2 additions & 1 deletion server/controllers/stock/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,9 @@ function listLotsDepot(req, res, next) {
function listInventoryDepot(req, res, next) {
const params = req.query;
const monthAverageConsumption = req.session.enterprise.settings.month_average_consumption;
const enableDailyConsumption = req.session.enterprise.settings.enable_daily_consumption;

core.getInventoryQuantityAndConsumption(params, monthAverageConsumption)
core.getInventoryQuantityAndConsumption(params, monthAverageConsumption, enableDailyConsumption)
.then((rows) => res.status(200).json(rows))
.catch(next)
.done();
Expand Down

0 comments on commit 6654d72

Please sign in to comment.