Skip to content

Commit

Permalink
Fix issues in Stock Inventories Report
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcameron committed May 27, 2022
1 parent 2740a86 commit 5fc1622
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
</div>
{{/if}}
{{/header}}
QQQ1

<header>
<!-- headings -->
Expand Down
16 changes: 15 additions & 1 deletion server/controllers/stock/reports/stock/inventories_report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
_, ReportManager, formatFilters, Stock, STOCK_INVENTORIES_REPORT_TEMPLATE, stockStatusLabelKeys,
_, db, ReportManager, formatFilters, Stock, STOCK_INVENTORIES_REPORT_TEMPLATE, stockStatusLabelKeys,
} = require('../common');

const i18n = require('../../../../lib/helpers/translate');
Expand Down Expand Up @@ -31,6 +31,20 @@ async function stockInventoriesReport(req, res, next) {

const filters = formatFilters(options);

// Update the name for the depot filter if specified
const depotFilter = filters.find(filt => filt.field === 'depot_uuid');
if (depotFilter) {
const depot = await db.one('SELECT text FROM depot WHERE uuid = ?', db.bid(depotFilter.value));
depotFilter.value = depot.text;
}

// Update the name for the inventory filter if specified
const inventoryFilter = filters.find(filt => filt.field === 'inventory_uuid');
if (inventoryFilter) {
const inventory = await db.one('SELECT text FROM inventory WHERE uuid = ?', db.bid(inventoryFilter.value));
inventoryFilter.value = inventory.text;
}

if (req.session.stock_settings.enable_strict_depot_permission) {
options.check_user_id = req.session.user.id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
{{#each depots as | items name |}}

<!-- this is the depot group header -->
<tr style="border:none">
<th style="border:none; border-bottom: solid black 2px;" class="text-uppercase" colspan="7">
<tr style="border:none;">
<th style="border:none; border-bottom: solid black 2px; padding-top: 1.5em;" class="text-uppercase" colspan="7">
{{ name }}
</th>

<th colspan="4" style="border:none; border-bottom: solid black 2px;" class="text-right">
<th colspan="4" style="border:none; border-bottom: solid black 2px; padding-top: 1.5em;" class="text-right">
({{ items.length }} {{ translate "TABLE.AGGREGATES.RECORDS" }})
</th>
</tr>
Expand All @@ -60,8 +60,6 @@
<td class="text-right">{{S_MAX}}</td>
<td class="text-right">{{S_Q}}</td>
</tr>
{{else }}
{{> emptyTable columns=11}}
{{/each}}

<!-- blank row -->
Expand All @@ -72,6 +70,8 @@
</tr>
{{/unless}}

{{else}}
{{> emptyTable columns=11}}
{{/each}}
</tbody>
</table>
Expand Down

0 comments on commit 5fc1622

Please sign in to comment.