Ola pessoal..
Aqueles que poderem me ajudar ficarei muito grato.
Sou iniciante em delphi estou com esta rotina e preciso fazer o cancelamento da nfe por evento com
acbr antes funcionava legal mais como houve mudanca estou com dificuldades em implementr isto
no fonte se alguem pode me ajudar ficarei muito grato ok.
segue minha rotina abaixo.
modiiquem e mostre como deve ficar para o cancelamento da nfe nao dar aquela menssagem
DESATIVADO DE ACORDO COM AJUSTE SINIEF 16/12 USAR O EVENTO DE CANCELAMENTO
NT2011/006.
Se alguem resolver por favor me mandem um e-mail avisando.
[email protected]
procedure TFrmGerenciamentoNFe.BtnCancelamentoClick(Sender: TObject);
var sCaminhoArquivo : string;
tempdata:string;
begin
{ verifica se a nota foi transmitida e tem protocolo e chave }
if trim(QConsNfeSTATUS_TRANSMITIDA.AsString) = 'N' then
begin
showmessage('NFe não transmitida');
exit;
end;
if trim(QConsNfeSTATUS_CANCELADO.AsString) = 'S' then
begin
showmessage('NFe Cancelada');
exit;
end;
if trim(QConsNfeCHAVE_ACESSO_NFE.AsString) = '' then
begin
showmessage('NFe sem chave de acesso');
exit;
end;
if trim(QConsNfePROTOCOLO_NFE.AsString) = '' then
begin
showmessage('NFe sem protocolo');
exit;
end;
iCodigoNfe:= QConsNfeCOD_NF.AsInteger;
tempData := formatdatetime( 'yyyy', QConsNfeDATA_EMISSAO_NF.AsDateTime ) + formatdatetime( 'mm', QConsNfeDATA_EMISSAO_NF.AsDateTime );
{ verifica se o arquivo xml da nota existe no caminho especificado }
sCaminhoArquivo:= dm.ACBrNFe1.Configuracoes.Arquivos.PathNFe+ '\' +tempdata + '\nfe\' + trim(QConsNfeCHAVE_ACESSO_NFE.AsString) + '-nfe.xml';
if not FileExists(sCaminhoArquivo) then
begin
showmessage('NFe não encontrada');
exit;
end;
dm.ACBrNFe1.NotasFiscais.Clear;
dm.ACBrNFe1.NotasFiscais.LoadFromFile(sCaminhoArquivo);
if not (InputQuery('WebServices Cancelamento', 'Justificativa', sJustifNFe)) then
exit;
dm.ACBrNFe1.Cancelamento(sJustifNFe);
//ShowMessage(IntToStr(dm.ACBrNFe1.WebServices.Cancelamento.cStat));
//ShowMessage(dm.ACBrNFe1.WebServices.Cancelamento.Protocolo);
BtnOk.Click;
end;