mirror of
https://github.com/grocy/grocy.git
synced 2026-04-09 14:06:16 +02:00
Change FIFO to "First expiring first, then first in first out"
This commit is contained in:
parent
9e68d38df8
commit
b4b29878db
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user