Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Usage:
- //SAI_CleCCP = Cle_CCP_RIP("OLD",SAI_CompteCCP)
- //SAI_CleRIP = Cle_CCP_RIP("RIP",SAI_CompteCCP)
- PROCEDURE PUBLIC GLOBAL Cle_CCP_RIP(Type_Cle is string, Compte_CCP is string):string
- nResulta is int
- sCle is string = "00"
- SWITCH Type_Cle
- // Cle CCP
- CASE "OLD"
- FOR I = Length(Compte_CCP) TO 1 STEP -1
- nResulta = (nResulta + Val(Compte_CCP[I]) * (Length(Compte_CCP) - I + 4))
- nResulta = modulo(nResulta, 100)
- END
- // Cle Rip
- CASE "RIP"
- nResulta = (97 - ((((modulo(Val(Compte_CCP), 97)) * modulo(3, 97)) + 85) modulo 97))
- OTHER CASE
- nResulta = 0
- END
- //ADD "0" Like 01, 02, 03 ... etc
- sCle = NumToString(nResulta,"02d")
- Compte_CCP = NumToString(Val(Compte_CCP),"010d")
- RESULT sCle
Add Comment
Please, Sign In to add comment