133 lines
5.6 KiB
PHP
133 lines
5.6 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers;
|
|
|
|
use CodeIgniter\API\ResponseTrait;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
|
|
class BkoReports extends BaseController
|
|
{
|
|
use ResponseTrait;
|
|
// protected $db;
|
|
|
|
var $request;
|
|
|
|
function __construct()
|
|
{
|
|
$this->request = \Config\Services::request();
|
|
}
|
|
|
|
public function startedApplication() :ResponseInterface
|
|
{
|
|
//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
|
|
FROM applications a
|
|
LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 1 ");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
// return $this->respond([], 200);
|
|
}
|
|
|
|
public function pendingApplication() :ResponseInterface
|
|
{
|
|
//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
|
|
FROM applications a
|
|
LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 1 ");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
// return $this->respond([], 200);
|
|
}
|
|
|
|
public function readyApplication() :ResponseInterface
|
|
{
|
|
//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
|
|
FROM applications a
|
|
LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 2 ");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
// return $this->respond([], 200);
|
|
}
|
|
|
|
public function approvedApplication() :ResponseInterface
|
|
{
|
|
//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
|
|
FROM applications a
|
|
LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 5 ");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
// return $this->respond([], 200);
|
|
}
|
|
|
|
public function rejectedApplication() :ResponseInterface
|
|
{
|
|
//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
|
|
FROM applications a
|
|
LEFT JOIN customers c ON c.uid = a.customer_uid WHERE a.status = 7 ");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
// return $this->respond([], 200);
|
|
}
|
|
|
|
public function employersList() :ResponseInterface {
|
|
$query = $this->db->query("SELECT uid,name FROM employer_sector");
|
|
$employer_sector = $query->getResult('array');
|
|
|
|
$query = $this->db->query("SELECT uid,name FROM salary_sources");
|
|
$salary_sources = $query->getResult('array');
|
|
|
|
$query = $this->db->query("SELECT * FROM employers");
|
|
$row = $query->getResult('array');
|
|
$data = [
|
|
'call_return' => '100',
|
|
'salary_sources' => $salary_sources,
|
|
'employer_sector' => $employer_sector,
|
|
'records' => $row
|
|
];
|
|
return $this->respond($data, 200);
|
|
}
|
|
|
|
} |