!!Get Employee GET_BBR

!Functionality:
The purpose of this function is to capture the [BBR_ID] from the [P2K_BE_BENEFIT_RECIPIENTS] table. Given a specific benefit [PLAN_CODE] and an as of date determine if an contact is set up as a recipient in the specified plan.

If they are then return the ID from the [P2K_BE_BENEFIT_RECIPIENTS] table. If they are not, then null will be returned.

!Parameters:
|ECT_ID        |''Required''. The ID from the P2K_HR_CONTACTS table for the person in which to the Employment ID in which the pay info is to be recovered
|PLAN_CODE     |''Required''. Plan Code from [IBPN]
|AS_OF_DATE    |''Optional''. The as of date to be used (DD-MON-YYYY) to qualify the record on the [P2K_BE_BENEFIT_RECIPIENTS] table. The Sysdate will be used if left blank.


!Returns: 
Numeric

!Errors:  
* If the recipient is not found then 0 is returned
* The contact ID cannot be found -1 is returned
* The plan cannot be found -2 is returned
* If too many recipient records are found then -3 is returned
* If no enrollments are found then -4 is returned

!Example: 

FUNCTION GET_BBR(~,'MEDICAL','01-Jan-2017')

Using the [ECT_ID] as the ~ parameter, this will return the [BBR_ID] associated to the contact if there is a record found on the [P2K_BE_BENEFIT_RECIPIENTS] table as of the date provided.

!Notes

----