CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 How do i to Convert Currency or Numbers into English Words

Print topic Send  topic

Author Message
charles

Posts: 59
Posted: 10/02/2006, 9:00 PM

hi folks,
i despaerately need to get this to work in my codecharge studio application.
I have a page that generates payment vouchers with a grid which dispays total amount payable.I need to translate these numbers to text ,for example, if the number says 55,234 ,i want a label to dispay 'fifty five thousand, two hundred and thirty four'.
I saw a function on ms kb site,Function ConvertCurrencyToEnglish (ByVal MyNumber) that performs this task but i dont know how to make it work in a codecharge environment.
Has anyone travelled this road before?
Please kindly help out
regards,
charles

View profile  Send private message
Edd


Posts: 547
Posted: 10/03/2006, 8:11 AM

Try

http://classicasp.aspfaq.com/general/how-do-i-convert-n...into-words.html


Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
charles

Posts: 59
Posted: 10/04/2006, 8:21 PM

Thanks for your response.
I followed the link and obtained the following function

dim ss
dim ds
dim ts
dim qs
dim a
dim i
dim ii
dim s
dim b

ss = "one,two,three,four,five,six,seven,eight,nine"
ds = "ten,eleven,twelve,thirteen,fourteen,fifteen,sixteen," & _
"seventeen,eighteen,nineteen"
ts = "twenty,thirty,forty,fifty,sixty,seventy,eighty,ninety"
qs = ",thousand,million,billion"

Function nnn2words(iNum)

a = split(ss,",")
i = iNum mod 10
if i > 0 then s = a(i-1)
ii = int(iNum mod 100)\10
if ii = 1 then
s = split(ds,",")(i)
elseif ((ii>1) and (ii<10)) then
s = split(ts,",")(ii-2) & " " & s
end if
i = (iNum \ 100) mod 10
if i > 0 then s = a(i-1) & " hundred " & s
nnn2words = s
End Function

Function num2words(iNum)

i = iNum
if i < 0 then b = true: i = i*-1
if i = 0 then
s="zero"
elseif i <= 2147483647 then
a = split(qs,",")
for j = 0 to 3
iii = i mod 1000
i = i \ 1000
if iii > 0 then s = nnn2words(iii) & _
" " & a(j) & " " & s
next
else
s = "out of range value"
end if
if b then s = "negative " & s
num2words = trim(s)
End Function

i then added a label2 to my page.On the label's default value,i inserted the following:num2words(label1.value)
The problem is that th code converts everything as 'zero'.
Can Somebody kindly look at my code and see what could be wrong?
Thanks in advance.
View profile  Send private message
Edd


Posts: 547
Posted: 10/30/2006, 4:52 AM

Duplicate Post
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.