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/Health_report.php
<?php if ( ! defined('BASEPATH')) exit('No direct script is allowed');
require_once("Action_controller.php");
class Health_report  extends Action_controller{	
	public function __construct(){
		parent::__construct('health_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;
		//select query for get a form view setting tab result
		$select_columns            = 'cw_employees.employee_code,cw_employees.login_code,cw_employees.employee_name';
		$table_name                = 'cw_employees';
		$table_join                = '';
		$table_where               = 'cw_employees.trans_status = 1';
		//FUNCTION USED FOR CREATE A QRY 
		$emp_rslt                  = $this->query_build_function($select_columns,$table_name,$table_join,$table_where);

		//level1 employees picklist
		$level1_list[""] = "---- select Level1 ----";
		foreach($emp_rslt as $for){
			$employee_code            = $for['employee_code'];
			$login_code               = $for['login_code'];
			$employee_name            = $for['employee_name'];
			$level1_list[$employee_code] = $login_code.' - '.$employee_name;
		}
		$data['level1_list']  = $level1_list;

		//level2 employees picklist
		$level2_list[""] = "---- select Level1 ----";
		foreach($emp_rslt as $for){
			$employee_code               = $for['employee_code'];
			$login_code                  = $for['login_code'];
			$employee_name               = $for['employee_name'];
			$level2_list[$employee_code] = $login_code.' - '.$employee_name;
		}
		$data['level2_list']  = $level2_list;

		$this->load->view("$this->control_name/manage",$data);
	}
	
	public function in_active_login_detail(){
		$level1       = $this->input->post('level1');
		$level2       = $this->input->post('level2');
		// $tble_line              = "";
		$in_active_login_qry    = 'SELECT CONCAT_WS(" - ",cw_health.login_code,cw_employees.employee_name) as login_code,CONCAT_WS(" - ",level1.login_code,level1.employee_name) as level1_code,CONCAT_WS(" - ",level2.login_code,level2.employee_name) as level2_code,cw_health.proposer_name,cw_health.contact_number,cw_health.alter_contact_number,cw_health.health_email,cw_health_product.product_name,cw_health.policy_number,login_date,cw_issuance_status.issuance_status,net_premium from cw_health inner join cw_employees on cw_employees.login_code = cw_health.login_code inner join cw_employees level1 on level1.employee_code = cw_health.actual_level_1 inner join cw_employees level2 on cw_health.actual_level_2 = level2.employee_code inner join cw_health_product on cw_health_product.prime_health_product_id = cw_health.product inner join cw_issuance_status on cw_issuance_status.prime_issuance_status_id = cw_health.issuance_status where cw_health.trans_status = 1 and cw_employees.employee_status = 2 and cw_health.issuance_status = 1 and cw_health.actual_level_1 = "'.$level1.'" and cw_health.actual_level_2 = "'.$level2.'" ORDER BY cw_health.login_date ASC';
		$in_active_login_info   = $this->db->query("CALL sp_a_run ('SELECT','$in_active_login_qry')");
		$in_active_login_rslt   = $in_active_login_info->result_array();
		$in_active_login_info->next_result();
		// ,CONCAT_WS(" - ",level1.login_code,level1.employee_name) as level1_code,CONCAT_WS(" - ",level2.login_code,level2.employee_name) as level2_code
		// inner join cw_employees level1 on level1.employee_code = cw_health.actual_level_1 inner join cw_employees level2 on cw_health.actual_level_2 = level2.employee_code
		if($in_active_login_rslt){
			echo json_encode(array('success' => TRUE,'in_active_login_report' => $in_active_login_rslt));
		}else{
			echo json_encode(array('success' => FALSE,'message' => "No Data Available"));
		}
	}

	//SELECT QUERY BUILD FUNCTION
	public function query_build_function($select_columns,$table_name,$table_join,$table_where){
		$table_qry_detail  = 'select '.$select_columns.' from '.$table_name.' '.$table_join.' where '.$table_where.'';
		$table_qry_info    = $this->db->query("CALL sp_a_run ('SELECT','$table_qry_detail')");
		$table_qry_rslt    = $table_qry_info->result_array();
		$table_qry_info->next_result();
		return $table_qry_rslt;
	}		
}
?>