Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5578
| From | "Wolfgang Riedmann" <wriedmann@gmail.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: IBAN calculation |
| Date | 2013-07-24 18:33 +0200 |
| Message-ID | <b5adtrFnfgaU1@mid.individual.net> (permalink) |
| References | <d892c631-b8c6-4f60-82a0-d9a984e4adc2@googlegroups.com> |
Hi Martin,
> Has anyone ever tried calculating IBAN's with VO 2.8 ? How to deal
> with 24-digit long integers ? Does anyone know of a function that
> might work ? Grateful for any hints ...
look at this code:
function IBANrechnen( cLand := "IT" as string, cCin as string, cAbi as
string, cCab as string, cKonto as string ) as string pascal
local cCheck as string
local cIBAN as string
if Empty( cCin )
cCin := CINRechnen( cAbi, cCab, cKonto )
endif
cCheck := IBANCheck( cLand + "00" + cCin + PadL( cAbi, 5, "0" ) +
PadL( cCab, 5, "0" ) + PadL( cKonto, 12, "0" ) )
cIBAN := cLand + cCheck + cCin + PadL( cAbi, 5, "0" ) + PadL( cCab,
5, "0" ) + PadL( cKonto, 12, "0" )
return cIBAN
function IBANCheck( cIBAN as string ) as string pascal
local cGru as string
local cRest as string
// local nI as dword
// local nLen as dword
local cReturn as string
local nRest as dword
local nWert as dword
cGru := ""
cRest := ""
cIBAN := SubStr2( cIBAN, 5 ) + Left( cIBAN, 2 ) + "00" // Left(
cIBAN, 4 )
_DebOut32( psz( "IBAN: " + cIBAN ) )
cIBAN := IBANNummer( cIBAN )
//_DebOut32( psz( "IBAN numerisch: " + cIBAN ) )
// Zahl ist zu lang für normale Berechnung
cRest := cIBAN
nWert := 0
while ! Empty( cRest )
nWert := nRest * 10 + Val( Left( cRest, 1 ) )
cRest := SubStr2( cRest, 2 )
nRest := nWert % 97
//_DebOut32( psz( "Wert: " + NTrim( nWert ) + " % 97 ergibt " +
NTrim( nRest ) ) )
end
cReturn := StrZero( 98 - nRest, 2 )
// geht nicht
// nLen := SLen( cIBAN )
// for nI := 1 upto nLen step 8
// cGru := cRest + SubStr3( cIBAN, nI, 8 )
// cRest := NTrim( Integer( Val( cGru ) % 97 ) )
// next
// cReturn := StrZero( ( 98 - Val( cRest ) ) % 97, 2 )
//_DebOut32( psz( "Prüfung: " + cReturn ) )
return cReturn
function IBANNummer( cIBAN as string ) as string pascal
local cTemp as string
local cChar as string
local nI as dword
local nLen as dword
cTemp := cIBAN
cIBAN := ""
nLen := SLen( cTemp )
for nI := 1 upto nLen
cChar := SubStr( cTemp, nI, 1 )
if IsDigit( String2PSZ( cChar ) )
cIBAN := cIBAN + cChar
else
cIBAN := cIBAN + Str3( Asc( cChar ) - Asc( "A" ) + 10, 2, 0 )
endif
next
return cIBAN
Wolfgang
--
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
IBAN calculation maduet@bluewin.ch - 2013-07-24 06:21 -0700 Re: IBAN calculation dlzc <dlzc1@cox.net> - 2013-07-24 07:53 -0700 Re: IBAN calculation "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-07-24 18:33 +0200 Re: IBAN calculation D.J.W. van Kooten <public@ic2remove.this.com> - 2013-07-25 22:46 +0200
csiph-web