Ver Mensaje Individual
  #1  
Antiguo 09-05-2007
Avatar de jhonny
jhonny jhonny is offline
Jhonny Suárez
 
Registrado: may 2003
Ubicación: Colombia
Posts: 7.058
Reputación: 29
jhonny Va camino a la famajhonny Va camino a la fama
Calcular el digito de verificación de un NIT

Las empresas privadas colombianas necesitan tener un dígito de verificación al final de su Nit (Numero de identificación tributaria), el cual les sirve para identificarse ante la "Cámara y comercio", a continuación una función muy simple que devuelve dicho Dígito de verificación según el nit:

Código Delphi [-]
function DigitoVerificacion(Nit :string) :Integer;
var
  i, j, vTotal :Integer;
const
  ValFijos :array[1..15] of Word = (3,7,13,17,19,23,29,37,41,43,47,53,59,67,71);
begin
  vTotal := 0;
  j := 0;
  for i := Length(Nit) downto 1 do
  begin
    inc(j);
    vTotal := vTotal + (StrToInt(Nit[i]) * ValFijos[j]);
  end;
  vTotal := vTotal - (vTotal div 11) * 11;

  if vTotal > 1 then
    vTotal := 11-vTotal;
  
  Result := vTotal;
end;
Responder Con Cita