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="
";
$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 ;
}
?>