Advertisement
alanvcb

Untitled

Dec 14th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.53 KB | None | 0 0
  1.       NotaF.NFe.Dest.CNPJCPF := NotaCLI_CPF_CNPJ.AsString;
  2.       if Length(SoNumeros(NotaCLI_CPF_CNPJ.AsString)) = 14 then
  3.       begin
  4.         if SoNumeros(NotaCLI_RG_INSC.AsString) <> '' then
  5.         begin
  6.           NotaF.NFe.Dest.IE        := SoNumeros(NotaCLI_RG_INSC.AsString);
  7.           NotaF.NFe.Dest.indIEDest := inContribuinte;
  8.         end
  9.         else
  10.         begin
  11.           if (NotaCOD_CFOP.AsString.Substring(0,1) = '6') and (NotaSN_CONSUMIDOR.AsString = 'S') then
  12.             NotaF.NFe.Dest.indIEDest := inNaoContribuinte
  13.           else
  14.           begin
  15.             if AceitaIsento(NotaCLI_ESTADO.AsString) then
  16.               NotaF.NFe.Dest.indIEDest := inIsento
  17.             else
  18.               NotaF.NFe.Dest.indIEDest := inNaoContribuinte
  19.           end;
  20.         end;
  21.       end
  22.       else
  23.       begin
  24.         if (NotaSN_PRODUTOR_RURAL.AsString = 'S') and ((NotaCLI_RG_INSC.AsString <> '') and (NotaCLI_RG_INSC.AsString <> 'ISENTO')) then
  25.         begin
  26.           NotaF.NFe.Dest.IE        := SoNumeros(NotaCLI_RG_INSC.AsString);
  27.           NotaF.NFe.Dest.indIEDest := inContribuinte;
  28.         end
  29.         else
  30.           NotaF.NFe.Dest.indIEDest := inNaoContribuinte;
  31.       end;
  32.     end;
  33.  
  34.  
  35. UF_NIsento: array[0..10] of string = ('AM','MT','MS','GO','SP','MG','BA','CE','PE','RN','SE');
  36.  
  37. function AceitaIsento(Estado: string): Boolean;
  38. var i: Integer;
  39. begin
  40.   Result := True;
  41.   for i := Low(UF_NIsento) to High(UF_NIsento) do
  42.     if Estado = UF_NIsento[i] then
  43.     begin
  44.       Result := False;
  45.       Break;
  46.     end;
  47. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement