project QadFinancials > class TSetStatutoryCurrency > method RoundSCAmount

function returns decimal

Description

Round the amounts passed to the method based on the rounding method linked to the new Statutory Currency.


Parameters


idUnroundedAmountinputdecimalUnrounded SC Amount


Internal usage


QadFinancials
method TSetStatutoryCurrency.PostingForBankCashEntry
method TSetStatutoryCurrency.PostingForCDocument
method TSetStatutoryCurrency.PostingForDDocument
method TSetStatutoryCurrency.PostingLineCCUpdate
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCAPM
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCAPMTax
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCCDocument
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCCInvoice
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCDDocument
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCDet1
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCDInvoice
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCDPaySel
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCOIAdjust
method TSetStatutoryCurrency.SetStatutoryCurrencyBasedOnTCWht


program code (program1/tsetstatutorycurrency.p)

ROUNDBLOCK:
DO :
    /* ============================ */                                  
    /* Calculate the rounded amount */
    /* ============================ */
    /* Check if amount is negative. Make it positive */
    if idUnroundedAmount < 0
    then assign vlAmountIsNegative = true
                idUnroundedAmount  = idUnroundedAmount * -1.
    else assign vlAmountIsNegative = false.
    
    /* Get the truncated amount */
    assign vdTruncatedAmount = trunc(idUnroundedAmount / vdRoundingMethodUnit, 0) * vdRoundingMethodUnit.
    
    /* Get the remainder amount */
    assign vdRemainderAmount = idUnroundedAmount - vdTruncatedAmount.
    
    if vdRemainderAmount >= vdRoundingMethodThreshold
    then assign vdRoundedAmount = vdTruncatedAmount + vdRoundingMethodUnit.
    else assign vdRoundedAmount = vdTruncatedAmount.
    
    /* Reset the correct sign */
    if vlAmountIsNegative = true
    then return vdRoundedAmount * -1.
    else return vdRoundedAmount.
END. /* ROUNDBLOCK */