Ver Mensaje Individual
  #44  
Antiguo 02-06-2013
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Reputación: 22
José Luis Garcí Va camino a la fama
Aquí el módulo que reúne los bancos

Aquí la imagen



Aquí el código https://gist.github.com/anonymous/5693125

y nuevas funciones usadas de mi archivo Fun.pas

Código Delphi [-]
//------------------------------------------------------------------------------
//************************************************************[ EditLogico ]****
// JLGT 01052013 Modificada de un procedure para admitir sólo unos caracteres en un edit
// BAsado en el código de la página   http://www.nochesdecode.com.ar/2012/...en-delphi.html
//--Partes----------------------------------------------------------------------
//--Ejemplo---------------------------------------------------------------------
//  procedure TFCLIENTES.DBEdit6Change(Sender: TObject);
//  begin
//     DBEdit6.text:=EditLogico(tedit(Dbedit6));  //sólo admitira  'S N s n'
//     //O
//      DBEdit6.text:=EditLogico(tedit(Dbedit6), '0123456789');  //sólo admitira  '0 1 2 3 4 5 6 7 8 9'
//  end;
//------------------------------------------------------------------------------
function EditLogico(edit:TEdit;Cadena:string='SNsn'):String;     
var
i : integer;
aux,aux2: string;
begin
        aux2:='';
        with Edit do
        begin
                aux:=text;
                for i:=1 to length(aux) do
                if pos(aux[i],Cadena)>0 then aux2:=aux2+aux[i];
                SelStart:=length(aux2);
        end;
        Result:=aux2;
end;

//------------------------------------------------------------------------------
//**************************************************************[ CalculaDC]****
//  Parte de la idea original de   ??? 15/05/2013
// bajada de http://www.delphiaccess.com/forum/in...=showfaq;id=78
//------------------------------------------------------------------------------
// tal como estaba sin modificaciones por mi parte
//------------------------------------------------------------------------------
//  [BancoOficina]  String     Banco más oficina de 4+4 usar la funcion ceros
//  [Cuenta]         String     El nº de cuenta de 10 digitos usar la funcion ceros
//------------------------------------------------------------------------------
//---EJEMPLO--------------------------------------------------------------------
//  procedure TForm1.Button1Click(Sender: TObject);
//  begin
//    Label1.Caption := IntToStr(CalculaDC('00851755','0000321764'));
//  end;
//------------------------------------------------------------------------------
function CalculaDC(BancoOficina, Cuenta: string):integer;
  const
    Pesos: array[0..9] of integer=(6,3,7,9,10,5,8,4,2,1);
  var
    n: byte;
    iTemp: integer;
  begin
    iTemp := 0;
    for n := 0 to 7 do
      iTemp := iTemp + StrToInt(Copy(BancoOficina, 8 - n, 1)) * Pesos[n];
    Result := 11 - iTemp mod 11;
    if (Result > 9) then Result := 1 - Result mod 10;
    iTemp := 0;
    for n := 0 to 9 do
       iTemp := iTemp + StrToInt(Copy(Cuenta, 10 - n, 1)) * Pesos[n];
    iTemp := 11 - iTemp mod 11;
    if (iTemp > 9) then iTemp := 1 - iTemp mod 10;
    Result := Result * 10 + iTemp;
  end;

//**************************************************************[ CEROS ]*******
//  Delvuelve unacadena reyena de ceros al frente
//  Propia
//        EJEMPLO
//        a2:=ceros(inttostr(32),4);
//        a2 = 0032
//------------------------------------------------------------------------------
function ceros(text:string;Cant:integer):string;
var
   valor,x:integer;
   dev,con:string;
begin
   con:='';
   valor:=length(text);
   if valorthen
   begin
        for x:=1 to (cant-valor) do
        begin
            con:=con+'0';
        end;
        dev:=con+text;
   end
   else
   dev:=text;
   result:=dev;
end;
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita