home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload
/
ShartewareOverload.cdr
/
database
/
disk_20.zip
/
WRITENUM.ZIP
/
WRITENUM.PRG
Wrap
Text File
|
1986-04-04
|
3KB
|
107 lines
* PROCEDURE WRITENUM - Converts Numbers to Alpha for Checks.
*
* Parameters are AMOUNT which is a Number, WRITENUM is Alpha
* You can give them any name you want in your calling program.
* Largest number to be written is 999,999.99
*
PROC WRITENUM
PARAMETER AMOUNT,WRITENUM
REFNUM=AMOUNT
NUMBERIN=AMOUNT
WRITENUM= ' '
AA0= ' '
BB0= ' '
AA1= 'ONE'
BB1= ' '
AA2= 'TWO'
BB2= 'TWENTY'
AA3= 'THREE'
BB3= 'THIRTY'
AA4= 'FOUR'
BB4= 'FORTY'
AA5= 'FIVE'
BB5= 'FIFTY'
AA6= 'SIX'
BB6= 'SIXTY'
AA7= 'SEVEN'
BB7= 'SEVENTY'
AA8= 'EIGHT'
BB8= 'EIGHTY'
AA9= 'NINE'
BB9= 'NINETY'
CC10= 'TEN'
CC11= 'ELEVEN'
CC12= 'TWELVE'
CC13= 'THIRTEEN'
CC14= 'FOURTEEN'
CC15= 'FIFTEEN'
CC16= 'SIXTEEN'
CC17= 'SEVENTEEN'
CC18= 'EIGHTEEN'
CC19= 'NINETEEN'
IF NUMBERIN>=100000
STOR 'AA' +STR(INT(NUMBERIN/100000),1,0) TO AAA
STOR NUMBERIN-((INT(NUMBERIN/100000)*100000)) TO NUMBERIN
IF NUMBERIN>=1000
STOR '&WRITENUM' + ' ' +&AAA+ ' HUNDRED' TO WRITENUM
ELSE
STOR '&WRITENUM' + ' ' +&AAA+ ' HUNDRED THOUSAND' TO WRITENUM
ENDI
ENDI
IF NUMBERIN>=1000
IF INT(NUMBERIN/1000)<=9
STOR 'AA' +STR(INT(NUMBERIN/1000),1,0) TO AAA
STOR '&WRITENUM' + ' ' +&AAA+ ' THOUSAND' TO WRITENUM
ELSE
IF INT(NUMBERIN/1000)<=19
STOR 'CC' +STR(INT(NUMBERIN/1000),2,0) TO CCA
STOR '&WRITENUM' + ' ' +&CCA+ ' THOUSAND' TO WRITENUM
ELSE
STOR 'BB' +STR(INT(NUMBERIN/10000),1,0) TO BBA
IF INT(NUMBERIN/1000)-((INT(NUMBERIN/10000))*10)=0
STOR '&WRITENUM' + ' ' +&BBA+ ' THOUSAND' TO WRITENUM
ELSE
STOR 'AA' +STR((INT(NUMBERIN/1000)- ((INT(NUMBERIN/10000))*10)),1,0) TO AAA
STOR '&WRITENUM' + ' ' +&BBA+ ' ' +&AAA+ ' THOUSAND' TO WRITENUM
ENDI
ENDI
ENDI
STOR NUMBERIN-((INT(NUMBERIN/1000))*1000) TO NUMBERIN
ENDI
IF NUMBERIN>=100
STOR 'AA' +STR(INT(NUMBERIN/100),1,0) TO AAA
STOR '&WRITENUM' + ' ' +&AAA+ ' HUNDRED' TO WRITENUM
STOR NUMBERIN-((INT(NUMBERIN/100))*100) TO NUMBERIN
ENDI
IF NUMBERIN>=1
IF INT(NUMBERIN)<=9
STOR 'AA' +STR(INT(NUMBERIN),1,0) TO AAA
STOR '&WRITENUM' + ' ' +&AAA TO WRITENUM
ELSE
IF INT(NUMBERIN)<=19
STOR 'CC' +STR(INT(NUMBERIN),2,0) TO CCA
STOR '&WRITENUM' + ' ' +&CCA TO WRITENUM
ELSE
STOR 'BB' +STR(INT(NUMBERIN/10),1,0) TO BBA
IF NUMBERIN-((INT(NUMBERIN/10))*10)=0
STOR '&WRITENUM' + ' ' +&BBA TO WRITENUM
ELSE
STOR 'AA' +STR(INT(NUMBERIN-((INT(NUMBERIN/10))*10)),1,0) TO AAA
STOR '&WRITENUM' + ' ' +&BBA+ ' ' +&AAA TO WRITENUM
ENDI
ENDI
ENDI
STOR NUMBERIN-(INT(NUMBERIN)) TO NUMBERIN
ENDI
IF NUMBERIN<1
IF REFNUM>=1
STOR SUBSTR(STR(NUMBERIN,4,2),3,2) TO CHANGE
STOR '&WRITENUM' + ' and ' + '&CHANGE' + '/100' TO WRITENUM
ELSE
STOR STR((INT(NUMBERIN*100)),2,0)+ '/100' TO WRITENUM
ENDI
ENDI
STOR 'PAY **' + '&WRITENUM' + ' **' TO WRITENUM
RETU