ncgjiju
8th November 2016, 08:00
how to convert no to words

sachinbaan
8th November 2016, 08:37
You can use standard dll,

tcmcs.dll0006.decode()

baanhp
8th November 2016, 12:45
function decode.amount()
{
tcmcs.dll0006.decode(order.total, false, amount.desc,
amount.desc1,amount.desc2,amount.desc3)

add.indian.decimals()
if isspace(amount.desc3) and
isspace(amount.desc2) then
|* Only one line of amount description.
amount.desc1 = shiftr$(amount.desc1)
amount.desc1 = shiftl$(amount.desc1)
else
if isspace(amount.desc3) then
|* Two lines of amount description.
amount.desc1 = shiftr$(amount.desc1)
amount.desc1 = shiftl$(amount.desc1)
amount.desc2 = shiftr$(amount.desc2)
amount.desc2 = shiftl$(amount.desc2)
amount.desc2 = toupper$(amount.desc2)
else
|* Three lines of amount description.
amount.desc1 = shiftr$(amount.desc1)
amount.desc1 = shiftl$(amount.desc1)
amount.desc2 = shiftr$(amount.desc2)
amount.desc2 = shiftl$(amount.desc2)
amount.desc2 = toupper$(amount.desc2)
amount.desc3 = shiftr$(amount.desc3)
amount.desc3 = shiftl$(amount.desc3)
amount.desc3 = toupper$(amount.desc3)
endif
endif
amount.desc1 = toupper$(amount.desc1)
}

function add.indian.decimals()
{
long dec.part
double dec.amount

string decimal.desc(65)

|* Get cheque amount decimal part.
dec.part = round((order.total * 100) \ 100,0,1)
dec.amount = dec.part * 1.0

|* Decode decimal part to words.
if (dec.part = 0) then
|* Decimal part is zero.
decimal.desc = ""
else
tcmcs.dll0006.decode(dec.amount, false, idec.desc,
idec.desc1,idec.desc2, idec.desc3)
decimal.desc = " and PAISA " & trim$(idec.desc)
endif

|* Add decimal part to amount description and break into 3 parts.
full.desc = trim$(amount.desc) & " " & trim$(decimal.desc) & " ONLY"

| message("amount.desc1 %s",amount.desc1)
amount.desc2 = trim$(amount.desc2)
amount.desc1 = trim$(amount.desc1)
break.string.55(full.desc, amount.desc1, amount.desc2, amount.desc3)


| message("amount.desc1 %s",amount.desc1)
amount.desc1 = toupper$(amount.desc1)
amount.desc2 = toupper$(amount.desc2)
final.amount = trim$(amount.desc1) & " " & trim$(amount.desc2)

| message("full.desc %s",full.desc)

}

function break.string.55( domain tcmcs.str215m decode0,
ref domain tcmcs.st65m decode1,
ref domain tcmcs.st65m decode2,
ref domain tcmcs.st65m decode3)
{
|* This function will break the string decode0 into 2 other strings decode1
|* decode2 and decode3 if there is a space between them. This space should be
|* between the 1st and the 55th position

domain tcmcs.long digit
domain tcmcs.s130m hold.decode0
domain tcmcs.long code.len

|******************************************************************************
|* An asterisk is placed at the beginning and end of the decode1 string in the
|* calling procedure, so two spaces must be reserved for them.
|******************************************************************************
digit = 53

decode0 = trim$(decode0)
decode1 = ""
decode2 = ""
decode3 = ""

|* Decode first string.
code.len = len(decode0)
if (digit >= code.len) then
|* Full description will fit into first string.
decode1 = decode0
return
endif

while digit > 0
if isspace(decode0(digit; 1)) then
decode1 = decode0(1; digit)
hold.decode0 = decode0(digit + 1; code.len - digit)
digit = 1
endif
digit = digit - 1
endwhile

|* Decode second and third strings.
digit = 53
code.len = len(hold.decode0)
if (digit >= code.len) then
|* Remaining description will fit into second string.
decode2 = hold.decode0
return
endif

while digit > 0
if isspace(hold.decode0(digit; 1)) then
decode2 = hold.decode0(1; digit)
decode3 = hold.decode0(digit + 1; code.len - digit)
digit = 1
endif
digit = digit - 1
endwhile

|* Break by length if there is no space in the decode0.
if not isspace(decode0) and
isspace(decode1) and
isspace(decode2) and
isspace(decode3) then
code.len = len(decode0)
if (code.len < 54) then
|* Full description will fit into first string.
decode1 = decode0
return
else
if (code.len < 107) then
|* Full description will fit into first two strings.
decode1 = decode0(1; 53)
decode2 = decode0(54; code.len - 53)
else
|* All three strings are needed.
decode1 = decode0(1; 53)
decode2 = decode0(54; 53)
decode3 = decode0(107; code.len - 106)
endif
endif
endif

}

sameer.don
11th November 2016, 08:35
Use this if you have simpler requirement.

str$()

Syntax

string str$( num_expr )
Description

This converts an integer or floating point expression to a string.

how to convert no to words

Ajesh
14th November 2016, 08:42
Yes as described by other members here.

This is the Usage of the dll


tcmcs.dll0006.decode(tot.debit.amnt,1,report.amount,decode1,decode2,decode3,test)



Where tot.debit.amnt is the amount and report.amount is in words and rest of the parameters are string which you can just declare and use otherwise you would face an error.

what i found is that the decimal part in words i couldnt get so i wrote the function myself.