File: /home/cafsindia/allyindian_com/backend/application/controllers/Analysis_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is 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');
}
$pack_data=$this->Analysis_report_model->get_packages();
foreach($pack_data as $row){
$package_name[$this->xss_clean($row['package_id'])] = $this->xss_clean($row['package_title']."-".$row['package_title2']);
}
$data['package_name']=$package_name;
$this->load->view('analysis_report/manage',$data);
}
public function suggest_customer(){
$term = $this->input->get('term');
$suggestions = $this->xss_clean($this->Analysis_report_model->get_customer_suggestions($term));
echo json_encode($suggestions);
}
public function search(){
$process = $this->input->post('process');
$package_name = $this->input->post('package_name');
$custid = $this->input->post('custid');
$package_details = $this->Analysis_report_model->search($package_name,$custid);
$tr_line = "";
$count=0;
foreach($package_details as $rslt){
$count++;
$custid = $rslt['custid'];
$orderid = $rslt['orderid'];
$otripid = $rslt['otripid'];
$custfname = $rslt['custfname'];
$custlname = $rslt['custlname'];
$custdob = $rslt['custdob'];
$custoccu = $rslt['custoccu'];
$custaddress = $rslt['custaddress'];
$custcity = $rslt['custcity'];
$custstate = $rslt['custstate'];
$custcountry = $rslt['custcountry'];
$custpincode = $rslt['custpincode'];
$custphone = $rslt['custphone'];
$custmobile = $rslt['custmobile'];
$custgender = $rslt['custgender'];
$custemail = $rslt['custemail'];
$package_title = $rslt['package_title'];
$package_title2 = $rslt['package_title2'];
$package_title3 = $rslt['package_title3'];
$doj = date('d-m-Y',strtotime($rslt['doj']));
$custdob = date('d-m-Y',strtotime($rslt['custdob']));
$nopass = $rslt['nopass'];
$customer_name = $custfname." ".$custlname;
$package_name = $package_title." ".$package_title2." ".$package_title3;
if($custoccu ==""){
$custoccu ="-";
}
if($custaddress ==""){
$custaddress ="-";
}
if($custcity ==""){
$custcity ="-";
}
if($custstate ==""){
$custstate ="-";
}
if($custoccu ==""){
$custoccu ="-";
}
if($custcountry ==""){
$custcountry ="-";
}
if($custpincode ==""){
$custpincode ="-";
}
if($custphone ==""){
$custphone ="-";
}
if($process == 2){
$tr_line.= "<tr class='cursor' onclick=get_customer_info('$custid','$orderid','$doj','$otripid');>
<td>$count</td>
<td>$customer_name</td>
<td>$custgender</td>
<td>$custdob</td>
<td>$custoccu</td>
<td>$custaddress</td>
<td>$custcity</td>
<td>$custstate</td>
<td>$custcountry</td>
<td>$custpincode</td>
<td>$custmobile</td>
<td>$custphone</td>
<td>$custemail</td>
<td>$package_name</td>
<td>$doj</td>
<td>$nopass</td>
</tr>";
}
if($process == 1){
$tr_line.= "<tr class='cursor' onclick=get_customer_info('$custid','$orderid','$doj','$otripid');>
<td>$count</td>
<td>$customer_name</td>
<td>$custgender</td>
<td>$custdob</td>
<td>$custoccu</td>
<td>$custaddress</td>
<td>$custcity</td>
<td>$custstate</td>
<td>$custcountry</td>
<td>$custpincode</td>
<td>$custmobile</td>
<td>$custphone</td>
<td>$custemail</td>
<td>$package_name</td>
<td>$doj</td>
<td>$nopass</td>
</tr>";
}
}
$th_line ="<tr>
<th>Si. No</th>
<th>Customer Name</th>
<th>Gender</th>
<th>Date of Birth</th>
<th>Occupation</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Country</th>
<th>Pincode</th>
<th>Mobile</th>
<th>Alt. Phone</th>
<th>Email</th>
<th>Package Name</th>
<th>Journey Date</th>
<th>No. of Tickets</th>
</tr>";
$table_info = "<style>.search_th{color: #ffffff;background-color: #d84f57 !important;}</style>
<table class='table table-bordered table-hover table-striped' id='analysis_tbl'>
<thead>
$th_line
</thead>
<tbody>
$tr_line
</tbody>
</table>";
echo "$table_info";
}
}
?>