diff --git a/server/controllers/stock/reports/monthly_consumption.report.handlebars b/server/controllers/stock/reports/monthly_consumption.report.handlebars index b96ece76ac..f50a3bfc89 100644 --- a/server/controllers/stock/reports/monthly_consumption.report.handlebars +++ b/server/controllers/stock/reports/monthly_consumption.report.handlebars @@ -1,27 +1,21 @@ {{> head title="REPORT.MONTHLY_CONSUMPTION.TITLE" }} - - -
+ {{> header}}
-

- {{translate 'REPORT.MONTHLY_CONSUMPTION.TITLE'}} -

- -

- {{ fiscalYear }} : {{ translate params.periodFromKey }} - {{ translate params.periodToKey }} -

+

{{translate 'REPORT.MONTHLY_CONSUMPTION.TITLE'}}

- {{ depot }} + {{ fiscalYear }} : {{ translate params.periodFromKey }} - {{ translate params.periodToKey }} +
+ {{depot}}

- +
@@ -34,30 +28,24 @@ - {{#if dataDisplay}} - {{#each inventories}} - - - - {{#each monthlyConsumption}} - - {{/each}} - - - {{/each}} + {{#each inventories}} + + + + {{#each monthlyConsumption}} + + {{/each}} + + {{else}} - + - {{/if}} + {{/each}}
{{translate 'FORM.LABELS.NR'}}
{{ add @index 1}} {{ inventory_text }} - {{#if quantity}} - {{ quantity }} - {{/if}} - {{ total }}
{{ add @index 1}}{{ inventory_text }} + {{#if quantity}}{{ quantity }}{{/if}} + {{ total }}
{{translate 'STOCK.NO_DATA'}} {{translate 'STOCK.NO_DATA'}}
- -
diff --git a/server/controllers/stock/reports/stock/monthly_consumption.js b/server/controllers/stock/reports/stock/monthly_consumption.js index 8ae85043e5..f643215d55 100644 --- a/server/controllers/stock/reports/stock/monthly_consumption.js +++ b/server/controllers/stock/reports/stock/monthly_consumption.js @@ -11,8 +11,7 @@ exports.report = report; const DEFAULT_PARAMS = { csvKey : 'monthlyConsumption', filename : 'TREE.MONTHLY_CONSUMPTION', - orientation : 'landscape', - footerRight : '[page] / [toPage]', + orientation : 'portrait', }; /** @@ -47,8 +46,8 @@ async function report(req, res, next) { JOIN inventory AS iv ON iv.uuid = sc.inventory_uuid JOIN period AS p ON p.id = sc.period_id JOIN fiscal_year AS f ON f.id = p.fiscal_year_id - JOIN depot AS d ON d.uuid = sc.depot_uuid - WHERE sc.period_id >= ? AND sc.period_id <= ? AND d.uuid = ? ORDER BY iv.text ASC; + JOIN depot AS d ON d.uuid = sc.depot_uuid + WHERE sc.period_id >= ? AND sc.period_id <= ? AND d.uuid = ? ORDER BY iv.text ASC; `; const sqlAggregat = ` @@ -80,10 +79,9 @@ async function report(req, res, next) { data.depot = params.depot_text; data.inventories = inventories; - data.dataDisplay = inventories.length ? 1 : 0; data.spanColumn = data.periods.length + 3; - if (data.dataDisplay) { + if (inventories.length > 0) { data.inventories.forEach(item => { item.monthlyConsumption = []; item.total = 0;