mirror of
https://github.com/grocy/grocy.git
synced 2025-08-21 04:43:32 +00:00
Change FIFO to "First expiring first, then first in first out"
This commit is contained in:
@@ -80,7 +80,7 @@ class GrocyLogicStock
|
|||||||
$db = Grocy::GetDbConnection();
|
$db = Grocy::GetDbConnection();
|
||||||
|
|
||||||
$productStockAmount = $db->stock()->where('product_id', $productId)->sum('amount');
|
$productStockAmount = $db->stock()->where('product_id', $productId)->sum('amount');
|
||||||
$potentialStockEntries = $db->stock()->where('product_id', $productId)->orderBy('purchased_date', 'ASC')->fetchAll(); //FIFO
|
$potentialStockEntries = $db->stock()->where('product_id', $productId)->orderBy('best_before_date', 'ASC')->orderBy('purchased_date', 'ASC')->fetchAll(); //First expiring first, then first in first out
|
||||||
|
|
||||||
if ($amount > $productStockAmount)
|
if ($amount > $productStockAmount)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user