Wednesday, 1 June 2022

Absence Reason validation in Absence Entry Validation formula

 /******************************************************************************
FORMULA NAME: GSE_PRGUS_BEREAVEMENT_VALIDATION
FORMULA TYPE: Global Absence Entry Validation
DESCRIPTION: This formula validates the bereavement absence entry.  Allow
             a certain number of days for immediate family and fewer days
             for non-immediate family.
*******************************************************************************/
DEFAULT FOR IV_START_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_END_DATE IS '4712/12/31 00:00:00' (date)
DEFAULT FOR IV_ABSENCE_REASON IS ' '
DEFAULT FOR IV_TOTALDURATION  IS 0
DEFAULT_DATA_VALUE for ANC_PER_ABS_ENTRS_ABSENCE_ENTRY_ID_ARR is 0
DEFAULT FOR ANC_ABS_ENTRS_ABSENCE_TYPE_ID is 0
DEFAULT FOR ANC_ABS_ENTRS_ABSENCE_STATUS_CD IS ' '
DEFAULT FOR ANC_ABS_TYP_NAME IS ' '
DEFAULT FOR ANC_ABS_ENTRS_END_DATE IS '4712/12/31 00:00:00' (date)
INPUTS ARE IV_END_DATE (date), IV_START_DATE (date), IV_ABSENCE_REASON, IV_TOTALDURATION
lc_absence_reason1 = 'Immediate Family'
lc_absence_reason2 = 'Other Relative/Friend'
lc_valid           = 'N'
if IV_ABSENCE_REASON = lc_absence_reason1 then
  (if IV_TOTALDURATION > 40 then
     (lc_valid = 'N'
      ERROR_MESSAGE = 'GSE_PRGUS_ANC_BEREAVEMENT_IF')
   else
      (lc_valid = 'Y')
  )
if IV_ABSENCE_REASON = lc_absence_reason2 then
  (if IV_TOTALDURATION > 24 then
     (lc_valid = 'N'
      ERROR_MESSAGE = 'GSE_PRGUS_ANC_BEREAVEMENT_OT')
   else
      (lc_valid = 'Y')
  )

VALID = lc_valid

if lc_valid = 'N' then
(ERROR_CODE    = 'E'
 RETURN VALID, ERROR_MESSAGE, ERROR_CODE)
ELSE
(RETURN VALID)

No comments:

Post a Comment