Edit the Fast Formula for Travel Pass

You need to change the fast formula that was automatically generated from the element creation.

Fastpath: My Client Groups > Show More > Fast Formulas
  1. Search for and select the fast formula IE Travel Pass Earnings.
  2. Add the default values as shown here:
    DEFAULT FOR Unique_Reference is '0'
    DEFAULT FOR Override_Amount is 0
    DEFAULT FOR Choice is 'ABC'
    DEFAULT FOR RG_TRAVEL_PASS_OPENING_BALANCE_ASG_RC_ITD IS 0
    DEFAULT FOR RG_TRAVEL_PASS_ASG_RC_ITD IS 0
    DEFAULT FOR GROSS_PAY_REL_TU_RUN is 0
    DEFAULT FOR RG_IE_SALARY_SACRIFICE_REL_TU_RUN is 0
  3. Make these changes to the formula.
    • Add new input values.
      , Unique_Reference(text)
      , Override_Amount
      , Choice
    • Initialize the local variables.
      l_opening_bal = 0
      l_repaid = 0
      l_initial_debt = 0
      l_stop = 'N'
      l_cb_id = GET_CONTEXT(CALC_BREAKDOWN_ID, 1)
      l_gross_pay = 0
      l_salsac = 0
      l_amount = 0
      if Override_Amount was not defaulted then
        l_amount = Override_Amount
      else
        l_amount = to_number(get_table_value('RG_TRAVEL_PASS_CHOICES','RATE',Choice,PAY_EARN_PERIOD_END))
      l_log = PAY_INTERNAL_LOG_WRITE(' Choice/Override Amount: '||to_char(l_amount))
    • If there’s an override amount, you need to get the amount from the user-selected choice.
      l_opening_bal = 0
      l_repaid = 0
      l_initial_debt = 0
      l_stop = 'N'
      l_cb_id = GET_CONTEXT(CALC_BREAKDOWN_ID, 1)
      l_gross_pay = 0
      l_salsac = 0
      l_amount = 0
      if Override_Amount was not defaulted then
        l_amount = Override_Amount
      else
        l_amount = to_number(get_table_value('RG_TRAVEL_PASS_CHOICES','RATE',Choice,PAY_EARN_PERIOD_END))
      l_log = PAY_INTERNAL_LOG_WRITE(' Choice/Override Amount: '||to_char(l_amount))
    • To set the context to the current unique reference.
      CHANGE_CONTEXTS (REFERENCE_CODE = Unique_Reference )
      (
        l_opening_bal = RG_TRAVEL_PASS_OPENING_BALANCE_ASG_RC_ITD
        l_repaid_bal = RG_TRAVEL_PASS_ASG_RC_ITD * -1
      )
    • To get the opening and accrued balance values.

      (
        l_opening_bal = RG_TRAVEL_PASS_OPENING_BALANCE_ASG_RC_ITD
        l_repaid_bal = RG_TRAVEL_PASS_ASG_RC_ITD * -1
      )
    • To get the gross earnings for the current calculation breakdown ID.

      CHANGE_CONTEXTS (CALC_BREAKDOWN_ID = l_cb_id)
      (
        l_gross_pay = GROSS_PAY_REL_TU_RUN
        l_salsac = RG_IE_SALARY_SACRIFICE_REL_TU_RUN
      )
    • To identify the correct amount to use.

      if l_opening_bal = 0 then
        l_initial_debt = l_amount
      else
        l_amount = l_opening_bal
    • To avoid a negative net amount.

        l_log = PAY_INTERNAL_LOG_WRITE('(GLBEARN) Derived value : '||TO_CHAR(l_value))
        
        if GET_PLED_LSED <= PAY_EARN_PERIOD_END then
          l_value = l_opening_bal + l_initial_debt - l_repaid_bal 
      	
        if l_value > l_gross_pay + l_salsac then
        (
          l_value = l_gross_pay + l_salsac
      	mesg = 'Not enough earnings, so Travel Pass (Ref: '||Unique_Reference||') deducted partially'
    • To check if the outstanding amount is paid off.
        l_log = PAY_INTERNAL_LOG_WRITE('l_value v1: '||TO_CHAR(l_value))
        
        if l_value + l_repaid_bal > l_opening_bal + l_initial_debt then
        (
          l_value = l_opening_bal + l_initial_debt - l_repaid_bal 
        )	
         
        if l_value + l_repaid_bal = l_opening_bal + l_initial_debt then
        (
          l_stop = 'Y'
      	mesg = 'Travel Pass (Ref: '||Unique_Reference||') has been fully repaid'
        )
        
      else if GET_PLED_LSED <= PAY_EARN_PERIOD_END and l_value + l_repaid_bal < l_opening_bal + l_initial_debtthen
        (
          mesg = 'Employee terminated, please process outstanding Travel Pass (Ref: '||Unique_Reference||') amount offline'
    • Convert the earnings to negative because it’s a salary sacrifice.

        l_log = PAY_INTERNAL_LOG_WRITE('l_value v2: '||TO_CHAR(l_value))
        
        l_value = l_value * -1
    • Return various result values based on the scenario.
      if l_stop = 'Y' and l_initial_debt <> 0 then
          return l_value,l_hours,l_days,l_reduce,l_reduce_hours,l_reduce_days,l_reduce_abs,l_reduce_abs_hours ,l_reduce_abs_days ,mesg, l_stop, l_initial_debt
        if l_stop = 'Y' then
          return l_value,l_hours,l_days,l_reduce,l_reduce_hours,l_reduce_days,l_reduce_abs,l_reduce_abs_hours ,l_reduce_abs_days ,mesg, l_stop
        if l_initial_debt <> 0 then
          RETURN l_value,l_hours,l_days,l_reduce,l_reduce_hours,l_reduce_days,l_reduce_abs,l_reduce_abs_hours ,l_reduce_abs_days ,mesg, l_initial_debt
      	
        RETURN l_value,l_hours,l_days,l_reduce,l_reduce_hours,l_reduce_days,l_reduce_abs,l_reduce_abs_hours ,l_reduce_abs_days ,mesg
      )
      ELSE /* Grossup Processing  Begin */
  4. Save your changes.