mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 11:27:03 +00:00
Refresh stock statistics on consume on stock overview page (references #26)
This commit is contained in:
@@ -17,19 +17,13 @@ class StockController extends BaseController
|
||||
|
||||
public function Overview(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$currentStock = $this->StockService->GetCurrentStock();
|
||||
$nextXDays = 5;
|
||||
$countExpiringNextXDays = count(FindAllObjectsInArrayByPropertyValue($currentStock, 'best_before_date', date('Y-m-d', strtotime('+5 days')), '<'));
|
||||
$countAlreadyExpired = count(FindAllObjectsInArrayByPropertyValue($currentStock, 'best_before_date', date('Y-m-d', strtotime('-1 days')), '<'));
|
||||
return $this->AppContainer->view->render($response, 'stockoverview', [
|
||||
'products' => $this->Database->products()->orderBy('name'),
|
||||
'quantityunits' => $this->Database->quantity_units()->orderBy('name'),
|
||||
'locations' => $this->Database->locations()->orderBy('name'),
|
||||
'currentStock' => $currentStock,
|
||||
'currentStock' => $this->StockService->GetCurrentStock(),
|
||||
'missingProducts' => $this->StockService->GetMissingProducts(),
|
||||
'nextXDays' => $nextXDays,
|
||||
'countExpiringNextXDays' => $countExpiringNextXDays,
|
||||
'countAlreadyExpired' => $countAlreadyExpired
|
||||
'nextXDays' => 5
|
||||
]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user