From 0c8b6c55c17dac4fec93d69cd8d06ac77434daaa Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Wed, 11 Nov 2020 22:38:01 +0100 Subject: [PATCH] Added total calories as a column to stock overview (references #1058) --- migrations/0105.sql | 8 ++++++-- public/viewjs/stockoverview.js | 3 ++- views/stockoverview.blade.php | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/migrations/0105.sql b/migrations/0105.sql index 77746b75..803d7628 100644 --- a/migrations/0105.sql +++ b/migrations/0105.sql @@ -20,7 +20,9 @@ SELECT sc.is_aggregated_amount, sc.amount_opened_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 ( SELECT * FROM stock_current @@ -55,7 +57,9 @@ SELECT sc.is_aggregated_amount, sc.amount_opened_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 ( SELECT * FROM stock_current diff --git a/public/viewjs/stockoverview.js b/public/viewjs/stockoverview.js index 0d127611..e53b8309 100755 --- a/public/viewjs/stockoverview.js +++ b/public/viewjs/stockoverview.js @@ -10,7 +10,8 @@ { 'visible': false, 'targets': 8 }, { 'visible': false, 'targets': 2 }, { 'visible': false, 'targets': 4 }, - { 'visible': false, 'targets': 9 } + { 'visible': false, 'targets': 9 }, + { 'visible': false, 'targets': 10 } ], }); diff --git a/views/stockoverview.blade.php b/views/stockoverview.blade.php index b9bfffbc..e2d00110 100755 --- a/views/stockoverview.blade.php +++ b/views/stockoverview.blade.php @@ -161,6 +161,7 @@ Hidden status Hidden product group {{ $__t('Calories') }} + {{ $__t('Calories') }} ({{ $__t('Per stock quantity unit') }}) @include('components.userfields_thead', array( 'userfields' => $userfields @@ -367,6 +368,9 @@ xx{{ $currentStockEntry->product_group_name }}xx + + {{ $currentStockEntry->product_calories }} + {{ $currentStockEntry->calories }}