File: /home/cafsindia/crm_cafsindia_com/application/controllers/Report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Persons.php");
class Report extends Persons
{
public function __construct()
{
parent::__construct('report');
$this->load->model('Report_model');
}
public function index()
{
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
$data['table_headers'] = $this->xss_clean(get_report_table_headers());
$role_info[""] = "---- Select Role ----";
foreach($this->Report_model->get_role()->result_array() as $row){
$role_info[$this->xss_clean($row['role_id'])] = $this->xss_clean($row['role_name']);
}
$data['role_info'] = $role_info;
//SAT-Get Category
$category_info[""] = "---- Select Category ----";
foreach($this->Report_model->get_category()->result_array() as $row){
$category_info[$this->xss_clean($row['cat_id'])] = $this->xss_clean($row['cat_name']);
}
$data['category_info'] = $category_info;
$this->load->view('report/manage', $data);
}
/*
Returns Supplier table data rows. This will be called with AJAX.
*/
public function search()
{
$search = $this->input->get('search');
$limit = $this->input->get('limit');
$offset = $this->input->get('offset');
$sort = $this->input->get('sort');
$order = $this->input->get('order');
$filters = array('crm' => $this->input->get('crm'),
'crmto' => $this->input->get('crmto'));
$all_leads = $this->Report_model->search($search, $filters, $limit, $offset, $sort, $order);
$total_rows = $this->Report_model->get_found_rows($search, $filters);
$data_rows = array();
foreach($all_leads->result() as $leads){
$data_rows[] = get_transfer_data_row($leads, $this);
}
echo json_encode(array('total' => $total_rows, 'rows' => $data_rows));
}
/*
This Report
*/
public function report(){
$filters = array('start_date' => $this->input->post('start_date'), 'end_date' => $this->input->post('end_date'));
$role = $_REQUEST['role'];
$category = $_REQUEST['category'];
$status = $_REQUEST['status'];
$result = $this->Report_model->role_wise_report($role,$category,$filters,$status);
echo $result;
}
public function role_wise_bar($role,$category,$start,$end,$status){
$role = $_REQUEST['role'];
$category = $_REQUEST['category'];
$status = $_REQUEST['status'];
$start = $_REQUEST['start'];
$end = $_REQUEST['end'];
$result = $this->Report_model->role_wise($role,$category,$start,$end,$status);
print json_encode($result, JSON_NUMERIC_CHECK);
}
}
?>