diff --git a/app/Controllers/BkoDash.php b/app/Controllers/BkoDash.php index 1f257e7..b68d53f 100644 --- a/app/Controllers/BkoDash.php +++ b/app/Controllers/BkoDash.php @@ -29,7 +29,7 @@ class BkoDash extends BaseController // LEFT JOIN customers c ON c.uid = a.customer_uid LIMIT 10"); $dash_data["active_loans"] = 0; - $dash_data["applications"] = 0; + $dash_data["applications"] = $this->applicationCount(1); $dash_data["today_application"] = 0; $dash_data["curr_month"] = date('F'); @@ -68,6 +68,16 @@ class BkoDash extends BaseController // return $this->respond([], 200); } + private function applicationCount($applicationStatus){ + $count_status = 0; + $mysqA = "select count(id) AS app_count from applications WHERE status= ".$applicationStatus; + $query2 = $this->db->query($mysqA); + $row2 = $query2->getResult('array'); + if ($row2 && count($row2)> 0 ){ + $count_status = $row2[0]["app_count"]; + } + return $count_status; + } public function pendingApplication() :ResponseInterface { //SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications;