Topic: Amount into Words

Hello DriveSoft!

Kindly help me to convert the amount into words in Philippine peso in the report.  Basically i already do it in the report but dollars is the result.

sample: 1,200.30 intoWords: One Thousand Two Hundred Dollars and Thirty Cents..

All i want is:

sample: 1,200.30 intoWords: One Thousand Two Hundred Pesos and Thirty Cents..

Thank!

Re: Amount into Words

HELP HELP

3 (edited by mathmathou 2017-07-17 01:13:48)

Re: Amount into Words

Hello,


Since the result is a string, before displaying the result you can try something like :

//TO WORDS
procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
    input : real;
    output : String;
begin
    input := strToFloat(Form1.Edit1.text);
    output := ToWords(input);

    Form1.Edit2.Text := ReplaceStr(output,'dollars','Pesos');
    Form1.Edit2.Text := ReplaceStr(Form1.Edit2.Text,'dollar','Pesos');
end;;

Note that I first replaced the plurial case and then the singular. If you do it reverse, you will end-up with 's' alone that would be harder to clean.


Cheers


Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Amount into Words

Thank You!

What about in the report, is this possible?

Thanks!

Re: Amount into Words

manixs2013 wrote:

Thank You!

What about in the report, is this possible?

Thanks!

Yes, an example:

procedure Memo1OnAfterData(Sender: TfrxComponent);
begin
   Memo1.Text := ReplaceStr(<Report."tablename.amount">, 'dollars', 'Pesos');  
end;
Dmitry.

Re: Amount into Words

THANKS DRIVESOFT!