Add calories as a column to stock overview (references #1058)

This commit is contained in:
Bernd Bestel 2020-11-11 22:06:01 +01:00
parent e7491fd8d1
commit 7c8a17ce78
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
4 changed files with 13 additions and 5 deletions

View File

@ -101,6 +101,7 @@
- Tables are horizontally scrollable (instead of collapsing columns which don't fit) - Tables are horizontally scrollable (instead of collapsing columns which don't fit)
- Table columns can now be shown/hidden (new little eye icon on the top left corner on each table) - Table columns can now be shown/hidden (new little eye icon on the top left corner on each table)
- There are also new columns on some pages, hidden by default - There are also new columns on some pages, hidden by default
- Stock overview: Value, product group, calories
- Dialogs are now used everywhere where appropriate instead of jumping between pages (for exampel when adding/editing shopping list items) - Dialogs are now used everywhere where appropriate instead of jumping between pages (for exampel when adding/editing shopping list items)
- Added a "Clear filter"-button on all pages (with filters) to quickly reset applied filters - Added a "Clear filter"-button on all pages (with filters) to quickly reset applied filters
- The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau) - The data path (previously fixed to the `data` folder) is now configurable, making it possible to run multiple grocy instances from the same directory (with different `config.php` files / different database, etc.) (thanks @fgrsnau)

View File

@ -19,7 +19,8 @@ SELECT
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural, (SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural,
sc.is_aggregated_amount, sc.is_aggregated_amount,
sc.amount_opened_aggregated, sc.amount_opened_aggregated,
sc.amount_aggregated sc.amount_aggregated,
p.calories
FROM ( FROM (
SELECT * SELECT *
FROM stock_current FROM stock_current
@ -43,7 +44,7 @@ SELECT
sc.value as value, sc.value as value,
sc.product_id AS product_id, sc.product_id AS product_id,
sc.best_before_date AS best_before_date, sc.best_before_date AS best_before_date,
EXISTS(SELECT id FROM stock_missing_products_including_opened WHERE id = sc.product_id) AS product_missing, EXISTS(SELECT id FROM stock_missing_products WHERE id = sc.product_id) AS product_missing,
(SELECT name FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name, (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, (SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_stock) AS qu_unit_name_plural,
p.name AS product_name, p.name AS product_name,
@ -53,13 +54,14 @@ SELECT
(SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural, (SELECT name_plural FROM quantity_units WHERE quantity_units.id = p.qu_id_purchase) AS qu_purchase_unit_name_plural,
sc.is_aggregated_amount, sc.is_aggregated_amount,
sc.amount_opened_aggregated, sc.amount_opened_aggregated,
sc.amount_aggregated sc.amount_aggregated,
p.calories
FROM ( FROM (
SELECT * SELECT *
FROM stock_current FROM stock_current
WHERE best_before_date IS NOT NULL WHERE best_before_date IS NOT NULL
UNION UNION
SELECT id, 0, 0, 0, 0, null, 0, 0, 0 SELECT id, 0, 0, 0, null, 0, 0, 0
FROM stock_missing_products FROM stock_missing_products
WHERE id NOT IN (SELECT product_id FROM stock_current) WHERE id NOT IN (SELECT product_id FROM stock_current)
) sc ) sc

View File

@ -9,7 +9,8 @@
{ 'visible': false, 'targets': 7 }, { 'visible': false, 'targets': 7 },
{ 'visible': false, 'targets': 8 }, { 'visible': false, 'targets': 8 },
{ 'visible': false, 'targets': 2 }, { 'visible': false, 'targets': 2 },
{ 'visible': false, 'targets': 4 } { 'visible': false, 'targets': 4 },
{ 'visible': false, 'targets': 9 }
], ],
}); });

View File

@ -160,6 +160,7 @@
<th class="d-none">Hidden location</th> <th class="d-none">Hidden location</th>
<th class="d-none">Hidden status</th> <th class="d-none">Hidden status</th>
<th class="d-none">Hidden product group</th> <th class="d-none">Hidden product group</th>
<th>{{ $__t('Calories') }}</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
@ -366,6 +367,9 @@
<td class="d-none"> <td class="d-none">
xx{{ $currentStockEntry->product_group_name }}xx xx{{ $currentStockEntry->product_group_name }}xx
</td> </td>
<td>
<span class="locale-number locale-number-generic">{{ $currentStockEntry->calories }}</span>
</td>
@include('components.userfields_tbody', array( @include('components.userfields_tbody', array(
'userfields' => $userfields, 'userfields' => $userfields,