Hi everybody
i am looking to print bank checks with a "normal" printer (Lexmark laser Optra 310)
Have any idea of how make conversion beetween numbers and letters
( 100 euros will give cent euros , 54 will give cinquante quatre....)?
Thanks
HOW TO PRINT CHECK
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: HOW TO PRINT CHECK
I wrote a function years ago but it is in Italian. Do you want to see it anyway?
EMG
EMG
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
I HOPE THIS IS IT
// Testing
#include "FiveWin.ch"
//------------------------------------------------------------------------//
function Main()
local oDlg
local oGet
local nGet := 0
DEFINE DIALOG oDlg TITLE "Number To Word"
@ 5, 5 SAY "Number:" OF oDlg PIXEL
@ 5, 50 GET oGet VAR nGet OF oDlg SIZE 35, 12 PIXEL PICTURE "999999999999"
@ 25, 5 BUTTON "&Word" OF oDlg SIZE 35,12 ACTION Convert(nGet) PIXEL
@ 25, 50 BUTTON "&End" OF oDlg SIZE 35,12 ACTION oDlg:End() PIXEL
ACTIVATE DIALOG oDlg CENTERED
return nil
//------------------------------------------------------------------------//
function Convert(nGet)
local cWords := ""
local nRest := 0
local nNum := 0
cDigits := { "one ", "two ", "three ", "four ", "five " ,;
"six ", "seven ", "eight ", "nine ", "ten " ,;
"eleven ", "twelve ", "thirteen ","fourteen ","fifteen " ,;
"sixteen ", "seventeen ","eighteen ","nineteen " ;
}
cTens := { "twenty ", "thirty ", "forty ", "fifty ","sixty " ,;
"seventy ", "eighty ", "ninety " ;
}
nRest := nGet
IF nRest > 999999999
nNum := INT(nRest/1000000000)
nRest := nRest - INT(nRest/1000000000)*1000000000
cWords := cWords + Text(nNum) + "billion "
ENDIF
IF nRest > 999999
nNum := INT(nRest/1000000)
nRest := nRest - INT(nRest/1000000)*1000000
cWords := cWords + Text(nNum) + "million "
ENDIF
IF nRest > 999
nNum := INT(nRest/1000)
nRest := nRest - INT(nRest/1000)*1000
cWords := cWords + Text(nNum) + "thousand "
ENDIF
IF nRest > 0
nNum := nRest
cWords := cWords + Text(nNum)
ENDIF
msginfo(cWords)
return nil
//------------------------------------------------------------------------//
function Text(nNum)
local cText := ""
IF nNum > 99
cText := cText + cDigits[INT(nNum/100)] + "hundred "
ENDIF
nRest := nNum - INT(nNum/100)*100
IF nRest > 0
IF nRest < 20
cText := cText + cDigits[nRest]
ELSE
cText := cText + cTens[INT(nRest/10)-1]
IF nRest - INT(nRest/10)*10 > 0
cText := cText + cDigits[nRest-INT(nRest/10)*10]
ENDIF
ENDIF
ENDIF
return cText
#include "FiveWin.ch"
//------------------------------------------------------------------------//
function Main()
local oDlg
local oGet
local nGet := 0
DEFINE DIALOG oDlg TITLE "Number To Word"
@ 5, 5 SAY "Number:" OF oDlg PIXEL
@ 5, 50 GET oGet VAR nGet OF oDlg SIZE 35, 12 PIXEL PICTURE "999999999999"
@ 25, 5 BUTTON "&Word" OF oDlg SIZE 35,12 ACTION Convert(nGet) PIXEL
@ 25, 50 BUTTON "&End" OF oDlg SIZE 35,12 ACTION oDlg:End() PIXEL
ACTIVATE DIALOG oDlg CENTERED
return nil
//------------------------------------------------------------------------//
function Convert(nGet)
local cWords := ""
local nRest := 0
local nNum := 0
cDigits := { "one ", "two ", "three ", "four ", "five " ,;
"six ", "seven ", "eight ", "nine ", "ten " ,;
"eleven ", "twelve ", "thirteen ","fourteen ","fifteen " ,;
"sixteen ", "seventeen ","eighteen ","nineteen " ;
}
cTens := { "twenty ", "thirty ", "forty ", "fifty ","sixty " ,;
"seventy ", "eighty ", "ninety " ;
}
nRest := nGet
IF nRest > 999999999
nNum := INT(nRest/1000000000)
nRest := nRest - INT(nRest/1000000000)*1000000000
cWords := cWords + Text(nNum) + "billion "
ENDIF
IF nRest > 999999
nNum := INT(nRest/1000000)
nRest := nRest - INT(nRest/1000000)*1000000
cWords := cWords + Text(nNum) + "million "
ENDIF
IF nRest > 999
nNum := INT(nRest/1000)
nRest := nRest - INT(nRest/1000)*1000
cWords := cWords + Text(nNum) + "thousand "
ENDIF
IF nRest > 0
nNum := nRest
cWords := cWords + Text(nNum)
ENDIF
msginfo(cWords)
return nil
//------------------------------------------------------------------------//
function Text(nNum)
local cText := ""
IF nNum > 99
cText := cText + cDigits[INT(nNum/100)] + "hundred "
ENDIF
nRest := nNum - INT(nNum/100)*100
IF nRest > 0
IF nRest < 20
cText := cText + cDigits[nRest]
ELSE
cText := cText + cTens[INT(nRest/10)-1]
IF nRest - INT(nRest/10)*10 > 0
cText := cText + cDigits[nRest-INT(nRest/10)*10]
ENDIF
ENDIF
ENDIF
return cText