File: /home/cafsindia/crm_cafsindia_com/application/controllers/Analysis_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once("Secure_Controller.php");
class Analysis_report extends Secure_Controller
{
public function __construct()
{
parent::__construct('analysis_report');
$this->load->model('Analysis_report_model');
}
public function index()
{
if(!$this->Appconfig->isAppvalid()){
redirect('config');
}
//get role
foreach($this->Analysis_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;
//get Category
foreach($this->Analysis_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;
//lead status
foreach($this->Analysis_report_model->get_lead_status()->result_array() as $row){
$lead_status_info[$this->xss_clean($row['status_id'])] = $this->xss_clean($row['statusname']);
}
$data['lead_status_info'] = $lead_status_info;
//prospect status
foreach($this->Analysis_report_model->get_prospect_level()->result_array() as $row){
$prospect_info[$this->xss_clean($row['prospect_id'])] = $this->xss_clean($row['prospect_name']);
}
$data['prospect_info'] = $prospect_info;
$this->load->view('analysis_report/manage', $data);
}
/*public function get_employee_list(){
$role = $_REQUEST['role'];
$category = $_REQUEST['category'];
$employee_list = $this->Analysis_report_model->get_employee_list($role,$category);
//print_r($employee_list);
echo json_encode(array('status' =>"SUCCESS",'employee_list' => $employee_list));
}*/
public function search(){
$start_date = $this->input->post('start_date');
$end_date = $this->input->post('end_date');
$process = $this->input->post('process');
$category = $this->input->post('category');
$lead_status = $this->input->post('lead_status');
$prospect_level = $this->input->post('prospect_level');
$issuance_status = $this->input->post('issuance_status');
$document_issue_status = $this->input->post('document_issue_status');
$renewal_status = $this->input->post('renewal_status');
$client_status = $this->input->post('client_status');
$premium_status = $this->input->post('premium_status');
$search_info =$this->Analysis_report_model->search($start_date,$end_date,$process,$category,$lead_status,$prospect_level,$issuance_status,$document_issue_status,$renewal_status,$client_status,$premium_status);
$tr_line = "";
foreach($search_info as $rslt){
$ncd = date('d/m/Y',strtotime($rslt->ncd));
$renewal_date = date('d/m/Y',strtotime($rslt->renewal_date));
$issued_date = date('d/m/Y',strtotime($rslt->issued_date));
$login_date = date('d/m/Y',strtotime($rslt->login_date));
if($rslt->mode === "1"){
$mode = "Yearly";
}
if($rslt->mode === "2"){
$mode = "Semi-Annual";
}
if($rslt->mode === "3"){
$mode = "Monthly";
}
if($rslt->mode === "4"){
$mode = "Quarterly";
}
if($process === "lead"){
$tr_line .= "<tr style='text-align:left !important;'>
<td>$rslt->lead_id</td>
<td>$rslt->lead_type_id</td>
<td>$rslt->cust_name</td>
<td>$rslt->cust_mobile</td>
<td>$rslt->cat_name</td>
<td>$rslt->lead_type</td>
<td>$rslt->statusname</td>
<td>$rslt->prospect_name</td>
<td>$ncd</td>
<td>$rslt->expected_value</td>
<td>$rslt->created_by</td>
<td>$rslt->control_by</td>
<td>$rslt->rm_name</td>
<td>$rslt->tl_name</td>
<td>$rslt->createddate</td>
</tr>";
}
if($process === "product"){
$tr_line .= "<tr style='text-align:left !important;'>
<td>$rslt->lead_id</td>
<td>$rslt->lead_type_id</td>
<td>$rslt->cust_name</td>
<td>$rslt->cust_mobile</td>
<td>$rslt->cat_name</td>
<td>$rslt->lead_type</td>
<td>$rslt->statusname</td>
<td>$rslt->prospect_name</td>
<td>$login_date</td>
<td>$rslt->product_name</td>
<td>$rslt->vendorcompanyname</td>
<td>$rslt->overall_net_premium</td>
<td>$rslt->overall_total_premium</td>
<td>$rslt->issuance_status</td>
<td>$issued_date</td>
<td>$rslt->document_issue_status</td>
<td>$rslt->policy_no</td>
<td>$rslt->sum_assured</td>
<td>$rslt->policy_term</td>
<td>$rslt->paying_term</td>
<td>$mode</td>
<td>$rslt->rm_name</td>
<td>$rslt->rm_code</td>
<td>$rslt->tl_name</td>
<td>$rslt->createddate</td>
</tr>";
}
if($process === "renewal"){
$tr_line .= "<tr style='text-align:left !important;'>
<td>$rslt->cust_name</td>
<td>$rslt->cust_mobile</td>
<td>$rslt->cat_name</td>
<td>$rslt->statusname</td>
<td>$rslt->prospect_name</td>
<td>$rslt->renew_status</td>
<td>$rslt->client_status</td>
<td>$rslt->premium_status</td>
<td>$rslt->policy_no</td>
<td>$rslt->sum_assured</td>
<td>$renewal_date</td>
<td>$issued_date</td>
<td>$rslt->paying_year</td>
</tr>";
}
}
if($process === "lead"){
$th_line = "<tr style='text-align:center !important; background:#3369E6;'>
<th style ='color:#FFFFFF !important;'>Lead ID</th>
<th style ='color:#FFFFFF !important;'>Lead Type ID</th>
<th style ='color:#FFFFFF !important;'>Customer Name</th>
<th style ='color:#FFFFFF !important;'>Mobile</th>
<th style ='color:#FFFFFF !important;'>Category</th>
<th style ='color:#FFFFFF !important;'>Lead Type</th>
<th style ='color:#FFFFFF !important;'>Lead Status</th>
<th style ='color:#FFFFFF !important;'>Prospect</th>
<th style ='color:#FFFFFF !important;'>NCD</th>
<th style ='color:#FFFFFF !important;'>Exp Value</th>
<th style ='color:#FFFFFF !important;'>Created By</th>
<th style ='color:#FFFFFF !important;'>Control By</th>
<th style ='color:#FFFFFF !important;'>RM Name</th>
<th style ='color:#FFFFFF !important;'>Manager Name</th>
<th style ='color:#FFFFFF !important;'>Created Date</th>
</tr>";
}
if($process === "product"){
$th_line = "<tr style='text-align:center !important; background:#3369E6;'>
<th style ='color:#FFFFFF !important;'>Lead ID</th>
<th style ='color:#FFFFFF !important;'>Lead Type ID</th>
<th style ='color:#FFFFFF !important;'>Customer Name</th>
<th style ='color:#FFFFFF !important;'>Mobile</th>
<th style ='color:#FFFFFF !important;'>Category</th>
<th style ='color:#FFFFFF !important;'>Lead Type</th>
<th style ='color:#FFFFFF !important;'>Lead Status</th>
<th style ='color:#FFFFFF !important;'>Prospect</th>
<th style ='color:#FFFFFF !important;'>Login Date</th>
<th style ='color:#FFFFFF !important;'>Product</th>
<th style ='color:#FFFFFF !important;'>Company</th>
<th style ='color:#FFFFFF !important;'>Overall Net Premium</th>
<th style ='color:#FFFFFF !important;'>Overall Total Premium</th>
<th style ='color:#FFFFFF !important;'>Issuance Status</th>
<th style ='color:#FFFFFF !important;'>Issued Date</th>
<th style ='color:#FFFFFF !important;'>Doc Issue Status</th>
<th style ='color:#FFFFFF !important;'>Policy No</th>
<th style ='color:#FFFFFF !important;'>Sum Assured</th>
<th style ='color:#FFFFFF !important;'>Policy Term</th>
<th style ='color:#FFFFFF !important;'>Paying Term</th>
<th style ='color:#FFFFFF !important;'>Mode</th>
<th style ='color:#FFFFFF !important;'>RM Name</th>
<th style ='color:#FFFFFF !important;'>RM Code</th>
<th style ='color:#FFFFFF !important;'>Manager Name</th>
<th style ='color:#FFFFFF !important;'>Created Date</th>
</tr>";
}
if($process === "renewal"){
$th_line = "<tr style='text-align:center !important; background:#3369E6;'>
<th style ='color:#FFFFFF !important;'>Customer Name</th>
<th style ='color:#FFFFFF !important;'>Mobile</th>
<th style ='color:#FFFFFF !important;'>Category</th>
<th style ='color:#FFFFFF !important;'>Lead Status</th>
<th style ='color:#FFFFFF !important;'>Prospect</th>
<th style ='color:#FFFFFF !important;'>Renew Status</th>
<th style ='color:#FFFFFF !important;'>Client Status</th>
<th style ='color:#FFFFFF !important;'>Premium Status</th>
<th style ='color:#FFFFFF !important;'>Policy No</th>
<th style ='color:#FFFFFF !important;'>Sum Assured</th>
<th style ='color:#FFFFFF !important;'>Renewal Date</th>
<th style ='color:#FFFFFF !important;'>Issued Date</th>
<th style ='color:#FFFFFF !important;'>Paying Year</th>
</tr>";
}
$table_info = "<table class='table table-hover table-striped col-style' id='analysis_tbl'>
<thead>
$th_line
</thead>
<tbody>
$tr_line
</tbody>
</table>";
echo "$table_info";
}
}
?>