diff --git a/app/Controllers/BkoReports.php b/app/Controllers/BkoReports.php index c6ba131..c4fec17 100644 --- a/app/Controllers/BkoReports.php +++ b/app/Controllers/BkoReports.php @@ -55,19 +55,26 @@ class BkoReports extends BaseController // return $this->respond([], 200); } + private function applicationQuery($status): string{ + return " + SELECT c.firstname, c.lastname, a.uid,a.loan_amount, + a.payment_month,a.sales_agent,a.gender, + a.marital_status,a.email,a.address, + a.state,a.country,a.status,a.added, + a.updated, + e.name AS employer_name + FROM applications a + LEFT JOIN customers c ON c.uid::text = a.customer_uid::text + LEFT JOIN employers e ON e.uid::text = a.employer_uid::text + WHERE a.status = $status + "; + } + public function readyApplication() :ResponseInterface { + $readyQuery = $this->applicationQuery(2); //SELECT uid,loan_amount,payment_month,sales_agent,gender,marital_status,email,address,state,country,status,added,updated FROM applications; - $query = $this->db->query("SELECT c.firstname, c.lastname, a.uid,a.loan_amount, - a.payment_month,a.sales_agent,a.gender, - a.marital_status,a.email,a.address, - a.state,a.country,a.status,a.added, - a.updated, - e.name AS employer_name - FROM applications a - LEFT JOIN customers c ON c.uid::text = a.customer_uid::text - LEFT JOIN employers e ON e.uid::text = a.employer_uid::text - WHERE a.status = 2 "); + $query = $this->db->query("$readyQuery"); $row = $query->getResult('array'); $data = [ 'call_return' => '100',