File: /home/cafsindia/login_cafsindia_com/application/controllers/Incentive_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Incentive_report extends Action_controller{
public function __construct(){
parent::__construct('incentive_report');
$this->collect_base_info();
}
// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
public function index(){
$data['quick_link'] = $this->quick_link;
$data['table_head'] = $this->table_head;
$data['master_pick'] = $this->master_pick;
$data['fliter_list'] = $this->fliter_list;
$this->load->view("$this->control_name/manage",$data);
}
public function check_incentive_sts(){
$process_date = $this->input->post("process_month");
$employee_code= $this->session->userdata('employee_code');
$check_map_qry = 'SELECT GROUP_CONCAT(DISTINCT channel) as channel,GROUP_CONCAT(DISTINCT band) as band from cw_employees where cw_employees.employee_status = 1 and (cw_employees.employee_code = "'.$employee_code.'" or (cw_employees.actual_level_1 = "'.$employee_code.'" or cw_employees.actual_level_2 = "'.$employee_code.'")) and band != 0 and channel != 0';
$check_map_info = $this->db->query("CALL sp_a_run ('SELECT','$check_map_qry')");
$check_map_result = $check_map_info->result();
$check_map_info->next_result();
$channels = $check_map_result[0]->channel;
$bands = $check_map_result[0]->band;
$emp_incentive_qry = 'SELECT cw_band.band_name,cw_type.type_for_name,cw_channel.channel_name as channel,cw_incentive_file.process_month,file_name,remarks,file_upload,DATE_FORMAT(cw_incentive_file.date_of_intimation,"%d-%m-%Y") as date_of_intimation from cw_incentive_file inner join cw_type on cw_type.prime_type_id = cw_incentive_file.incentive_type inner join cw_channel on cw_channel.prime_channel_id = cw_incentive_file.channel_name inner join cw_band on cw_incentive_file.band = cw_band.prime_band_id where cw_incentive_file.process_month = "'.$process_date.'" and cw_incentive_file.channel_name IN ('.$channels.') and cw_incentive_file.band in ('.$bands.') group by cw_incentive_file.prime_incentive_file_id';
$emp_incentive_info = $this->db->query("CALL sp_a_run ('SELECT','$emp_incentive_qry')");
$emp_incentive_result = $emp_incentive_info->result_array();
$emp_incentive_info->next_result();
if($emp_incentive_result){
echo json_encode(array('success' => TRUE,'emp_incentive_result' => $emp_incentive_result));
}else{
echo json_encode(array('success' => FALSE,'message' => "No Data Available"));
}
}
}
?>