!!Get Employee EEM_ASOF

!Functionality: The purpose of this function is capture the corresponding [EEM_ID] from [P2K_HR_EMPLOYMENTS] using a [PERSON_CODE], [EMPLOYMENT_TYPE] and as of date.  

!Parameters:

|PERSON_CODE     | ''Required''. The [PERSON_CODE] for the employee.
|EMPLOYEE_TYPE   | ''Optional''. The [EMPLOYMENT_TYPE] as defined on the [IMLN] lexicon [X_EMPLOYMENT_TYPE]. If not provided then the value '00' is used. 
|AS_OF           | ''Optional''.  The employment that has this date that fall between the [HIRE_DATE] and the [TERMINATION_DATE] will be returned. If not provided then the current date is used as the as of date. If the employment has overlapping dates, the record with the greatest hire date based on the as of date will be returned. If the employment has a null value for a [TERMINATION_DATE] than the end of time will be used as a date.

!Returns: 
Numeric

!Errors:  
* If no data is found (the employee cannot be found using either code), zero a null value is returned
* If any error occurs during data retrieval, 0 is returned
* If the employment has overlapping dates (To many employments), the record with the greatest hire date based on the as of date will be returned.

!Example: 

{{P2K_PU.GET_EEM_ASOF(~)}}

will get the EEM_ID value for the passed person code, for the employment record with the most future hire date prior to today (current date) with an employment type of '01-Employee'

{{P2K_PU.GET_EEM_ASOF(~,'03')}}

will get the EEM_ID value for the passed person code if the employment type is '02-Retiree'.

{{P2K_PU.GET_EEM_ASOF(~,'01','01-Jan-2017')}}
will get the EEM_ID value for the passed person code, for the employment record with a [HIRE_DATE] less than and [TERMINATION_DATE] greater than '01-Jan-2017' with an employment type of '01-Employee'

!Notes


----
![Notes|Edit:Internal.GET_EEM_ASOF]
[{InsertPage page='Internal.P2K_PU.GET_EEM_ASOF' default='Click to create a new notes page'}]