ncgjiju
27th May 2005, 11:30
Is there any function in baan that convert numbers to words . What is the best way to convert numbers to words. Please advise.


regards,

George

Debdas Banerjee
27th May 2005, 11:58
Hi,

U have to write the code accourding to ur requirement. if u need the code i can provide the same.



Regards

Juergen
27th May 2005, 12:43
Hi,

in IVc4 you can have a look to the amount to words routine in function tfcmg0005 (Decode amount). Don`t know if something similar is available for newer Baan versions.

Juergen

ncgjiju
27th May 2005, 12:55
Hi Deb ,

Could please give me the code?. Thanks for your help.

regards,

George

vahdani
27th May 2005, 13:18
Hi,

for usage example of this fuction look into the Cheque (or is it Check?) report.

ncgjiju
27th May 2005, 13:56
It is for printing customised report in baan

Debdas Banerjee
27th May 2005, 14:16
|This is the code for converting make it function and call from session


string itdind0003.desc(15,13)

function itdind0003.decode ( domain tfgld.amnt amount,
domain tcbool decimals,
ref domain tcmcs.s130m decode0,
ref domain tcmcs.st65m decode1,
ref domain tcmcs.st65m decode2,
ref domain tcmcs.st20m decode3)
{
string decode.hundred(15)
string decode.thousand(15)
string decode.lacs(15)
string decode.crore(15)
string decode.paise(15)
string decode.and(15)
string amount.str(14)

decode0 = ""
decode1 = ""
decode2 = ""
decode3 = ""
if amount = 0 then
decode0 = form.text$("tfcmgs0158") |"zero"
else
decode.hundred = ""
decode.thousand = ""
decode.lacs = ""
decode.crore = ""
decode.paise = ""
decode.and = ""
e = set.mem(itdind0003.desc,"")
amount.str = edit$(amount, "99999999999V99")
if not decimals then
amount.str(12;2) = "00"
endif
itdind0003.decode.procedure(amount.str,decode.hundred,
decode.thousand,decode.lacs,decode.crore,
decode.paise,decode.and)
itdind0003.form.a.string(decode.hundred,decode.thousand,
decode.lacs,decode.crore,
decode.paise,decode.and,decode0,decode3)
endif
decode0 = toupper$(shiftl$(decode0))
itdind0003.break.the.string(decode0,decode1,decode2)
decode1 = toupper$(shiftl$(decode1))
decode2 = toupper$(shiftl$(decode2))
decode3 = toupper$(shiftl$(decode3))
}

|++++++++++++++++++++++++++ decode procedure +++++++++++++++++++++++++++

function itdind0003.decode.procedure( string amount.str(14),
ref string decode.hundred(),
ref string decode.thousand(),
ref string decode.lacs(),
ref string decode.crore(),
ref string decode.paise(),
ref string decode.and())
{
long digit
long positions
long mult
long number

digit = 1
while digit < 14
positions = 1
mult = 1
if (digit = 3 or digit = 5 or digit = 7 or digit = 10 or
digit = 12) and val(amount.str(digit;1)) <> 0 then
if val(amount.str(digit;1)) = 1 then
positions = 2
else
mult = 10
endif
endif
number = val(amount.str(digit;positions)) * mult
if number > 0 then
itdind0003.search.desc(number,digit)
endif
digit = digit + positions
endwhile
decode.hundred = form.text$("tfcmgs0186") |"hundred"
decode.thousand = form.text$("tfcmgs0188") |"thousand"
decode.lacs = form.text$("tdinds0101") |"lacs"
decode.crore = form.text$("tdinds0102") |"crore"
decode.paise = form.text$("tdinds0103") |"paise"
if language$ <> "2" and language$ <> "u" then
decode.and = form.text$("tfcmgs0187") |"and"
endif
}

function itdind0003.search.desc(long number,
long digit)
{
on case number

case 1:
itdind0003.desc(1,digit) = form.text$("tfcmgs0159")
break
case 2:
itdind0003.desc(1,digit) = form.text$("tfcmgs0160")
break
case 3:
itdind0003.desc(1,digit) = form.text$("tfcmgs0161")
break
case 4:
itdind0003.desc(1,digit) = form.text$("tfcmgs0162")
break
case 5:
itdind0003.desc(1,digit) = form.text$("tfcmgs0163")
break
case 6:
itdind0003.desc(1,digit) = form.text$("tfcmgs0164")
break
case 7:
itdind0003.desc(1,digit) = form.text$("tfcmgs0165")
break
case 8:
itdind0003.desc(1,digit) = form.text$("tfcmgs0166")
break
case 9:
itdind0003.desc(1,digit) = form.text$("tfcmgs0167")
break
case 10:
itdind0003.desc(1,digit) = form.text$("tfcmgs0168")
break
case 11:
itdind0003.desc(1,digit) = form.text$("tfcmgs0169")
break
case 12:
itdind0003.desc(1,digit) = form.text$("tfcmgs0170")
break
case 13:
itdind0003.desc(1,digit) = form.text$("tfcmgs0171")
break
case 14:
itdind0003.desc(1,digit) = form.text$("tfcmgs0172")
break
case 15:
itdind0003.desc(1,digit) = form.text$("tfcmgs0173")
break
case 16:
itdind0003.desc(1,digit) = form.text$("tfcmgs0174")
break
case 17:
itdind0003.desc(1,digit) = form.text$("tfcmgs0175")
break
case 18:
itdind0003.desc(1,digit) = form.text$("tfcmgs0176")
break
case 19:
itdind0003.desc(1,digit) = form.text$("tfcmgs0177")
break
case 20:
itdind0003.desc(1,digit) = form.text$("tfcmgs0178")
break
case 30:
itdind0003.desc(1,digit) = form.text$("tfcmgs0179")
break
case 40:
itdind0003.desc(1,digit) = form.text$("tfcmgs0180")
break
case 50:
itdind0003.desc(1,digit) = form.text$("tfcmgs0181")
break
case 60:
itdind0003.desc(1,digit) = form.text$("tfcmgs0182")
break
case 70:
itdind0003.desc(1,digit) = form.text$("tfcmgs0183")
break
case 80:
itdind0003.desc(1,digit) = form.text$("tfcmgs0184")
break
case 90:
itdind0003.desc(1,digit) = form.text$("tfcmgs0185")
break
default:
endcase
}

|++++++++++++++++++++++++++ form string +++++++++++++++++++++++++++

function itdind0003.form.a.string( string decode.hundred(15),
string decode.thousand(15),
string decode.lacs(15),
string decode.crore(15),
string decode.paise(15),
string decode.and(15),
ref domain tcmcs.s130m decode0,
ref domain tcmcs.st20m decode3)
{
long digit
long positions

digit = 1
while digit < 14
positions = 1
if digit = 1 or digit = 5 or digit = 7 or digit = 10 then
decode0 = itdind0003.process.10s(digit,decode0,
decode.and)
decode0 = itdind0003.lacs.thou(digit,decode.thousand,
decode.lacs,decode.crore,decode0)
positions = 2
endif
if (digit = 2 or digit = 9) and not isspace(
itdind0003.desc(1,digit)) then
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit)) & " " &
strip$(decode.hundred)
endif
if digit = 4 then
if not isspace(itdind0003.desc(1,digit)) then
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit))& " " &
strip$(decode.crore)
else
if not isspace(itdind0003.desc(1,digit-1)) or
not isspace(itdind0003.desc(1,digit-2)) or
not isspace(itdind0003.desc(1,digit-3)) then
decode0 = strip$(decode0) & " " &
strip$(decode.crore)
endif
endif
endif
if (digit = 3) then
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit))
endif
if digit = 12 then
decode3 = itdind0003.process.decimals(digit,
decode.and,decode.paise,decode3)
positions = 2
endif
if digit = 1
then
digit = digit + 1
else
digit = digit + positions
endif
endwhile
}

function domain tcmcs.s130m itdind0003.process.10s( long digit,
domain tcmcs.s130m decode0,
string decode.and(15))
{
if isspace(itdind0003.desc(1,digit)) or isspace(itdind0003.desc(1,digit
+ 1)) then
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit)) &
strip$(itdind0003.desc(1,digit + 1))
if digit = 1 and not isspace(itdind0003.desc(1,2)) then
decode0 = " "
endif
else
if language$ = "2" or language$ = "u" then
if digit = 1 and not isspace(itdind0003.desc(1,2)) then
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit + 1))
else
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit)) & " " &
strip$(itdind0003.desc(1,digit + 1))
endif
else
decode0 = strip$(decode0) & " " &
strip$(itdind0003.desc(1,digit + 1)) & " " &
strip$(decode.and) & " " &
strip$(itdind0003.desc(1,digit))
endif
endif
return(decode0)
}

function domain tcmcs.s130m itdind0003.lacs.thou( long digit,
string decode.thousand(15),
string decode.lacs(15),
string decode.crore(15),
domain tcmcs.s130m decode0)
{
if digit = 1 and not isspace(itdind0003.desc(1,digit)) then
decode0 = strip$(decode0) & " " & strip$(decode.thousand)
endif
if digit = 7 and (not isspace(itdind0003.desc(1,digit)) or
not isspace(itdind0003.desc(1,digit + 1))) then
decode0 = strip$(decode0) & " " &
strip$(decode.thousand)
endif
if digit = 5 and not isspace(itdind0003.desc(1,digit)) then
decode0 = strip$(decode0) & " " &
strip$(decode.lacs)
else
if digit = 5 and not isspace(itdind0003.desc(1,digit+1)) then
decode0 = strip$(decode0) & " " &
strip$(decode.lacs)
endif
endif
return(decode0)
}

function domain tcmcs.st20m itdind0003.process.decimals(long digit,
string decode.and(15),
string decode.paise(15),
ref domain tcmcs.st20m decode3)
{
if isspace(itdind0003.desc(1,digit)) or isspace(itdind0003.desc(1,digit
+ 1)) then
decode3 = strip$(decode3) & " " &
strip$(decode.paise) & " " &
strip$(itdind0003.desc(1,digit)) &
strip$(itdind0003.desc(1,digit + 1))
else
if language$ = "2" or language$ = "u" then
decode3 = strip$(decode3) & " " &
strip$(decode.paise) & " " &
strip$(itdind0003.desc(1,digit)) & " " &
strip$(itdind0003.desc(1,digit + 1))
else
decode3 = strip$(decode3) & " " &
strip$(itdind0003.desc(1,digit + 1)) &
" " & strip$(decode.and) & " " &
strip$(itdind0003.desc(1,digit))
endif
endif
if isspace(itdind0003.desc(1,digit)) and
isspace(itdind0003.desc(1,digit+1)) then
decode3 = " "
endif
return(decode3)
}

function itdind0003.break.the.string( domain tcmcs.s130m decode0,
ref domain tcmcs.st65m decode1,
ref domain tcmcs.st65m decode2)
{
long digit

digit = 65
while digit > 0
if isspace(decode0(digit;1)) then
decode1 = decode0(1;digit)
decode2 = decode0(digit;65)
digit = 1
endif
digit = digit - 1
endwhile
}

********
** How to use this code if script

extern domain bssrt60 amt1,amt2,amt3

itdind0003.decode(abs(amount),true,amt1,amt2,amt3)

**********

Hope it will work for u

darpan
27th May 2005, 14:37
We can call this function and the work will be done

#include "itcmcs0010" | Calculate and Round Functions

tccom.dllc001.decode (total_amnt,true,decode0,decode1,decode2,decode3)

extern domain tcmcs.st20m decode3
extern domain tcmcs.s130m decode0
extern domain tcmcs.st65m decode1
extern domain tcmcs.st65m decode2

decode0 = ""
decode1 = ""
decode2 = ""
decode3 = ""

It should work instead of tha big code

Regards

Darpan Bhansali
91-9312491353
New Delhi