Ir para conteúdo
  • Cadastre-se

dev botao

Manifesto De Destinatario Erro Data


Ver Solução Respondido por Hetosoft Sistemas,
  • Este tópico foi criado há 3693 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

  • Moderadores

O XML sempre é criado antes do envio, pois é o comando a ser enviado para o SEFAZ. Na imagem que vc postou já está selecionado a opção "Salvar arquivos de Envio e Resposta", abra essa pasta e copie o arquivo que é gerado no momento que vc solicita a manifestação.

djsystem-logo.png
 youtube.png facebook.png instagram.png linkedin.png
André Ferreira de Moraes | Analista de Sistemas
www.djsystem.com.br | www.djpdv.com.br
www.tefhouse.com.br | www.lambretinha.com.br
Link para o comentário
Compartilhar em outros sites

  • Membros Pro
  • Solution

Depois de 20 dias

Conseguir resolver

 

Pesquisei no google e achei esse tópico.

 

que o Liandrocs resolveu  o  problema

 

-----------------------

Estao meu codigo ficou assim....

 

 

 

 

function TForm_Manifesto.Manifestar(tipo: Integer): Boolean;
var
 Chave, idLote, CNPJ, vXMotivo: string;
 lMsg: string;
begin

 try

    Chave:=DM11.Client_ManifestoCHAVE_NFE.Text;

    CNPJ:=Form_NFe.edtEmitCNPJ.Text;


    Chave := Trim(OnlyNumber(Chave));
    idLote := '1';


    Form_NFe.ACBrNFe1.EventoNFe.Evento.Clear;
    with Form_NFe.ACBrNFe1.EventoNFe.Evento.Add do
     begin
       infEvento.chNFe := Chave;
       infEvento.CNPJ   := CNPJ;
       infEvento.dhEvento := now;


       
       if tipo=1 then
          infEvento.tpEvento := teManifDestConfirmacao else
       if tipo=2 then
          infEvento.tpEvento := teManifDestDesconhecimento else
       if tipo=3 then
          infEvento.tpEvento := teManifDestOperNaoRealizada else
       if tipo=4 then
          infEvento.tpEvento := teManifDestCiencia;


       //novo 2014
       //infEvento.cOrgao:= StrToInt( Form_NFe.edtCodUF.Text );
       //infEvento.nSeqEvento:=1;
       //infEvento.versaoEvento:='1.00';

       //infEvento.DescEvento:='Confirmacao da Operacao';
       //infEvento.xJust:='';//Operacao nao Realizada


     end;
    //Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote));


    try
      Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote));

      if Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].RetInfEvento.cStat = 657 then
      begin
        Form_NFe.ACBrNFe1.EventoNFe.Evento.Items[0].InfEvento.cOrgao := Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.cOrgao;
        if not Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote)) then
        begin
          with Form_NFe.ACBrNFe1.WebServices.EnvEvento do
          begin
            raise Exception.Create('Ocorreram erros ao tentar efetuar a manifestação:' + sLineBreak +
                                   'Lote: ' + IntToStr(EventoRetorno.idLote) + sLineBreak +
                                   'Ambiente: ' + TpAmbToStr(EventoRetorno.tpAmb) + sLineBreak +
                                   'Orgao: ' + IntToStr(EventoRetorno.cOrgao) + sLineBreak +
                                   'Status: ' + IntToStr(EventoRetorno.cStat) + sLineBreak +
                                   'Motivo: ' + EventoRetorno.xMotivo);
          end;
        end;
      end;

    except
      //SE ERRO DE DATA MUDA O cOrgao
      Form_NFe.ACBrNFe1.EventoNFe.Evento.Items[0].InfEvento.cOrgao := 91;

      Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote));

      if Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].RetInfEvento.cStat = 657 then
      begin
        Form_NFe.ACBrNFe1.EventoNFe.Evento.Items[0].InfEvento.cOrgao := Form_NFe.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.cOrgao;
        if not Form_NFe.ACBrNFe1.EnviarEventoNFe(StrToInt(IDLote)) then
        begin
          with Form_NFe.ACBrNFe1.WebServices.EnvEvento do
          begin
            raise Exception.Create('Ocorreram erros ao tentar efetuar a manifestação:' + sLineBreak +
                                   'Lote: ' + IntToStr(EventoRetorno.idLote) + sLineBreak +
                                   'Ambiente: ' + TpAmbToStr(EventoRetorno.tpAmb) + sLineBreak +
                                   'Orgao: ' + IntToStr(EventoRetorno.cOrgao) + sLineBreak +
                                   'Status: ' + IntToStr(EventoRetorno.cStat) + sLineBreak +
                                   'Motivo: ' + EventoRetorno.xMotivo);
          end;
        end;
      end;


    end;


        with Form_NFe.AcbrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].RetInfEvento do
        begin
          vXMotivo:=xMotivo;
          lMsg:=
          'Id: '+Id+#13+
          'tpAmb: '+TpAmbToStr(tpAmb)+#13+
          'verAplic: '+verAplic+#13+
          'cOrgao: '+IntToStr(cOrgao)+#13+
          'cStat: '+IntToStr(cStat)+#13+
          'xMotivo: '+xMotivo+#13+
          'chNFe: '+chNFe+#13+
          'tpEvento: '+TpEventoToStr(tpEvento)+#13+
          'xEvento: '+xEvento+#13+
          'nSeqEvento: '+IntToStr(nSeqEvento)+#13+
          'CNPJDest: '+CNPJDest+#13+
          'emailDest: '+emailDest+#13+
          'dhRegEvento: '+DateTimeToStr(dhRegEvento)+#13+
          'nProt: '+nProt;
        end;


        if Pos('registrado e vinculado', vXMotivo )>0 then
        begin

          {
          DM11.Client_Manifesto.Edit;
          DM11.Client_ManifestoSEL.Text:='False';
          DM11.Client_ManifestoDATAMANIFESTO.AsDateTime:=Now;
          DM11.Client_ManifestoTIPOMANIFESTO.Text:=IntToStr(tipo);
          DM11.Client_Manifesto.ApplyUpdates(-1);
          }


          try

          DM.SQL_PRATUDO.Close;
          DM.SQL_PRATUDO.CommandText:=
          'UPDATE N_MANIFESTO SET DATAMANIFESTO=:A, TIPOMANIFESTO='+IntToStr(tipo)+' '+
          'WHERE ID='+DM11.Client_ManifestoID.Text+' ';
          DM.SQL_PRATUDO.ParamByName('A').AsDate:= StrToDate(  FormatDateTime('dd/mm/yyyy',Now)  );
          DM.SQL_PRATUDO.ExecSQL;

          DM.SQL_PRATUDO.Close;
          DM.SQL_PRATUDO.CommandText:=
          'commit';
          DM.SQL_PRATUDO.ExecSQL;

          except
             MessagemH(1,'Erro ao salvar o evento do manifesto !');
          end;

        end else
        begin
           if tipo=1 then
              NFEM_CancelarProcesso:=1;

           ShowMessage(lMsg);
        end;

    Form_NFe.MemoResp.Lines.Text := UTF8Encode(Form_NFe.ACBrNFe1.WebServices.EnvEvento.RetWS);
    Form_NFe.memoRespWS.Lines.Text := UTF8Encode(Form_NFe.ACBrNFe1.WebServices.EnvEvento.RetornoWS);
  //  ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[0].XXXX
    Form_NFe.LoadXML(Form_NFe.MemoResp, Form_NFe.WBResposta);

 except

          on E: Exception do
          begin

            if tipo=1 then
               NFEM_CancelarProcesso:=1;

             MessagemH(2,'Erro ao enviar evento de manifesto !'+#13+
             E.Message);

          end;




 end;

end;

Link para o comentário
Compartilhar em outros sites

×
×
  • 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.

The popup will be closed in 10 segundos...