Ir para conteúdo
  • Cadastre-se

Luis Fernando Ravanelli

Membros
  • Total de ítens

    4
  • Registro em

  • Última visita

Posts postados por Luis Fernando Ravanelli

  1. Boa tarde Rodrigo,

    Pelo DistribuicaoDFe, nele você visualiza todos os eventos de suas notas.

    Segue o exemplo abaixo.

    Espero ter ajudado.

    abs.

      memoLog.Lines.Clear;
      ACBrNFe1.Configuracoes.Geral.ModeloDF := moNFe;
      ACBrNFe1.Configuracoes.Geral.VersaoDF := ve310;
      ACBrNFe1.WebServices.Consulta.procEventoNFe.Clear;
      ACBrNFe1.Configuracoes.WebServices.Ambiente := taProducao;
      ACBrNFe1.Configuracoes.WebServices.UF := cbUF.Text;

      ACBrNFe1.DistribuicaoDFe(35, '68960244000150', '0', '');

      memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
      memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
        memoLog.Lines.Add('Tem mais? Sim')
      else
        memoLog.Lines.Add('Tem mais? Não');
      memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
      begin
        memoLog.Lines.Add(' Documento Localizado para o Destinatário');
        memoLog.Lines.Add(' ');

        for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
        begin
          memoLog.Lines.Add('************************');
          memoLog.Lines.Add(' ');

          memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);      

          if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id <> '' then
          begin
            memoLog.Lines.Add('ProcEvento');
            memoLog.Lines.Add('ID : ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.Id);
            memoLog.Lines.Add('Tipo Ambiente: ' + TpAmbToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpAmb));
            memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.CNPJ);
            memoLog.Lines.Add('Chave: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.chNFe);
            memoLog.Lines.Add('Data Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.dhEvento));
            memoLog.Lines.Add('Tipo: ' + TpEventoToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.tpEvento));
            memoLog.Lines.Add('Seq: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.nSeqEvento));
            memoLog.Lines.Add('Versão: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.verEvento);
            memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xMotivo);
            memoLog.Lines.Add('Evento: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.xEvento);
            memoLog.Lines.Add('Seq2: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nSeqEvento));
            memoLog.Lines.Add('CNPJ Dest: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.CNPJDest);
            memoLog.Lines.Add('Data Reg. Evento: ' + DateTimeToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.dhRegEvento));
            memoLog.Lines.Add('Prot: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.RetinfEvento.nProt);
            memoLog.Lines.Add('Prot. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.nProt);
            memoLog.Lines.Add('Just. Det: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.procEvento.detEvento.xJust);
          end;

        end;
      end
      else
      begin
       // Nenhum Documento Localizado para o Destinatário
        if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
        then begin
          memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
          memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
          memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
          memoLog.Lines.Add(' ');
        end
        else begin
          memoLog.Lines.Add(' Falha ao realizar a consulta.');
          memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
          memoLog.Lines.Add(' ');
        end;
      end;

  2. Boa tarde Italo.

    Obrigado pelas informações, ajudou e muito.

    Porém me restou uma dúvida.

    Pelo que entendi com a Nota Técnica 2014/002 e com o teste que acabo de realizar com o DistribuicaoDFe, este me retorna dados das notas no qual sou o destinatário.

    Na qualidade de emissor, meu objetivo é armazenar em minha aplicação os protocolos/eventos de manifestação que meus destinatários/clientes efetuaram nas notas emitidas por mim.

    Segue abaixo o código que utilizei no teste.

    Você pode me ajudar?

    Muito obrigado.

    ACBrNFe1.DistribuicaoDFe(:UF, :CNPJ, '0', '');

      memoLog.Lines.Add('Status: ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat));
      memoLog.Lines.Add('Motivo: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137 then
        memoLog.Lines.Add('Tem mais? Sim')
      else
        memoLog.Lines.Add('Tem mais? Não');
      memoLog.Lines.Add('Último NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU);
      if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 138 then
      begin
        memoLog.Lines.Add(' Documento Localizado para o Destinatário');
        memoLog.Lines.Add(' ');

        for i := 0 to ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Count - 1  do
        begin
          memoLog.Lines.Add('************************');
          memoLog.Lines.Add(' ');

          if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.chNFe <> '' then
          begin
            memoLog.Lines.Add('Chave de Acesso: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.chNFe);
            memoLog.Lines.Add('CNPJ: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.CNPJCPF);
            memoLog.Lines.Add('Nome: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.xNome);
            memoLog.Lines.Add('IE: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.IE);

            case ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.tpNF of
              tnEntrada: memoLog.Lines.Add('Tipo: Entrada');
              tnSaida:   memoLog.Lines.Add('Tipo: Saída');
            end;
            memoLog.Lines.Add('NSU: ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.NSU);
            case ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.docZip.Items.resNFe.cSitNFe of
              snAutorizado: memoLog.Lines.Add('Situação: Autorizado');
              snDenegado:   memoLog.Lines.Add('Situação: Denegado');
              snCancelada:  memoLog.Lines.Add('Situação: Canelada');
            end;
          end;
        end;
      end
      else
      begin
       // Nenhum Documento Localizado para o Destinatário
        if ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat = 137
        then begin
          memoLog.Lines.Add(' Nenhum Documento Localizado para o Destinatário');
          memoLog.Lines.Add(' Utilizar o número que esta no campo: Último NSU');
          memoLog.Lines.Add(' Para uma nova pesquisa ('+ ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.ultNSU +').');
          memoLog.Lines.Add(' ');
        end
        else begin
          memoLog.Lines.Add(' Falha ao realizar a consulta.');
          memoLog.Lines.Add('  ' + IntToStr(ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.cStat) + ' - ' + ACBrNFe1.WebServices.DistribuicaoDFe.retDistDFeInt.xMotivo);
          memoLog.Lines.Add(' ');
        end;
      end;
     

     

  3. Senhores, bom dia.

    Eu como emissor de NFe, gostaria de consultar e armazenar os protocolos/eventos de manifestação efetuadas em minhas NFe's pelos meus destinatários.

    Entendo as manifestações como eventos.

    Utilizei o código abaixo, porém só consegui visualizar eventos de cancelamentos, os eventos de manifestação não consegui.

      ACBrNFe1.WebServices.Consulta.Executar;

      if ACBrNFe1.WebServices.Consulta.procEventoNFe.Count > 0 then
      begin
        for i := 0 to ACBrNFe1.WebServices.Consulta.procEventoNFe.Count - 1 do
        begin
          for j := 0 to ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Count - 1 do
          begin
            memoLog.Lines.Add('***********************');
            memoLog.Lines.Add('');
            memoLog.Lines.Add('Sequência do evento: ' + IntToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.nSeqEvento));
            memoLog.Lines.Add('Tipo de evento.....: ' + TpEventoToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.TpEvento));
            memoLog.Lines.Add('Descrição do evento: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.InfEvento.DescEvento);
            memoLog.Lines.Add('Cód. status evento.: ' + IntToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.cStat));
            memoLog.Lines.Add('Desc. status evento: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.xMotivo);
            memoLog.Lines.Add('Status evento......: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.xEvento);
            memoLog.Lines.Add('Protocolo..........: ' + ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.nProt);
            memoLog.Lines.Add('Data/hora do evento: ' + DateToStr(ACBrNFe1.WebServices.Consulta.procEventoNFe.Items.RetEventoNFe.retEvento.Items[j].RetInfEvento.dhRegEvento));
          end;
        end;
      end;
     

    Alguém pode me ajudar.

    Obrigado.

×
×
  • Criar Novo...

Informação Importante

Colocamos cookies em seu dispositivo para ajudar a tornar este site melhor. Você pode ajustar suas configurações de cookies, caso contrário, assumiremos que você está bem para continuar.