From f272502a88e9e6063c647c45fdee395434752220 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Tue, 3 Sep 2024 14:32:27 -0400 Subject: [PATCH] now hours --- app/Controllers/BkoDash.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Controllers/BkoDash.php b/app/Controllers/BkoDash.php index 599c2cd..6d7aef4 100644 --- a/app/Controllers/BkoDash.php +++ b/app/Controllers/BkoDash.php @@ -33,7 +33,7 @@ class BkoDash extends BaseController $dash_data["today_application"] = 0; $dash_data["curr_month"] = date('F'); - $dash_data["curr_application_amount"] = "0"; + $dash_data["curr_application_amount"] = $this->monthApplicationCount()["amount"]; $dash_data["curr_application_percentage"] = "0"; $dash_data["curr_application_direction"] = "up"; @@ -68,6 +68,17 @@ class BkoDash extends BaseController // return $this->respond([], 200); } + + private function monthApplicationCount(){ + //$status_result = 0; + $mysqlA = "select count(id) AS app_count, sum(loan_amount) AS amount from applications WHERE added BETWEEN '2024-09-01' AND now()"; + $query2 = $this->db->query($mysqlA); + $row2 = $query2->getResult('array'); + if ($row2 && count($row2)> 0 && $row2[0]["app_count"] > 0 ){ + return $row2[0]; + } + return ["app_count"=> 0, "amount"=> 0 ]; + } private function applicationCount($applicationStatus){ //$status_result = 0; $mysqlA = "select count(id) AS app_count, sum(loan_amount) AS amount from applications WHERE status= ".$applicationStatus;