Jump to content

dev botao
  • Este tópico foi criado há 1071 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.

Recommended Posts

Posted

Boa tarde!

Estou tentando fazer o cancelamento da NFC-e e está dando um erro (UF em branco),

alguém sabe me dizer onde estou errando? Segue o código abaixo.

Obs: o arquivo vem de um campo BLOB do BD.

Desde já agradeço a atenção

 

procedure TfrmMonitor.CancelaVenda;
  var
    idLote : string;
begin
  if frmPrincipal.dfe = 'NFCE' then
    begin
      with frmPrincipal do
        begin
          with DmPrincipal.qryNFCe do
            begin
              Close;
              SQL.Clear;
              SQL.Add('SELECT * FROM NFCE ');
              SQL.Add('WHERE VENDA = :VND');
              ParamByName('VND').Value:=codVenda;
              Open;

              ACBrNFe1.NotasFiscais.Clear;
              ACBrNFe1.NotasFiscais.LoadFromString(FieldByName('XML_ENV').AsString);

              idLote :='1';

              ACBrNFe1.EventoNFe.Evento.Clear;
              ACBrNFe1.EventoNFe.idLote := StrToInt(idLote);

              with ACBrNFe1.EventoNFe.Evento.New do
                begin
                  infEvento.dhEvento :=now;
                  infEvento.tpEvento :=teCancelamento;
                  infEvento.detEvento.xJust :=motivo;
                end;

              ACBrNFe1.EnviarEvento(StrToInt(idLote));

              if rbEscPos.Checked then
                ACBrNFe1.DANFE :=AcbrNfeDANFCeESCPOS1
              else
                ACBrNFe1.DANFE :=ACBrNFeDANFCeFortes1;

              ACBrNFe1.NotasFiscais.Imprimir;
            end;

          with frmPrincipal.ACBrNFe1.WebServices.EnvEvento.EventoRetorno.retEvento do
            begin
              Stat            :=Items[0].RetInfEvento.cStat;
              motivo        :=Items[0].RetInfEvento.xMotivo;
              saidaNFCe :=Items[0].RetInfEvento.dhRegEvento;
              protocolo    :=Items[0].RetInfEvento.nProt;

              dataNFCe :=EncodeDate(YearOf(saidaNFCe),MonthOf(saidaNFCe),DayOf(saidaNFCe));


              with DmPrincipal.qryNFCe do
                begin
                  Edit;
                  FieldByName('DATA_CAN').AsDateTime :=dataNFCe;
                  FieldByName('PROC_CAN').AsString      :=protocolo;
                  FieldByName('MOTIVO').AsString           :=motivo;
                  FieldByName('XML_CAN').AsString         :=Items[0].RetInfEvento.XML;
                  Post;
                  ApplyUpdates(0);
                  Close;
                end;
            end;
        end;
    end;
end;

  • Administradores
Posted

Obrigado por reportar.

Fechando. Para novas dúvidas, criar um novo tópico.

Consultora SAC ACBr

Juliana Tamizou

Gerente de Projetos ACBr / Diretora de Marketing AFRAC
Ajude o Projeto ACBr crescer - Seja Pro

Projeto ACBr     Telefone:(15) 2105-0750 WhatsApp(15)99790-2976.  Discord

Projeto ACBr - A maior comunidade Open Source de Automação Comercial do Brasil


Participe de nosso canal no Discord e fique ainda mais próximo da Comunidade !!

  • Este tópico foi criado há 1071 dias atrás.
  • Talvez seja melhor você criar um NOVO TÓPICO do que postar uma resposta aqui.
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

The popup will be closed in 10 seconds...