function ChkCNPJ(const cCNPJ: string): boolean;
var
i, soma, mult: integer;
CGC: string;
begin
ChkCNPJ := false;
CGC := LimpaString(cCNPJ);
if Length(CGC) <> 14 then exit;
soma := 0; mult := 2;
for i := 12 downto 1 do
begin
soma := soma + CharToInt(CGC[i]) * mult;
mult := mult + 1;
if mult > 9 then mult := 2;
end;
mult := soma mod 11;
if mult <= 1 then mult := 0 else mult := 11 - mult;
if mult <> CharToInt(CGC[13]) then exit;
soma := 0;
mult := 2;
for i := 13 downto 1 do
begin
soma := soma + CharToInt(CGC[i]) * mult;
mult := mult + 1;
if mult > 9 then mult := 2;
end;
mult := soma mod 11;
if mult <= 1 then mult := 0 else mult := 11 - mult;
ChkCNPJ := mult = CharToInt(CGC[14]);
end;