Refresh stock statistics on consume on stock overview page (references #26)

This commit is contained in:
Bernd Bestel
2018-08-04 14:25:32 +02:00
parent 6081b8ee67
commit ca3f28b615
7 changed files with 125 additions and 13 deletions

View File

@@ -20,6 +20,12 @@ class StockService extends BaseService
return $this->DatabaseService->ExecuteDbQuery($sql)->fetchAll(\PDO::FETCH_OBJ);
}
public function GetExpiringProducts(int $days = 5)
{
$currentStock = $this->GetCurrentStock();
return FindAllObjectsInArrayByPropertyValue($currentStock, 'best_before_date', date('Y-m-d', strtotime("+$days days")), '<');
}
public function GetProductDetails(int $productId)
{
if (!$this->ProductExists($productId))