IBAN
Moderator: Enrico Maria Giordano
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Re: IBAN
Eccolo:
EMG
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL cPae := "IT"
LOCAL cAbi := "01234"
LOCAL cCab := "01234"
LOCAL cCon := "000000012345"
LOCAL cCin := CIN( cAbi, cCab, cCon )
? IBAN( "IT", cCin, cAbi, cCab, cCon )
RETURN NIL
STATIC FUNCTION IBAN( cPae, cCin, cAbi, cCab, cCon )
LOCAL cChk := IBANCHK( cPae + "00" + cCin + cAbi + cCab + cCon )
RETURN cPae + cChk + cCin + cAbi + cCab + cCon
STATIC FUNCTION IBANCHK( cIba )
LOCAL cGru, cRes := ""
LOCAL i
cIba = SUBSTR( cIba, 5 ) + LEFT( cIba, 4 )
cIba = IBANNUM( cIba )
FOR i = 1 TO LEN( cIba ) STEP 8
cGru = cRes + SUBSTR( cIba, i, 8 )
cRes = LTRIM( STR( INT( VAL( cGru ) % 97 ) ) )
NEXT
RETURN STRZERO( ( 98 - VAL( cRes ) ) % 97, 2 )
STATIC FUNCTION IBANNUM( cIba )
LOCAL cTmp := cIba
LOCAL cChr
LOCAL i
cIba = ""
FOR i = 1 TO LEN( cTmp )
cChr = SUBSTR( cTmp, i, 1 )
IF ISDIGIT( cChr )
cIba += cChr
ELSE
cIba += LTRIM( STR( ASC( cChr ) - ASC( "A" ) + 10 ) )
ENDIF
NEXT
RETURN cIba
STATIC FUNCTION CIN( cAbi, cCab, cCon )
LOCAL aPari := { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 }
LOCAL aDisp := { 1, 0, 5, 7, 9, 13, 15, 17, 19, 21, 2, 4, 18, 20, 11, 3, 6, 8, 12, 14, 16, 10, 22, 25, 24, 23, 27, 28, 26 }
LOCAL cNume := "0123456789"
LOCAL cLett := "ABCDEFGHIJKLMNOPQRSTUVWXYZ-. "
LOCAL cCod := UPPER( cAbi + cCab + cCon )
LOCAL nSomma := 0
LOCAL i, n
FOR i = 1 TO LEN( cCod )
n = AT( SUBSTR( cCod, i, 1 ), cNume )
IF n = 0
n = AT( SUBSTR( cCod, i, 1 ), cLett )
ENDIF
IF i % 2 = 0
nSomma += aPari[ n ]
ELSE
nSomma += aDisp[ n ]
ENDIF
NEXT
RETURN SUBSTR( cLett, ( nSomma + 1 ) % 26, 1 )
EMG
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
Eccola:
Comunque cerca anche di darti da fare un pochino. Non puoi pretendere sempre la pappa pronta.
EMG
Code: Select all | Expand
FUNCTION ISIBAN( cIba )
LOCAL cChk := SUBSTR( cIba, 3, 2 )
cIba = LEFT( cIba, 2 ) + "00" + SUBSTR( cIba, 5 )
RETURN cChk = IBANCHK( cIba )
Comunque cerca anche di darti da fare un pochino. Non puoi pretendere sempre la pappa pronta.
EMG
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact:
scusa ma sei sicuro che io non sia capace di estrappolare un campo da un archivio ... se ce lo avessi quel dannato archivio ...tre anni fa lo avuto e adesso non ce l'ho..per caso ce l'hai un archivoo banche con codici abi e cab d'italia : telo scritto anche sul nntp...
mi manca anche l'archivio dei comuni d'italia aggiornato ma dove li trovo ?
mi manca anche l'archivio dei comuni d'italia aggiornato ma dove li trovo ?
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
- Enrico Maria Giordano
- Posts: 8753
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Has thanked: 1 time
- Been thanked: 4 times
- Contact: