mirror of
https://github.com/grocy/grocy.git
synced 2025-08-20 04:12:59 +00:00
Scale up values on the shopping list when shopping_list_round_up is enabled (closes #2687)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
### Shopping list
|
||||
|
||||
- When the shopping list setting (top right corner settings menu) "Round up quantity amounts to the nearest whole number" is enabled, the "Last price (Total)" of each shopping list item and the total value of the shopping list are now also scaled up accordingly
|
||||
- The print options (show header, layout type etc.) are now saved (as user settings, so global defaults can also defined in `config.php` as usual)
|
||||
|
||||
### Recipes
|
||||
|
32
migrations/0251.sql
Normal file
32
migrations/0251.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
DROP VIEW uihelper_shopping_list;
|
||||
CREATE VIEW uihelper_shopping_list
|
||||
AS
|
||||
SELECT
|
||||
sl.*,
|
||||
p.name AS product_name,
|
||||
plp.price * IFNULL(quc.factor, 1.0) AS last_price_unit,
|
||||
plp.price * sl.amount AS last_price_total,
|
||||
plp.price AS price,
|
||||
st.name AS default_shopping_location_name,
|
||||
qu.name AS qu_name,
|
||||
qu.name_plural AS qu_name_plural,
|
||||
pg.id AS product_group_id,
|
||||
pg.name AS product_group_name,
|
||||
pbcs.barcodes AS product_barcodes
|
||||
FROM shopping_list sl
|
||||
LEFT JOIN products p
|
||||
ON sl.product_id = p.id
|
||||
LEFT JOIN cache__products_last_purchased plp
|
||||
ON sl.product_id = plp.product_id
|
||||
LEFT JOIN shopping_locations st
|
||||
ON p.shopping_location_id = st.id
|
||||
LEFT JOIN quantity_units qu
|
||||
ON sl.qu_id = qu.id
|
||||
LEFT JOIN product_groups pg
|
||||
ON p.product_group_id = pg.id
|
||||
LEFT JOIN cache__quantity_unit_conversions_resolved quc
|
||||
ON p.id = quc.product_id
|
||||
AND p.qu_id_stock = quc.to_qu_id
|
||||
AND sl.qu_id = quc.from_qu_id
|
||||
LEFT JOIN product_barcodes_comma_separated pbcs
|
||||
ON sl.product_id = pbcs.product_id;
|
@@ -17,6 +17,17 @@
|
||||
<script src="{{ $U('/viewjs/purchase.js?v=', true) }}{{ $version }}"></script>
|
||||
@endpush
|
||||
|
||||
@php
|
||||
if(boolval($userSettings['shopping_list_round_up']))
|
||||
{
|
||||
foreach($listItems as $listItem)
|
||||
{
|
||||
$listItem->amount = ceil($listItem->amount);
|
||||
$listItem->last_price_total = $listItem->price * $listItem->amount;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
@section('content')
|
||||
<div class="row d-print-none hide-on-fullscreen-card">
|
||||
<div class="col">
|
||||
@@ -266,11 +277,6 @@
|
||||
{
|
||||
$listItem->amount = $listItem->amount * $productQuConversion->factor;
|
||||
}
|
||||
|
||||
if(boolval($userSettings['shopping_list_round_up']))
|
||||
{
|
||||
$listItem->amount = ceil($listItem->amount);
|
||||
}
|
||||
@endphp
|
||||
@endif
|
||||
<td>
|
||||
|
Reference in New Issue
Block a user