From be513122fa434f86d98d54f42fa59d050a65ef16 Mon Sep 17 00:00:00 2001 From: Daniel Reinoso <9046616+danielr18@users.noreply.github.com> Date: Fri, 25 Oct 2024 17:49:06 -0300 Subject: [PATCH] Fix SQL query --- controllers/StockReportsController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/StockReportsController.php b/controllers/StockReportsController.php index 0cf0bfcf..78a0ef55 100644 --- a/controllers/StockReportsController.php +++ b/controllers/StockReportsController.php @@ -14,12 +14,12 @@ class StockReportsController extends BaseController { $startDate = $request->getQueryParams()['start_date']; $endDate = $request->getQueryParams()['end_date']; - $where = " AND pph.purchased_date BETWEEN '$startDate' AND '$endDate'"; + $where .= " AND pph.purchased_date BETWEEN '$startDate' AND '$endDate'"; } else { // Default to this month - $where = " AND pph.purchased_date >= DATE(DATE('now', 'localtime'), 'start of month')"; + $where .= " AND pph.purchased_date >= DATE(DATE('now', 'localtime'), 'start of month')"; } $groupBy = 'product';