DASHBOARD CONTENT ADDED
This commit is contained in:
parent
dce345bda6
commit
df7113c5f0
@ -94,6 +94,7 @@ defined('ROUTE_LOGIN_D') OR define('ROUTE_LOGIN_D', 'getFilterDistricts')
|
||||
defined('ROUTE_LOGIN_E') OR define('ROUTE_LOGIN_E', 'testRedirect'); // login api
|
||||
defined('ROUTE_LOGIN_F') OR define('ROUTE_LOGIN_F', '(getFilterSchools/:any)'); // login api
|
||||
defined('ROUTE_LOGIN_G') OR define('ROUTE_LOGIN_G', 'getFilterMaterials'); // login api
|
||||
defined('ROUTE_LOGIN_H') OR define('ROUTE_LOGIN_H', 'csrDashboardContent'); // login api
|
||||
|
||||
|
||||
// DB TABLE CONSTANTS
|
||||
|
||||
@ -67,6 +67,7 @@ $route['checkTxnStatus'] = 'iobpay/checkTxnStatus';
|
||||
$route['getFilterDistricts'] = 'school_requirement/getFilterDistricts';
|
||||
$route['(getFilterSchools/:any)'] = 'school_requirement/getFilterSchools';
|
||||
$route['getFilterMaterials'] = 'school_requirement/getFilterMaterials';
|
||||
$route['csrDashboardContent'] = 'school_requirement/csrDashboardContent';
|
||||
|
||||
|
||||
|
||||
|
||||
@ -279,6 +279,18 @@ class school_requirement extends REST_Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function csrDashboardContent_get()
|
||||
{
|
||||
$res_data = $this->school_requirement_model->csrDashboardContent();
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $res_data;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class AUTHORIZATION
|
||||
exit;
|
||||
}
|
||||
//For all route name except contant route
|
||||
else if($routingName != ROUTE_LOGIN && $routingName != ROUTE_LOGIN_A && $routingName != ROUTE_LOGIN_B && $routingName != ROUTE_LOGIN_C && $routingName != ROUTE_LOGIN_D && $routingName != ROUTE_LOGIN_E && $routingName != ROUTE_LOGIN_F && $routingName != ROUTE_LOGIN_G){
|
||||
else if($routingName != ROUTE_LOGIN && $routingName != ROUTE_LOGIN_A && $routingName != ROUTE_LOGIN_B && $routingName != ROUTE_LOGIN_C && $routingName != ROUTE_LOGIN_D && $routingName != ROUTE_LOGIN_E && $routingName != ROUTE_LOGIN_F && $routingName != ROUTE_LOGIN_G && $routingName != ROUTE_LOGIN_H){
|
||||
$validateToken = self::validateTimestamp();
|
||||
return $validateToken;
|
||||
}
|
||||
|
||||
@ -149,5 +149,25 @@ class school_requirement_model extends Custom_Model {
|
||||
|
||||
}
|
||||
|
||||
function csrDashboardContent()
|
||||
{
|
||||
// $no_of_schools_posted = $this->db->get_compiled_select('SELECT count(distinct school_id) FROM '.CSR_SCHOOL_REQUIREMENTS);
|
||||
|
||||
// $total_amount_required = $this->db->get_compiled_select('SELECT sum((qty * CSR_MATERIAL_MASTER.cost_per_unit)) as required_amount FROM '.CSR_SCHOOL_REQUIREMENTS.' as CSR_SCHOOL_REQUIREMENTS
|
||||
// LEFT JOIN '.CSR_MATERIAL_MASTER.'as CSR_MATERIAL_MASTER on CSR_SCHOOL_REQUIREMENTS.mat_id = CSR_MATERIAL_MASTER.id');
|
||||
// $no_of_schools_posted = $this->db->get_compiled_select('SELECT count(distinct school_id) FROM '.CSR_SCHOOL_REQUIREMENTS);
|
||||
|
||||
// $this->db->SELECT("count(distinct user_id) as supporters,sum(amount) as contributed_amount,($no_of_schools_posted) as no_of_schools_posted,($total_amount_required) as total_amount_required");
|
||||
// $this->db->FROM(CSR_CONTRIBUTIONS);
|
||||
// // return $this->db->GET()->result_array();
|
||||
// echo $no_of_schools_posted;
|
||||
// echo $total_amount_required;
|
||||
|
||||
$query = "SELECT count(distinct user_id) as supporters,sum(amount) as contributed_amount,(SELECT count(distinct school_id) FROM ".CSR_SCHOOL_REQUIREMENTS.") as no_of_schools_posted,(SELECT sum((qty * CSR_MATERIAL_MASTER.cost_per_unit)) as required_amount FROM ".CSR_SCHOOL_REQUIREMENTS." as CSR_SCHOOL_REQUIREMENTS LEFT JOIN ".CSR_MATERIAL_MASTER." as CSR_MATERIAL_MASTER on CSR_SCHOOL_REQUIREMENTS.mat_id = CSR_MATERIAL_MASTER.id) as total_amount_required FROM ".CSR_CONTRIBUTIONS."";
|
||||
return $this->db->query($query)->result_array()[0];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user