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/hrms_allyindian_com/application/controllers/Employment_details.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Employment_details  extends Action_controller{	
	public function __construct(){
		parent::__construct('employment_details');
	}
	
	// LOAD PAGE QUICK LINK,FILTERS AND TABLE HEADERS
	public function index(){
		//PAGE INFO FUNCTION
		$data['key']            = $this->generateKey();
		$this->load->view("$this->control_name/manage",$data);
	}
	//PAYSLIP GENERATION PROCESS
	public function check_offer_letter(){ // NAME CANGED FROM CHECK_PAYSLIP TO CHECK_OFFER_LETTER [MS 11-11-2024]
		$encString             = file_get_contents('php://input');
		$_POST                 = $this->cryptoDecrypt($encString);
		if(!$_POST){
			echo json_encode(array('success' => false,'message' => 'Url Expired.. Please refresh the page and try again....','table_data' => ""));
			exit(0);
		}
		$cat_id                 = $this->input->post('category');
		$emp_code               = $this->input->post('emp_code');
		$company_info           = $this->company_info();
		$pdf_based_on           = $company_info[0]->payslip_based_on;
		if(!$pdf_based_on){
			echo json_encode(array('success' => false,'message' => 'In Company Information Please should add User Rights in Payslip Based Input ','table_data' => $table_data));
			exit(0);
		}else{
			$emp_qry            = 'select '.$pdf_based_on.' from cw_employees where trans_status = 1 and employee_code = "'.$emp_code.'"';
			$emp_info           = $this->db->query("CALL sp_a_run ('SELECT','$emp_qry')");
			$emp_rslt           = $emp_info->result();
			$emp_info->next_result();
			$payslip_based_val	= $emp_rslt[0]->$pdf_based_on;
			$pdf_name_query     = 'select prime_print_info_id,print_info_module_id,print_info_name from cw_print_info where pdf_design_for REGEXP "(^|,)('.$payslip_based_val.')(,|$)" and print_info_module_id = "offer_letter" and print_type = 3 and trans_status = 1';
			$pdf_name_info      = $this->db->query("CALL sp_a_run ('SELECT','$pdf_name_query')");
			$pdf_name_result    = $pdf_name_info->result();
			$pdf_name_info->next_result();	
			$module_name	    = $pdf_name_result[0]->print_info_module_id;
			$template_design    = strtolower(str_replace(' ', '_', $pdf_name_result[0]->print_info_name));

			$file_path 	        = "./".$module_name."/".$template_design."/".$pdf_based_on."_".$payslip_based_val.'/'.$emp_code.'.pdf';
			// echo "file_path::$file_path";die;
			$tble_line          = "	<tr class='gradeU'>
			<td colspan='2' style='text-align:center;'>No data found</td>
			</tr>";
			if(file_exists($file_path)){
				$file_path     = base_url().$file_path;
				$filename      = dirname(__FILE__).$file_path;
				$filename      = str_replace("application\controllers","",$filename);
				$tble_line = "	<tr class='gradeU'>
							<td>
								<a class='btn btn-primary btn-sm' onclick=pdf_viewer('$file_path')><span class='fa fa-eye' >&nbsp;</span> view </a>
								<a class='btn btn-primary btn-sm' id='download_offer' href='$file_path' download '><span class='fa fa-download' download>&nbsp;</span> Download </a>
								</td>
							</tr>";
			}
			//------------------- TABLE CREATION -------------------
			$table_data = "	<table class='table table-striped table-bordered' id='emp_details'>
								<thead>
									<tr>
									<th>Action</th>
									</tr>
								</thead>
								<tbody>
									$tble_line
								</tbody>
							</table>";
			
			echo json_encode(array('success' => true,'message' => 'Payslip Details','table_data' => $table_data));
		}
	}
}
?>