piku
piku

Reputation: 613

numeralsToTxt() method in Axapta

When i am trying to print info(numeralsToTxt(3492.4069)); It give me the out put as *** Three Thousand Four Hundred Ninety Two and 41/100. Now I want it to be *** Three Thousand Four Hundred Ninety Two and 406/1000 when i check the method numeralsToTxt() I find the function frac() returns .41

Please help.

Upvotes: 0

Views: 813

Answers (1)

SShaheen
SShaheen

Reputation: 1013

frac() is not returning .41. It is decRound(frac(_num), 2) which is returning .41. The second argument to the decRound method is the number of decimal places you want.

What you could do is change

int numOfPennies = (decRound(frac(_num), 2) * 100) mod 100;

to

int numOfPennies = (decRound(frac(_num), 3) * 1000) mod 1000;

Then, change the output string at the bottom of the numeralsToTxt method to display '/1000' instead of '/100'

The actual output will be 407/1000, not 406/1000 because it will round up.

Upvotes: 1

Related Questions