0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.142.255.103


Current Path : /var/www/html/mum/custom_src/
Upload File :
Current File : /var/www/html/mum/custom_src/get_fm_emp_list.php

<?php
 
function getFWEmployeeList($aobj_context)
{
$value=trim($aobj_context->mobj_data["value"]);
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 

$emp_ids=trim($aobj_context->mobj_data["emp_ids"]);
$emp_ids='0'.substr($emp_ids,0,strlen($emp_ids)-1);
$obj_get_employee_fields=getSearchedEmployeeFields($aobj_context,$value,$emp_ids);

$str_emp="<table  width='50%' align='left' border='0' cellpadding='0' cellspacing='0'>";
$str_emp.="<tr>";
$str_emp.="<td style='width:180px;'>";
$str_emp.="<div id='report_setup_employee_div' style='overflow-y:scroll; overflow-y:auto; width:260px; height:250px; border:1px solid #cccccc;'>";

	for($mdata = 0 ; $mdata < count($obj_get_employee_fields) ; $mdata++)
	{     
	$field_data_id =  $obj_get_employee_fields[$mdata][emp_code];
	$internal_code = $obj_get_employee_fields[$mdata][internal_code];
	 $checked = $obj_get_employee_fields[$mdata][checked];
    $checked=($checked==1)?" checked ":"";	
	
	$str_emp.="<input type='checkbox' class='checkbox_hgt' style='border:0px solid #C5DBEC;' {$checked} id = 'fw_emp_list_int_code_$internal_code' name='{$internal_code}' /><label for='checkOption1'>{$field_data_id}</label><br />";
	}
    $str_emp.="</div></td>";
    $str_emp.="</tr></table>";	
	
	$select_emp_schema_id="select internal_code from s_user_schema where
						module_name='Employee'";
	$obj_select_emp_schema_id = $aobj_context->mobj_db->GetRow($select_emp_schema_id);					
	$arr['html']=$str_emp;	
	$arr['schema_id']=$obj_select_emp_schema_id;	
	$arr['emp_table_data']=$obj_get_employee_fields;
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
}


function getSearchedEmployeeFields($aobj_context,$value,$emp_ids) 
{
require_once($aobj_context->main_src."/custom_src/employeeClass.php");

$emp_obj=new employeeClass($aobj_context);
$emp_obj->employee();
 
	if(!empty($value)  && $value!='undefined')
	{
			$get_data="select internal_code,case when internal_code in ({$emp_ids})
					then 1
					else 0 end as checked,
						concat({$emp_obj->employee_code},'-',{$emp_obj->employee_name}) as emp_code
						from {$emp_obj->employee_table} where 
						(
						({$emp_obj->employee_code} like '{$value}%' 
						or internal_code in ({$emp_ids})) )
						order by  {$emp_obj->employee_code} ";
		$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
		
		if(empty($obj_get_employee_fields))
		{	
		$get_data="select internal_code,case when internal_code in ({$emp_ids})
					then 1
					else 0 end as checked,
						concat({$emp_obj->employee_name},'-',{$emp_obj->employee_code}) as emp_code
						from {$emp_obj->employee_table}(
						({$emp_obj->employee_code} like '{$value}%' 
						or internal_code in ({$emp_ids})) ) order by  {$emp_obj->employee_name}   ";					
		$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
		
	
		}
		 
	}	 
	else
	{
	  $get_data="select internal_code,case when internal_code in ({$emp_ids})
					then 1
					else 0 end as checked,
						concat({$emp_obj->employee_code},'-',{$emp_obj->employee_name}) as emp_code
						from {$emp_obj->employee_table}  order by  {$emp_obj->employee_code}  ";							
		$obj_get_employee_fields = $aobj_context->mobj_db->GetAll($get_data);
	 
	}
	return $obj_get_employee_fields ;
}

 
 ?>