AnsweredAssumed Answered

Calculate a new price in whole dollars

Question asked by neildecort on May 14, 2017
Latest reply on May 25, 2017 by neildecort

Hi,

 

I've inherited an FM12 database which converts a United States Dollar price to a rounded Canadian Dollar price:

 

Priceamount06=

If (PriceAmount02="";"";

Let( [

convertedAmount = (PriceAmount02 * Priceamount06exchangerate) ;

remainder = Mod( convertedAmount ; 1 )

] ;

 

Case(

(remainder > .475) and (remainder ≤ .95) ;

Round( convertedAmount - remainder ; 0 ) + .95 ;

 

remainder > .95 ;

Round( convertedAmount - remainder ; 0 ) + .95 ;

 

Round( convertedAmount - remainder ; 0 ) - .05

 

)

 

))

 

Where Priceamount06 is the CAD price, Priceamount02 is the USD price and Priceamount06exchangerate is the conversion rate.

This works fine, but recently I have discovered that if the USD price is a round figure (eg. $45.00) then the CAD price needs to be a round figure too; this calculation always gives a $@@.95 price. Being a novice at this I can't see how I can adjust this so that a $@@.95 USD price gives a $@@.95 CAD price, and a $@@.00 USD price gives a $@@.00 CAD one.

 

Can any one please help?

Thank you.

Outcomes