bousaid

New WINDEV PROCEDURE Cle & RIP CCP

Mar 10th, 2021 (edited)
92
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PROCEDURE String_CCP(Compte,CleeCCP,CleRIP are strings)
  2.  
  3. // calcule clé CCP
  4. Compte = NumToString(Val(Compte),"010d")
  5. CleeCCP = Right(Val(Middle(Compte,1,1))*13 + Val(Middle(Compte,2,1))*12 +...
  6. Val(Middle(Compte,3,1))*11 + Val(Middle(Compte,4,1))*10 +...
  7. Val(Middle(Compte,5,1))*9 + Val(Middle(Compte,6,1))*8 +...
  8. Val(Middle(Compte,7,1))*7 + Val(Middle(Compte,8,1))*6 +...
  9. Val(Middle(Compte,9,1))*5 + Val(Middle(Compte,10,1))*4 ,2)
  10.  
  11. // calcule clé RIP
  12. CleRIP = Val(Compte) * 100
  13. CleRIP = modulo(Val(CleRIP),97)
  14. CleRIP = Val(CleRIP) + 85
  15. IF Val(CleRIP) >= 97 THEN
  16. CleRIP = Val(CleRIP) - 97
  17. CleRIP = 97 - Val(CleRIP)
  18. CleRIP = Complete(Right("00"+ Val(CleRIP),2),2)
  19. ELSE
  20. CleRIP = 97 - Val(CleRIP)
  21. CleRIP = Complete(Right("00"+ Val(CleRIP) ,2),2)
  22. END
  23.  
  24. //Usage
  25. String_CCP(SAI_CompteCCP,SAI_CleCCP,SAI_CleRIP)
  26. SAI_RIP = ChaîneConstruit("00799999%1%2", SAI_CompteCCP, SAI_CleRIP)
RAW Paste Data