IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Delphi Discussion :

clé RIB


Sujet :

Langage Delphi

  1. #1
    Membre à l'essai
    Inscrit en
    Juillet 2005
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Juillet 2005
    Messages : 11
    Points : 20
    Points
    20
    Par défaut clé RIB
    Bonjour,
    J'ai besoin d'un algorihme pour controler et générer une clé rib à partir des 3 paramètres suivants:
    - code banque
    - code guichet
    - numéro de compte
    Merci et bonne jounrée

  2. #2
    bjl
    bjl est déconnecté
    Membre averti Avatar de bjl
    Profil pro
    Inscrit en
    Décembre 2002
    Messages
    263
    Détails du profil
    Informations personnelles :
    Localisation : Brésil

    Informations forums :
    Inscription : Décembre 2002
    Messages : 263
    Points : 338
    Points
    338
    Par défaut
    Bonjour,

    et quel est le délai ?

  3. #3
    Expert éminent
    Avatar de qi130
    Homme Profil pro
    Expert Processus IT
    Inscrit en
    Mars 2003
    Messages
    3 911
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 63
    Localisation : France

    Informations professionnelles :
    Activité : Expert Processus IT
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2003
    Messages : 3 911
    Points : 6 032
    Points
    6 032
    Par défaut
    Voici 1 appli qui le fait :

    Le DFM:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    object Form1: TForm1
      Left = 388
      Top = 178
      ActiveControl = Edit1
      BorderStyle = bsDialog
      Caption = 'Calcul et contrôle de clé RIB'
      ClientHeight = 223
      ClientWidth = 278
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'System'
      Font.Style = []
      OldCreateOrder = True
      PixelsPerInch = 96
      TextHeight = 16
      object Label1: TLabel
        Left = 26
        Top = 24
        Width = 85
        Height = 16
        Caption = 'Code banque'
      end
      object Label2: TLabel
        Left = 26
        Top = 53
        Width = 84
        Height = 16
        Caption = 'Code guichet'
      end
      object Label3: TLabel
        Left = 26
        Top = 81
        Width = 86
        Height = 16
        Caption = 'N° de compte'
      end
      object Label4: TLabel
        Left = 26
        Top = 110
        Width = 49
        Height = 16
        Caption = 'Clé RIB'
      end
      object Label5: TLabel
        Left = 181
        Top = 110
        Width = 75
        Height = 16
        AutoSize = False
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clRed
        Font.Height = -13
        Font.Name = 'System'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object BitBtn1: TBitBtn
        Left = 4
        Top = 195
        Width = 30
        Height = 26
        Hint = 'Quitter'
        ParentShowHint = False
        ShowHint = True
        TabOrder = 5
        TabStop = False
        OnClick = BitBtn1Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          04000000000000010000120B0000120B00001000000000000000000000000000
          800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00330000000000
          03333377777777777F333301BBBBBBBB033333773F3333337F3333011BBBBBBB
          0333337F73F333337F33330111BBBBBB0333337F373F33337F333301110BBBBB
          0333337F337F33337F333301110BBBBB0333337F337F33337F333301110BBBBB
          0333337F337F33337F333301110BBBBB0333337F337F33337F333301110BBBBB
          0333337F337F33337F333301110BBBBB0333337F337FF3337F33330111B0BBBB
          0333337F337733337F333301110BBBBB0333337F337F33337F333301110BBBBB
          0333337F3F7F33337F333301E10BBBBB0333337F7F7F33337F333301EE0BBBBB
          0333337F777FFFFF7F3333000000000003333377777777777333}
        NumGlyphs = 2
      end
      object Edit1: TEdit
        Left = 144
        Top = 20
        Width = 48
        Height = 24
        MaxLength = 5
        TabOrder = 0
      end
      object Edit2: TEdit
        Left = 144
        Top = 49
        Width = 48
        Height = 24
        MaxLength = 5
        TabOrder = 1
      end
      object Edit3: TEdit
        Left = 144
        Top = 77
        Width = 95
        Height = 24
        MaxLength = 11
        TabOrder = 2
      end
      object Edit4: TEdit
        Left = 144
        Top = 106
        Width = 24
        Height = 24
        MaxLength = 2
        TabOrder = 3
      end
      object BitBtn2: TBitBtn
        Left = 94
        Top = 144
        Width = 89
        Height = 33
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clRed
        Font.Height = -13
        Font.Name = 'System'
        Font.Style = [fsBold]
        ParentFont = False
        TabOrder = 4
        OnClick = BitBtn2Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          04000000000000010000120B0000120B00001000000000000000000000000000
          800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00337000000000
          73333337777777773F333308888888880333337F3F3F3FFF7F33330808089998
          0333337F737377737F333308888888880333337F3F3F3F3F7F33330808080808
          0333337F737373737F333308888888880333337F3F3F3F3F7F33330808080808
          0333337F737373737F333308888888880333337F3F3F3F3F7F33330808080808
          0333337F737373737F333308888888880333337F3FFFFFFF7F33330800000008
          0333337F7777777F7F333308000E0E080333337F7FFFFF7F7F33330800000008
          0333337F777777737F333308888888880333337F333333337F33330888888888
          03333373FFFFFFFF733333700000000073333337777777773333}
        NumGlyphs = 2
      end
    end
    le PAS:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    unit Clerib0;
     
    interface
     
    uses
      SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
      Forms, Dialogs, StdCtrls, Buttons,chaine;
     
    type
      TForm1 = class(TForm)
        BitBtn1: TBitBtn;
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Edit1: TEdit;
        Edit2: TEdit;
        Edit3: TEdit;
        Edit4: TEdit;
        BitBtn2: TBitBtn;
        Label5: TLabel;
        procedure BitBtn1Click(Sender: TObject);
        procedure BitBtn2Click(Sender: TObject);
      private
        { Private-déclarations }
      public
        { Public-déclarations }
      end;
     
    var
      Form1: TForm1;
     
    implementation
     
    {$R *.DFM}
     
    procedure TForm1.BitBtn1Click(Sender: TObject);
    begin
         Form1.Close;
    end;
     
    procedure TForm1.BitBtn2Click(Sender: TObject);
    var cpte,tout:string;
        i,j,k,valcle,clecal:longint;
    begin
         BitBtn2.Caption:='';
         Label5.caption:='';
         if Edit1.Text='' then begin
            MessageDlg('Le code banque est obligatoire.',mtError,[ mbOK],0);
            Edit1.SetFocus;
            exit;
            end;
         if Length(Edit1.Text)<>5 then begin
            MessageDlg('Code banque invalide.',mtError,[ mbOK],0);
            Edit1.SetFocus;
            exit;
            end;
         if not Numeric(Edit1.Text) then begin
            MessageDlg('Le code banque doit être numérique.',mtError,[ mbOK],0);
            Edit1.SetFocus;
            exit;
            end;
         if Edit2.Text='' then begin
            MessageDlg('Le code guichet est obligatoire.',mtError,[ mbOK],0);
            Edit2.SetFocus;
            exit;
            end;
         if Length(Edit2.Text)<>5 then begin
            MessageDlg('Code guichet invalide.',mtError,[ mbOK],0);
            Edit2.SetFocus;
            exit;
            end;
         if not Numeric(Edit2.Text) then begin
            MessageDlg('Le code guichet doit être numérique.',mtError,[ mbOK],0);
            Edit2.SetFocus;
            exit;
            end;
         if Edit3.Text='' then begin
            MessageDlg('Le n° de compte est obligatoire.',mtError,[ mbOK],0);
            Edit3.SetFocus;
            exit;
            end;
         cpte:=Majuscules(Edit3.Text);
         valcle:=0;
         if Edit4.Text<>'' then begin
            if not Numeric(Edit4.Text) then begin
               MessageDlg('La clé RIB doit être numérique.',mtError,[ mbOK],0);
               Edit4.SetFocus;
               exit;
               end;
            if length(Edit4.Text)<>2 then begin
               MessageDlg('Clé RIB invalide.',mtError,[ mbOK],0);
               Edit4.SetFocus;
               exit;
               end;
            valcle:=StrToInt(Edit4.Text);
            if (valcle<1) or (valcle>97) then begin
               MessageDlg('Clé RIB hors limites (01-97).',mtError,[ mbOK],0);
               Edit4.SetFocus;
               exit;
               end;
            end;
         cpte:=Translate(cpte,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','12345678912345678923456789');
     
         while Length(cpte)<>11 do
            cpte:='0'+cpte;
       {  Edit3.Text:=cpte; }
         tout:=Edit1.Text+Edit2.Text+cpte;
         i:=StrToInt(_Left(tout,7));
         j:=StrToInt(Copy(tout,8,7));
         k:=StrToInt(_Right(tout,7));
         clecal:=97-(((62*i)+(34*j)+(3*k)) mod 97);
         BitBtn2.Caption:=_Right('0'+IntToStr(clecal),2);
         if valcle<>0 then
            if valcle<>clecal then Label5.caption:='erronée !';
    end;
     
    end.
    Ca été créé sous Delphi1, mais je viens de le compiler en D6P et c'est Ok.
    "Il n'y a pas de bonnes réponses à une mauvaise question." (M. Godet)
    -----------------------
    Pensez à cloturer votre sujet - Aucune réponse aux sollicitations techniques par MP
    Usus magister est optimus

  4. #4
    Expert éminent
    Avatar de qi130
    Homme Profil pro
    Expert Processus IT
    Inscrit en
    Mars 2003
    Messages
    3 911
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 63
    Localisation : France

    Informations professionnelles :
    Activité : Expert Processus IT
    Secteur : Finance

    Informations forums :
    Inscription : Mars 2003
    Messages : 3 911
    Points : 6 032
    Points
    6 032
    Par défaut
    En plus:

    le DPR:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    program Clerib;
     
    uses
      Forms,
      Clerib0 in 'CLERIB0.PAS' {Form1};
     
    {$R *.RES}
     
    begin
      Application.CreateForm(TForm1, Form1);
      Application.Run;
    end.
    et la fonction principale appelée: les autres sont "self-explanatory" (Numeric, _left, Majuscules, etc...) et sont à remplacer par leur équivalent "constructeur"
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    Function Translate(ch_entree,cherche,remplace:string):string;
    var i,j:integer;
    Begin
         for i:=1 to length(ch_entree) do
            for j:=1 to length(cherche) do
               if ch_entree[i]=cherche[j] then ch_entree[i]:=remplace[j];
         Translate:=ch_entree;
    End;
    afin de se passer de l'unité chaine
    "Il n'y a pas de bonnes réponses à une mauvaise question." (M. Godet)
    -----------------------
    Pensez à cloturer votre sujet - Aucune réponse aux sollicitations techniques par MP
    Usus magister est optimus

Discussions similaires

  1. Algorithme de clé RIB
    Par zooffy dans le forum ASP.NET
    Réponses: 20
    Dernier message: 27/12/2011, 00h37
  2. Vérifier la validité d'un RIB
    Par MaitreTsiang dans le forum ActionScript 3
    Réponses: 0
    Dernier message: 18/11/2008, 14h43
  3. parser IGES/STEP/STL/OBJ - COLLADA/RIB/POVRAY/X
    Par infernal1022 dans le forum Autres éditeurs
    Réponses: 1
    Dernier message: 15/06/2007, 10h12
  4. Vérification de RIB
    Par Fluxy dans le forum Langage
    Réponses: 1
    Dernier message: 23/02/2007, 09h59
  5. [VB]Calcul Clé RIB
    Par dai.kaioh dans le forum VB 6 et antérieur
    Réponses: 19
    Dernier message: 18/01/2005, 11h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo