File: /home/cafsindia/hrms_cafsinfotech_in/application/controllers/Experience_letter.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Experience_letter extends Action_controller{
public function __construct(){
parent::__construct('experience_letter');
}
// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
public function index(){
$table_query = 'select label_name,view_name,field_type from cw_form_setting where prime_module_id = "employees" and trans_status = "1" and label_name in ("role","employee_code","emp_name","resignation_date","last_working_date")';
$table_info = $this->db->query("CALL sp_a_run ('SELECT','$table_query')");
$result = $table_info->result();
$table_info->next_result();
$data['table_head'] = $result;
$data['encKey'] = $this->generateKey();
$this->load->view("$this->control_name/manage",$data);
}
//LOAD TABEL WITH FILTERS
public function search(){
$dec_data = $this->cryptoDecrypt($_POST['Payload']);
$_POST = $dec_data['data'];
if(!$_POST){
echo json_encode(array('success' => false,'message' => 'Url Expired.. Please refresh the page and try again....'));
exit(0);
}
$draw = $this->input->post('draw');
$start = $this->input->post('start');
$per_page = $this->input->post('length');
$order = $this->input->post('order');
$order_col = $this->input->post('columns');
$search = $this->input->post('search');
$column = $order[0]['column'];
$order_sor = $order[0]['dir'];
$order_col = $order_col[$column]['data'];
$search = trim($search['value']);
$common_search = "";
$count_query = '';
$search_query = '';
if($search){
$common_search .= 'and (emp_name like "'.$search.'%" or resignation_date like "'.date('Y-m-d',strtotime($search)).'%" or employee_code like "'.$search.'%")';
}
$count_query .= "select count(*) as allcount from cw_employees inner join cw_category on cw_category.prime_category_id= cw_employees.role where cw_employees.trans_status=1 and cw_employees.termination_status = 1 ".$common_search;
$search_count = $this->db->query($count_query);
$search_info = $search_count->result();
$filtered_count = $search_info[0]->allcount;
$search_query .= "select prime_employees_id,category_name as role,employee_code,emp_name,resignation_date,last_working_date from cw_employees inner join cw_category on cw_category.prime_category_id = cw_employees.role where cw_employees.trans_status=1 and cw_employees.termination_status = 1 ".$common_search;
$search_query .= " ORDER BY resignation_date DESC";
if((int)$per_page !== -1){
$search_query .= " LIMIT $start,$per_page";
}
$search_data = $this->db->query($search_query);
$search_result = $search_data->result();
$num_rows = $search_data->num_rows();
echo json_encode(array("draw" => intval($draw),"recordsTotal" => $num_rows,"recordsFiltered" => $filtered_count,"data" => $search_result));
}
}
?>