MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/login_cafsindia_com/application/controllers/Appraisal_view.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Appraisal_view  extends Action_controller{	
	public function __construct(){
		parent::__construct('appraisal_view');
	}	
	// LOAD PAGE AND INPUTS WILL SHOW
	public function index(){
		$this->load->view("appraisal_view/manage");
	}
	// EMPLOYEE LOGIN CODE SUGGEST FOR ADMIN OR SUPER ADMIN 
	public function emp_login_suggest(){
		$search_term  = $this->input->post('term', true);
		$final_qry    = 'select login_code from cw_employees where employee_status = 1 and login_code like "'.$search_term.'%"';
		$final_data   = $this->db->query("CALL sp_a_run ('SELECT','$final_qry')");
		$final_result = $final_data->result();
		$final_data->next_result();
		foreach($final_result as $rslt){
			$login_code = $rslt->login_code;
			$suggestions[] = array('value' => $login_code, 'label' => "$login_code");
		}
		if(empty($suggestions)){
			$suggestions[] = array('value' => "0", 'label' => "No data found for this search");
		}
		echo json_encode($suggestions);
	}
	// GET APPRASIAL DOCUMENT BASED ON MONTHS
	public function get_appraisel(){
		$from_month        = $this->input->post('from_month');
		$to_month          = $this->input->post('last_month');
		$login_code        = $this->input->post('login_code');
		if(!$login_code){
			$login_code    = $this->session->userdata('login_code');
		}
		$enc_filename      = $this->encrypt_file_name($login_code);
		$month             = DateTime::createFromFormat('d-m-Y', "01-" . $from_month);
		$end               = DateTime::createFromFormat('d-m-Y', "01-" . $to_month);
		$tble_line         = "";
		$tble_no_line      = "";
		$i                 = 0;
		$j                 = 0;
		while($month <= $end){   // Loop for the from month to to month get appraisal documents
			$month_folder = $month->format('m-Y');
			$file_path    = "emp_documents/appraisal_letter/" . $month_folder . "/".$login_code.'_'. $enc_filename . ".pdf";
			if(file_exists($file_path)){	 //Check filepath Encode the filepath to pass (View and Download the file)
				$enc_path      = base64_encode($file_path);
				$file_path     = base64_encode($file_path);
				$file_path     = base64_encode($file_path);
				$tble_line    .= "  <tr class='data_list'>
									    <td>$month_folder</td>
									    <td>
										    <a class='fa fa-folder-open' id='view_btn' onclick=pdf_viewer('$file_path') style='color: blue;'>  view</a>
										    <a class='fa fa-download'  id='download_btnn' onclick=download_payslip('download_$emp_code','$enc_path') id='download_$emp_code'>  Download</a>
									    </td>
								    </tr>";
								    $j++;
			}else{
				$tble_no_line = "   <tr class='data_list'>
										<td colspan='2' style='text-align:center;'>No data found</td>
								    </tr>";
			}
			$month->modify('+1 month');
			$i++;
		}
			$tbl_body  = "";
			if((int)$j >= 1){
				$tbl_body = $tble_line;
			}else{
				$tbl_body = $tble_no_line;
			}
			$table_data = "	<table class='table table-striped table-bordered' id='emp_details'>
									<thead>
										<tr>
											<th>Appraisal Month</th>
											<th>Action</th>
										</tr>
									</thead>
									<tbody>
										$tbl_body
									</tbody>
								</table>";
			echo json_encode(['success' => true,'message' => 'Appraisal Details','table_data' => $table_data]);	
	}
}
?>