Cancelamento por Evento Cumprindo o que determina o Ajuste Sinief 16, de 28 de setembro de 2012, o Serviço de Cancelamento poderá ser utilizado até 31/03/2013. por Erasmo Carlos do Amaral

Delphi

27/04/2013

ACBR
Exemplo em Delphi para cancelamento por Evento.

ACBrNFe1.EventoNFe.Evento.Clear;
ACBrNFe1.EventoNFe.idLote := 1;

with ACBrNFe1.EventoNFe.Evento.Add do
begin
InfEvento.tpAmb := ACBrNFe1.NotasFiscais.Items[0].NFe.Ide.tpAmb;
infEvento.CNPJ := ACBrNFe1.NotasFiscais.Items[0].NFe.Emit.CNPJCPF;
InfEvento.cOrgao := ACBrNFe1.NotasFiscais.Items[0].NFe.Ide.cUF;
InfEvento.nSeqEvento := 1;
InfEvento.chNFe := Copy(ACBrNFe1.NotasFiscais.Items[0].NFe.infNFe.ID, 4, 44);
InfEvento.dhEvento := Now;
InfEvento.tpEvento := teCancelamento;
infEvento.detEvento.xJust := vAux; // Justificativa;
InfEvento.detEvento.nProt := ACBrNFe1.NotasFiscais.Items[0].NFe.procNFe.nProt;
ACBrNFe1.WebServices.EnvEvento.Executar;
end;


// Retornos
iUltimoIndice := ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Count - 1;
FInfoProtocolo := ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[iUltimoIndice].RetInfEvento.nProt;
FInfoMotivo := ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[iUltimoIndice].RetInfEvento.xMotivo;
FInfoStat := IntToStr(ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[iUltimoIndice].RetInfEvento.cStat);
FInfoDataHora := DateTimeToStr(ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento.Items[iUltimoIndice].RetInfEvento.dhRegEvento);


Deu certo assim
Atenciosamente,
Erasmo Amaral
Erasmo Use

Erasmo Use

Curtidas 0
POSTAR