Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Check writing program

1 view
Skip to first unread message

br...@mvillage.com

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

I am writing a check writing module for a business management package.
Does anyone have any suggestions how I can get VDB to interpret the
numeric dollar value entered in the amount field into english text
equivalent for the check. For example $25.00 comes out as "Twenty Five
Dollars and No Cents" I want to handle values between 1.00 and
1000000. Post replies here or to me via email br...@mvillage.com

Andy Taylor

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

"Bruss"

Use a combination of the VdB functions Stuff() and at() to replace
"dollar(s)" with "pound(s)" and "cent(s)" with "pen(ce/ny)"

Andy

In article <34932ae7...@news.mvillage.com>, br...@mvillage.com

Bowen Moursund

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

>I am writing a check writing module for a business management package.
>Does anyone have any suggestions how I can get VDB to interpret the
>numeric dollar value entered in the amount field into english text
>equivalent for the check.

I believe that the dUFLP code library available at this site...

http://ourworld.compuserve.com/homepages/KMayer/DBASE.HTM

contains a routine that will do the trick.
____
Bowen Moursund
bowen...@nerds.com
http://www.mindspring.com/~bowenm/datatech.htm


Wayne A. Coppin

unread,
Dec 15, 1997, 3:00:00 AM12/15/97
to

br...@mvillage.com wrote:

>I am writing a check writing module for a business management package.
>Does anyone have any suggestions how I can get VDB to interpret the
>numeric dollar value entered in the amount field into english text

The following function comes from an old Clipper app. I had kicking
around. The syntax is not exactly one to one, but conversion should
not be too difficult or time consuming. If nothing else, it gives you
a model to work from :-) Hope it helps.

func numwords

SETCOLOR("B/W")
camt=""
STORE " ONE TWO THREEFOUR FIVE SIX SEVENEIGHTNINE " TO ones
STORE "TEN ELEVEN TWELVE THIRTEEN FOURTEEN FIFTEEN SIXTEEN
"+;
"SEVENTEENEIGHTEEN NINETEEN " TO teen
STORE "TWENTY THIRTY FORTY FIFTY SIXTY SEVENTYEIGHTY NINETY" TO
tens
cnum=LEFT(STR(mamt,9,2),6)
IF LEFT(cnum,1)>" "
camt=RTRIM(SUBSTR(ones,VAL(LEFT(cnum,1))*5+1,5))+" HUNDRED "
ENDIF
DO CASE
CASE SUBSTR(cnum,2,1)>"1"
camt=camt+RTRIM(SUBSTR(tens,VAL(SUBSTR(cnum,2,1))*7-13,7))
IF SUBSTR(cnum,3,1)>"0"
camt=camt+"-"+RTRIM(SUBSTR(ones,VAL(SUBSTR(cnum,3,1))*5+1,5))
ENDIF
camt=camt+" THOUSAND "
CASE SUBSTR(cnum,2,1)="1"
camt=camt+RTRIM(SUBSTR(teen,VAL(SUBSTR(cnum,3,1))*9+1,9))+" THOUSAND "
CASE SUBSTR(cnum,2,2)="00"
camt=camt+"THOUSAND "
CASE SUBSTR(cnum,3,1)>" "
camt=camt+RTRIM(SUBSTR(ones,VAL(SUBSTR(cnum,3,1))*5+1,5))+" THOUSAND "
ENDCASE
IF SUBSTR(cnum,4,1)>"0"
camt=camt+RTRIM(SUBSTR(ones,VAL(SUBSTR(cnum,4,1))*5+1,5))+" HUNDRED "
ENDIF
DO CASE
CASE SUBSTR(cnum,5,1)>"1"
camt=camt+RTRIM(SUBSTR(tens,VAL(SUBSTR(cnum,5,1))*7-13,7))
IF RIGHT(cnum,1)>"0"
camt=camt+"-"+RTRIM(SUBSTR(ones,VAL(RIGHT(cnum,1))*5+1,5))
ENDIF
CASE SUBSTR(cnum,5,1)="1"
camt=camt+RTRIM(SUBSTR(teen,VAL(RIGHT(cnum,1))*9+1,9))
CASE RIGHT(cnum,2)=" 0"
camt="ZERO"
OTHERWISE
camt=camt+RTRIM(SUBSTR(ones,VAL(RIGHT(cnum,1))*5+1,5))
ENDCASE
cents=RIGHT(STR(mamt,9,2),2)
camt=RTRIM(camt)+" AND "+cents+"/100 DOLLARS"
IF tamt > 0
@ 11,4 SAY SPACE(74)
@ 12,10 SAY SPACE(30)
ENDIF
string = SPACE(62)
length = LEN(camt)
IF length > 75
counter = 74
DO WHILE .NOT. SUBSTR(camt,counter,1) $ " -"
counter = counter - 1
ENDDO
word1 = LEFT(camt,counter)+LEFT(string,75-counter)
word2 = SUBSTR(camt,counter+1,length-counter)
@ 11,4 SAY word1
@ 12,10 SAY word2
ELSE
word1 = camt + LEFT(string,75-length)
@ 11,4 SAY word1
ENDIF
SETCOLOR("W+/B")
RETURN


