function returns decimal
Description
Round the amounts passed to the method based on the rounding method linked to the new Statutory Currency.
Parameters
idUnroundedAmount | input | decimal | Unrounded SC Amount |
Internal usage
QadFinancials
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 */