Jump to content

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

Recommended Posts

Posted

Estou com o mesmo problema no QRcode, descomentei o codigo a baixo e mesmo assim não está sendo gerada a tag.

Alguém tem um luz ?

 

procedure NotaFiscal.Assinar;
var
  XMLAss: String;
  ArqXML: String;
  Leitor: TLeitor;
  i : integer;
begin
  if NaoEstaVazio(FXMLAssinado) then
    exit;

  ArqXML := GerarXML;

  // XML já deve estar em UTF8, para poder ser assinado //
  ArqXML := ConverteXMLtoUTF8(ArqXML);
  FXMLOriginal := ArqXML;

  with TACBrNFe(TNotasFiscais(Collection).ACBrNFe) do
  begin
    XMLAss := SSL.Assinar(ArqXML, 'NFe', 'infNFe');
    FXMLAssinado := XMLAss;
    FXMLOriginal := XMLAss;

    // Remove header, pois podem existir várias Notas no XML //
    //TODO: Verificar se precisa
    //XMLAss := StringReplace(XMLAss, '<' + ENCODING_UTF8_STD + '>', '', [rfReplaceAll]);
    //XMLAss := StringReplace(XMLAss, '<' + XML_V01 + '>', '', [rfReplaceAll]);

    Leitor := TLeitor.Create;
    try
      leitor.Grupo := XMLAss;
      NFe.signature.URI := Leitor.rAtributo('Reference URI=');
      NFe.signature.DigestValue := Leitor.rCampo(tcStr, 'DigestValue');
      NFe.signature.SignatureValue := Leitor.rCampo(tcStr, 'SignatureValue');
      NFe.signature.X509Certificate := Leitor.rCampo(tcStr, 'X509Certificate');
    finally
      Leitor.Free;
    end;

//***********************************************************************************
// Atenção o código comentado abaixo não pode ser excluido pois será descomentado
// quando as alterações no XML definidas em NT 2015/002 versão 1.00 entrar em vigor.
// Homologação: 01/10/2015
// Produção: 03/11/2015
//***********************************************************************************

    // Gera o QR-Code para adicionar no XML antes de ser validado e salvo
    // somente para a NFC-e.

    if Configuracoes.Geral.ModeloDF = moNFCe then
    begin
      with TACBrNFe(TNotasFiscais(Collection).ACBrNFe) do
      begin
        NFe.infNFeSupl.qrCode := GetURLQRCode(NFe.Ide.cUF, NFe.Ide.tpAmb,
                                  onlyNumber(NFe.infNFe.ID), NFe.Dest.CNPJCPF,
                                  NFe.Ide.dEmi, NFe.Total.ICMSTot.vNF,
                                  NFe.Total.ICMSTot.vICMS, NFe.signature.DigestValue);
      end;

      i := pos('<Signature ', XMLAss);
      XMLAss := Copy(XMLAss, 1, i -1) +
                '<infNFeSupl>' +
                 '<qrCode>' +
                  '<![CDATA[' + NFe.infNFeSupl.qrCode + ']]>' +
                 '</qrCode>' +
                '</infNFeSupl>' +
                Copy(XMLAss, i, length(XMLAss));
    end;


    if Configuracoes.Arquivos.Salvar then
    begin
      if NaoEstaVazio(NomeArq) then
        Gravar(NomeArq, XMLAss)
      else
        Gravar(CalcularNomeArquivoCompleto(), XMLAss);
    end;
  end;
end;

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.