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

This commit is contained in:
Bernd Bestel
2020-11-11 22:38:01 +01:00
parent 0a600d3277
commit 0c8b6c55c1
3 changed files with 12 additions and 3 deletions

View File

@@ -20,7 +20,9 @@ SELECT
sc.is_aggregated_amount, sc.is_aggregated_amount,
sc.amount_opened_aggregated, sc.amount_opened_aggregated,
sc.amount_aggregated, sc.amount_aggregated,
p.calories p.calories AS product_calories,
sc.amount * p.calories AS calories,
sc.amount_aggregated * p.calories AS calories_aggregated
FROM ( FROM (
SELECT * SELECT *
FROM stock_current FROM stock_current
@@ -55,7 +57,9 @@ SELECT
sc.is_aggregated_amount, sc.is_aggregated_amount,
sc.amount_opened_aggregated, sc.amount_opened_aggregated,
sc.amount_aggregated, sc.amount_aggregated,
p.calories p.calories AS product_calories,
sc.amount * p.calories AS calories,
sc.amount_aggregated * p.calories AS calories_aggregated
FROM ( FROM (
SELECT * SELECT *
FROM stock_current FROM stock_current

View File

@@ -10,7 +10,8 @@
{ '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 } { 'visible': false, 'targets': 9 },
{ 'visible': false, 'targets': 10 }
], ],
}); });

View File

@@ -161,6 +161,7 @@
<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> <th>{{ $__t('Calories') }}</th>
<th>{{ $__t('Calories') }} ({{ $__t('Per stock quantity unit') }})</th>
@include('components.userfields_thead', array( @include('components.userfields_thead', array(
'userfields' => $userfields 'userfields' => $userfields
@@ -367,6 +368,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->product_calories }}</span>
</td>
<td> <td>
<span class="locale-number locale-number-generic">{{ $currentStockEntry->calories }}</span> <span class="locale-number locale-number-generic">{{ $currentStockEntry->calories }}</span>
</td> </td>