Added new columns on the stock overview page (closes #1351)

This commit is contained in:
Bernd Bestel 2021-07-08 20:42:07 +02:00
parent 8b977644f7
commit 8c5c12cb47
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 30 additions and 4 deletions

View File

@ -30,6 +30,7 @@
- On the stock overview page it's now also possible to search/filter by product barcodes (via the general search field)
- The product picker on the consume page now only shows products which are currently in stock
- Added a filter option to only show in-stock products on the products list page (master data)
- Added new columns on the stock overview page (hidden by default): Product description, product default location, parent product
- Fixed that editing stock entries was not possible
- Fixed that consuming with Scan Mode was not possible
- Fixed that the current stock total value (header of the stock overview page) didn't include decimal amounts (thanks @Ape)

View File

@ -14,7 +14,7 @@ SELECT
(SELECT name FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name,
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name_plural,
p.name AS product_name,
(SELECT name FROM product_groups WHERE product_groups.id = product_group_id) AS product_group_name,
(SELECT name FROM product_groups WHERE product_groups.id = p.product_group_id) AS product_group_name,
EXISTS(SELECT * FROM shopping_list WHERE shopping_list.product_id = sc.product_id) AS on_shopping_list,
(SELECT name FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name,
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural,
@ -30,7 +30,10 @@ SELECT
plp.price AS last_price,
p.min_stock_amount,
pbcs.barcodes AS product_barcodes,
p.description as product_description
p.description as product_description,
l.name AS product_default_location_name,
p_parent.id AS parent_product_id,
p_parent.name AS parent_product_name
FROM (
SELECT *
FROM stock_current
@ -48,6 +51,10 @@ LEFT JOIN products p
ON sc.product_id = p.id
LEFT JOIN product_barcodes_comma_separated pbcs
ON sc.product_id = pbcs.product_id
LEFT JOIN products p_parent
ON p.parent_product_id = p_parent.id
LEFT JOIN locations l
ON p.location_id = l.id
WHERE p.hide_on_stock_overview = 0;
DROP VIEW uihelper_stock_current_overview;
@ -66,7 +73,7 @@ SELECT
(SELECT name FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name,
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name_plural,
p.name AS product_name,
(SELECT name FROM product_groups WHERE product_groups.id = product_group_id) AS product_group_name,
(SELECT name FROM product_groups WHERE product_groups.id = p.product_group_id) AS product_group_name,
EXISTS(SELECT * FROM shopping_list WHERE shopping_list.product_id = sc.product_id) AS on_shopping_list,
(SELECT name FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name,
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural,
@ -82,7 +89,10 @@ SELECT
plp.price AS last_price,
p.min_stock_amount,
pbcs.barcodes AS product_barcodes,
p.description as product_description
p.description AS product_description,
l.name AS product_default_location_name,
p_parent.id AS parent_product_id,
p_parent.name AS parent_product_name
FROM (
SELECT *
FROM stock_current
@ -100,4 +110,8 @@ LEFT JOIN products p
ON sc.product_id = p.id
LEFT JOIN product_barcodes_comma_separated pbcs
ON sc.product_id = pbcs.product_id
LEFT JOIN products p_parent
ON p.parent_product_id = p_parent.id
LEFT JOIN locations l
ON p.location_id = l.id
WHERE p.hide_on_stock_overview = 0;

View File

@ -15,6 +15,8 @@
{ 'visible': false, 'targets': 12 },
{ 'visible': false, 'targets': 13 },
{ 'visible': false, 'targets': 14 },
{ 'visible': false, 'targets': 15 },
{ 'visible': false, 'targets': 16 },
{ "type": "num", "targets": 3 },
{ "type": "html-num-fmt", "targets": 9 },
{ "type": "html-num-fmt", "targets": 10 },

View File

@ -170,6 +170,8 @@
<th class="@if(!GROCY_FEATURE_FLAG_STOCK_PRICE_TRACKING) d-none @endif">{{ $__t('Last price') }}</th>
<th>{{ $__t('Min. stock amount') }}</th>
<th>{{ $__t('Product description') }}</th>
<th>{{ $__t('Parent product') }}</th>
<th>{{ $__t('Default location') }}</th>
@include('components.userfields_thead', array(
'userfields' => $userfields
@ -403,6 +405,13 @@
<td>
{{ $currentStockEntry->product_description }}
</td>
<td class="product-name-cell cursor-link"
data-product-id="{{ $currentStockEntry->parent_product_id }}">
{{ $currentStockEntry->parent_product_name }}
</td>
<td>
{{ $currentStockEntry->product_default_location_name }}
</td>
@include('components.userfields_tbody', array(
'userfields' => $userfields,