diff --git a/server/controllers/stock/reports/stock/stock_sheet.js b/server/controllers/stock/reports/stock/stock_sheet.js index ad1c797f0a..ee21ce0325 100644 --- a/server/controllers/stock/reports/stock/stock_sheet.js +++ b/server/controllers/stock/reports/stock/stock_sheet.js @@ -6,10 +6,10 @@ const { * @method stockSheetReport * * @description - * This method builds the stock inventory report as either a JSON, PDF, or HTML + * This method builds the stock sheet report as either a JSON, PDF, or HTML * file to be sent to the client. * - * GET /reports/stock/inventory + * GET /reports/stock/sheet */ async function stockSheetReport(req, res, next) { const optionReport = _.extend(req.query, { @@ -41,6 +41,11 @@ async function stockSheetReport(req, res, next) { data.rows = rows.movements; } + // mark rows if they contain negative balances + data.rows.forEach(row => { + row.hasNegativeValues = row.stock.quantity < 0; + }); + data.totals = rows.totals; data.result = rows.result; data.dateFrom = options.dateFrom; diff --git a/server/controllers/stock/reports/stock_sheet.report.handlebars b/server/controllers/stock/reports/stock_sheet.report.handlebars index ed604b188e..1a7b6eb212 100644 --- a/server/controllers/stock/reports/stock_sheet.report.handlebars +++ b/server/controllers/stock/reports/stock_sheet.report.handlebars @@ -58,7 +58,7 @@ {{#each rows}} - + {{reference}} {{timestamp date}} {{#unless ../depot.text}} @@ -77,9 +77,9 @@ {{#if exit.value}}{{currency exit.value ../metadata.enterprise.currency_id}}{{/if}} {{!-- stock --}} - {{stock.quantity}} - {{precision stock.unit_cost 4}} - {{currency stock.value ../metadata.enterprise.currency_id}} + {{stock.quantity}} + {{precision stock.unit_cost 4}} + {{currency stock.value ../metadata.enterprise.currency_id}} {{/each}}