Hello this is from US Check 1401. The following two function will create the amount into word
FormatNoText(VAR NoText : ARRAY [2] OF Text[80];No : Decimal;CurrencyCode : Code[10])
CLEAR(NoText);
NoTextIndex := 1;
NoText[1] := '****';
IF No < 1 THEN
AddToNoText(NoText,NoTextIndex,PrintExponent,Text026)
ELSE BEGIN
FOR Exponent := 4 DOWNTO 1 DO BEGIN
PrintExponent := FALSE;
Ones := No DIV POWER(1000,Exponent - 1);
Hundreds := Ones DIV 100;
Tens := (Ones MOD 100) DIV 10;
Ones := Ones MOD 10;
IF Hundreds > 0 THEN BEGIN
AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Hundreds]);
AddToNoText(NoText,NoTextIndex,PrintExponent,Text027);
END;
IF Tens >= 2 THEN BEGIN
AddToNoText(NoText,NoTextIndex,PrintExponent,TensText[Tens]);
IF Ones > 0 THEN
AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Ones]);
END ELSE
IF (Tens * 10 + Ones) > 0 THEN
AddToNoText(NoText,NoTextIndex,PrintExponent,OnesText[Tens * 10 + Ones]);
IF PrintExponent AND (Exponent > 1) THEN
AddToNoText(NoText,NoTextIndex,PrintExponent,ExponentText[Exponent]);
No := No - (Hundreds * 100 + Tens * 10 + Ones) * POWER(1000,Exponent - 1);
END;
END;
AddToNoText(NoText,NoTextIndex,PrintExponent,Text028);
AddToNoText(NoText,NoTextIndex,PrintExponent,FORMAT(No * 100) + '/100');
IF CurrencyCode <> '' THEN
AddToNoText(NoText,NoTextIndex,PrintExponent,CurrencyCode)
ELSE
AddToNoText(NoText,NoTextIndex,PrintExponent,Text1020000);
AddToNoText(VAR NoText : ARRAY [2] OF Text[80];VAR NoTextIndex : Integer;VAR PrintExponent : Boolean;AddText : Text[30])
PrintExponent := TRUE;
WHILE STRLEN(NoText[NoTextIndex] + ' ' + AddText) > MAXSTRLEN(NoText[1]) DO BEGIN
NoTextIndex := NoTextIndex + 1;
IF NoTextIndex > ARRAYLEN(NoText) THEN
ERROR(Text029,AddText);
END;
NoText[NoTextIndex] := DELCHR(NoText[NoTextIndex] + ' ' + AddText,'<');
Here is text constants
Name ConstValue
Text026 ZERO
Text027 HUNDRED
Text028 AND
Name ConstValue
Text032 ONE
Text033 TWO
Text034 THREE
Text035 FOUR
Text036 FIVE
Text037 SIX
Text038 SEVEN
Text039 EIGHT
Text040 NINE
Text041 TEN
Text042 ELEVEN
Text043 TWELVE
Text044 THIRTEEN
Text045 FOURTEEN
Text046 FIFTEEN
Text047 SIXTEEN
Text048 SEVENTEEN
Text049 EIGHTEEN
Text050 NINETEEN
Text051 TWENTY
Text052 THIRTY
Text053 FORTY
Text054 FIFTY
Text055 SIXTY
Text056 SEVENTY
Text057 EIGHTY
Text058 NINETY
Text059 THOUSAND
Text060 MILLION
Text061 BILLION
Name ConstValue
Text1020000 DOLLARS
Answers
But for English, here is a link to a VBA Macro for Excel:
http://www.ozgrid.com/VBA/ValueToWords.htm
Maybe you can adapt this to C/AL.
Here is text constants
And here is how you use it.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Freelance Dynamics AX
Blog : http://axnmaia.wordpress.com/
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Is it a record or a text in c/al globals ?