Cálculo Digito Verificador

Delphi

30/09/2004

Alguem tem a rotina para validar o número de inscrição do INSS ? Preciso implantar essa rotina no meu sistema de folha de pagamento ..


Obrigado pela atenção.

[]´s


Seu-madruga

Seu-madruga

Curtidas 0

Respostas

Pehdepano

Pehdepano

30/09/2004

O dígito é calculado através de Mod11 ou Mod10??
Se for...
[b:5a108bd276]function Modulo10(N: string): string[/b:5a108bd276];
var
Somatorio, m, k, i: Integer;
begin
Somatorio := 0;
if Odd(Length(N))
then m := 2
else m := 1;
for i := 1 to Length(N) do
begin
k := StrToInt(N[i]) * m;
if k > 9 then k := (k - 9);
Somatorio := Somatorio + k;
if m = 1 then m := 2 else m := 1;
end;

m := 1000 - Somatorio;
Result := Copy(IntToStr(m), Length(IntToStr(m)), 1);
end;


[b:5a108bd276]function Modulo11(N: string): string;[/b:5a108bd276]
var
Somatorio, multipl, i, r: Integer;
begin
multipl := 2;
Somatorio := 0;
for i := Length(N) downto 1 do
begin
Somatorio := Somatorio + (StrToInt(N[i]) * multipl);
inc(multipl);
if multipl = 10 then multipl := 2;
end;
r := Somatorio mod 11;
multipl := 11 - r;
if multipl > 9 then multipl := 1;

if multipl = 0 then multipl := 1;

Result := IntToStr(multipl);
end;


GOSTEI 0
Motta

Motta

30/09/2004

vem a ser o NIT ?


GOSTEI 0
POSTAR