3 Replies Latest reply on Jan 31, 2013 7:25 AM by igwe

    Proration adding + or - 0.01 or more

      I have an element whose pay value is entered manually. This element is also prorated just in case the value changes mid month.
      The problem I have is, when there are a large number of proration of events (say absence requests, table value change) in a given month, I don't always get the exact figure entered manually. Say the value I entered is 4000, when it prorates I could end up with 3999.99 or 4000.02 e.t.c.
      Is there any way to prevent this from occuring?
        • 1. Re: Proration adding + or - 0.01 or more
          Vigneswar Battu
          Can you not use a ROUND() function ?
          • 2. Re: Proration adding + or - 0.01 or more
            I used the round function but that makes it even worse. Instead of a 0.01 difference or thereabouts, I sometimes end up with a whole number difference
            • 3. Re: Proration adding + or - 0.01 or more
              Found a temporary solution that works.

              First I wrote a function, GET_ELEMENT_INFO, that checks if the element is a standard element, and that the Payment Amount input value has changed or not changed in the current period.
              If the element hasn't changed, I simply get the current balance and subtract it from the total payment amount.
              Problem solved.
              I did it for 5 elements since we have 5 standard elements. If element changes mid month, then this block is ignored.

              In proration formula:

              /* grossup check */

              l_period_end_value = 0
              l_standard_flag = 'N'
              l_call = 0
              l_calc_amount = 0
              l_changed_in_period = 'N'
              AMOUNT_REM = 0
              l_call = GET_ELEMENT_INFO(ELEMENT_NAME, 'Payment Amount', PAY_PROC_PERIOD_END_DATE, l_period_end_value, l_standard_flag, l_changed_in_period, l_calc_amount)
              IF (l_standard_flag = 'Y') and (l_changed_in_period = 'N') THEN
              IF (ELEMENT_NAME = 'KSA Basic Salary') THEN
              IF (ELEMENT_NAME = 'KSA Transport Allowance') THEN
              /* l_period_end_value, value of element input value at the end of the payroll period */
              PAY_VALUE = l_period_end_value - AMOUNT_CALCULATED
              RETURN PAY_VALUE
              /* change final prorated amount to match */
              /* end gross up check */