mirror of
https://github.com/grocy/grocy.git
synced 2025-08-16 18:54:35 +00:00
Load also last purchased date from stock_log instead of stock
This commit is contained in:
@@ -24,7 +24,7 @@ class GrocyLogicStock
|
||||
|
||||
$product = $db->products($productId);
|
||||
$productStockAmount = $db->stock()->where('product_id', $productId)->sum('amount');
|
||||
$productLastPurchased = $db->stock()->where('product_id', $productId)->max('purchased_date');
|
||||
$productLastPurchased = $db->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_PURCHASE)->max('purchased_date');
|
||||
$productLastUsed = $db->stock_log()->where('product_id', $productId)->where('transaction_type', self::TRANSACTION_TYPE_CONSUME)->max('used_date');
|
||||
$quPurchase = $db->quantity_units($product->qu_id_purchase);
|
||||
$quStock = $db->quantity_units($product->qu_id_stock);
|
||||
|
Reference in New Issue
Block a user