mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Load also last purchased date from stock_log instead of stock
This commit is contained in:
parent
b4b29878db
commit
b5fe0a642b
@ -24,7 +24,7 @@ class GrocyLogicStock
|
|||||||
|
|
||||||
$product = $db->products($productId);
|
$product = $db->products($productId);
|
||||||
$productStockAmount = $db->stock()->where('product_id', $productId)->sum('amount');
|
$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');
|
$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);
|
$quPurchase = $db->quantity_units($product->qu_id_purchase);
|
||||||
$quStock = $db->quantity_units($product->qu_id_stock);
|
$quStock = $db->quantity_units($product->qu_id_stock);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user