--
"Reply to" address is bot fodder- use:
wacoppin at king dot igs dot net
----
"We have reached the sad age when minds,
and not just houses, can be broken and
entered." - The New Yorker


David Veale

unread,
Dec 15, 1997, 3:00:00 AM12/15/97
to

br...@mvillage.com wrote in message <34932ae7...@news.mvillage.com>...

>I am writing a check writing module for a business management package.
>Does anyone have any suggestions how I can get VDB to interpret the
>numeric dollar value entered in the amount field into english text
>equivalent for the check. For example $25.00 comes out as "Twenty Five
>Dollars and No Cents" I want to handle values between 1.00 and
>1000000. Post replies here or to me via email br...@mvillage.com

Below is a function i wrote a couple years ago that does exactly what you
want. It should work with any version of dBASE for DOS or Windows. Enjoy!

FUNCTION Str2Num
PARAMETERS cStr
PRIVATE i, c, nRet, nLen, cTemp, cPoint

nRet = 0

IF TYPE("cStr") == "C"
nLen = 0
cTemp = ""
cPoint = SET("POINT")
c = ""
i = 0

cStr = LTRIM(RTRIM(cStr))
nLen = LEN(cStr)
FOR i = 1 TO nLen
c = SUBSTR(cStr, i, 1)
IF ((c >= "0") .AND. (c <= "9")) .OR. (c = cPoint) .OR. (c =
"-")
cTemp = cTemp + c
ENDIF
ENDFOR

nRet = VAL(cTemp)
ENDIF
RETURN nRet

David Veale

unread,
Dec 16, 1997, 3:00:00 AM12/16/97
to

Whoops. I posted the wrong function. I'll dig up the right one.

David Veale wrote in message <674cjd$js...@newslist.borland.com>...

sam

unread,
Dec 16, 1997, 3:00:00 AM12/16/97
to

If you email me s...@lynnet.com I havethe code and will send to you. I got it
from Borland dbase news letter.

David Veale wrote:

--
Best regards, Samuel Malcuria
463 Castle
Geneva, New York 14456-1455
s...@mail.lynnet.com
home 315-789-1539
fax 315-789-1539

Henk Deutekom

unread,
Dec 17, 1997, 3:00:00 AM12/17/97
to

To: s...@lynnet.com
From: hdeu...@bundy.xs4all.nl (Henk Deutekom)
Date: Wednesday, December 17, 1997, Time: 08:49 WET
Subject: Re: Check writing program

Hello sam!

Tuesday, December 16, 1997, sam wrote to All:

s> From: sam <s...@mail.lynnet.com>
s> Organization: lynnet

s> If you email me s...@lynnet.com I havethe code and will send to you. I
s> got it from Borland dbase news letter.

Is it possible to send the code also to me?

Regards, Henk
--
hdeu...@bundy.xs4all.nl

Tom Lake

unread,
Dec 20, 1997, 3:00:00 AM12/20/97
to

The program given doesn't do that at all! I wrote one that does work
but it's on the computer at work and I won't be able to get it until
Tuesday. If you don't get a good routine by then, I'll send it to you.

Tom Lake

>>I am writing a check writing module for a business management package.
>>Does anyone have any suggestions how I can get VDB to interpret the

>>numeric dollar value entered in the amount field into English text

0 new messages