3 Replies Latest reply on May 25, 2012 6:22 AM by MichaelVoccola

# Printing Check Payments

### Title

Printing Check Payments

### Post

I am working on a portion of database that will be used to print checks. All is well thus far, aside from a slight roadblock - spelling out the amount of the payment. Any suggestions to approaching this?

• ###### 2. Re: Printing Check Payments

http://www.briandunning.com/cf/106

Case(NumberIn = 0; "";

Let ( [
FullNumber = GetAsNumber( numberin );
Number = Int( FullNumber );
len = If ( Number = 0 ; 0 ; Int(Log(Number)) + 1 )
] ;
Case(len > 15;
"Out of Range";
Currency = "EvalOnly";
Let([
Hundred = Left(number; 1);
TensOnes = Right(number; 2);
TONum = GetAsNumber(TensOnes);
Tens = Left(TensOnes; 1);
Ones = If( TONum < 20; TensOnes; Right(TensOnes; 1))
];
Case(len = 3;
Choose(hundred; ""; "One"; "Two"; "Three"; "Four "; "Five"; "Six"; "Seven"; "Eight"; "Nine") & " Hundred" & Case(TONum≠0;" "))
& Case(TONum > 19;
Choose(tens; ""; ""; "Twenty"; "Thirty"; "Forty"; "Fifty"; "Sixty"; "Seventy"; "Eighty"; "Ninety") & Case(Ones ≠ 0; " "))
& Choose(ones; ""; "One"; "Two"; "Three"; "Four "; "Five"; "Six"; "Seven"; "Eight"; "Nine"; "Ten"; "Eleven"; "Twelve"; "Thirteen"; "Fourteen"; "Fifteen"; "Sixteen"; "Seventeen"; "Eighteen"; "Nineteen")
);

Case(len >3;
Let([
UseLeft = Choose(Mod(len;  3);3; 1; 2);
NewLen= 10 ^ (len - UseLeft);
ThisValue = Div(number; NewLen);
NewValue = Number - ThisValue * NewLen
];
NumberInWords ( ThisValue; "EvalOnly"; "None" ) & " " & Choose( Div(len - 1; 3); ""; "Thousand"; "Million"; "Billion"; "Trillion" ) & Case(NewValue ≠ 0;" " & NumberInWords(NewValue; ""; "None"))
);
len = 0; "Zero" ;
NumberInWords(Number; "EvalOnly"; "None")) & Case(currency ≠ ""; " " & Currency)
&  Case(DecimalCurr ≠ "None"; " and "
& Let(
Decimal = Int(100 * (fullnumber - number));
If(Decimal = 0; "Zero"; NumberInWords(Decimal; "EvalOnly"; "None"))) & " " & DecimalCurr))
))

• ###### 3. Re: Printing Check Payments

Got it, thanks!