Ir para conteúdo
  • Cadastre-se

dev botao

Atributo Id na tag infProt


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

Recommended Posts

Olá..

Fomos informados por um cliente que a tag infProt estava sendo gerada sem o atributo "Id", e isso estava gerando problemas de integração com outras ferramentas.

Avaliando os fontes do ACBr foi possível constatar que os fontes "acbr2\Fontes\PCN2\pcnNFeW.pas" e "acbr2\Fontes\PCN2\pcnProcNFe.pas" não tratam este atributo.

Nestes tópicos acho que já existe alguma relação com este assunto:

viewtopic.php?f=6&t=5558&p=28652&hilit=infProt+id#p28652

viewtopic.php?f=6&t=4935&p=24424&hilit=infProt+id#p24424

viewtopic.php?f=6&t=2256&p=10347&hilit=infProt+id#p10347

Segue e anexo alteração nos fontes para avaliação e possível revisão.

Obrigado pela atenção.

pcnNFeW.pas

pcnProcNFe.pas

Carlos H. Marian

Analista de Sistemas

|/-\|

Link para o comentário
Compartilhar em outros sites

  • Moderadores

Caro Carlos ,

Poderia nos dizer quais alterações que realizou para executarmos testes e ajustes.

Atentar que existe uma regra no manual de integração para não existência do id no xml.

Versão 4.0.1-NT2009.006 Pag. 46

Identificador da TAG a ser assinada, somente precisa ser informado se a UF assinar a

resposta. Em caso de assinatura da resposta pela SEFAZ preencher o campo com o Nro do Protocolo, precedido com o literal “ID”

Grato

Equipe ACBr Henrique Leonardo
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Tecnólogo em processamento de dados

E-mail [email protected] - Skype : hleorj

Link para o comentário
Compartilhar em outros sites

Olá,

Sim o atributo "Id" não é obrigatório, tanto que não gera critica ao aplicar o schema. Mas tivemos que revisar este regra para atender a um outro sistema que efetuamos integração.

A alteração foi no método (function TNFeW.GerarXml: boolean;);

Onde adicionei o atributo a tag.

De:

(******)''+

...

(******)''+

...

Para
(******)''+
E no método (function TProcNFe.GerarXML: boolean;): Onde tbm trato a tag, só neste caso tive que criar uma variável local para obter o valor temporariamente. De:
(******)''+// + RetornarConteudoEntre(XMLinfProt.text, '') +
Para:
nProtLoc :String;

...

nProtLoc := RetornarConteudoEntre(XMLinfProt2.text, '', '');

// Alterado por Italo em 28/09/2012

xProtNFe :=

'' +

(******)''+// + RetornarConteudoEntre(XMLinfProt.text, '') +

....

(******)''+

Até mais.

Carlos H. Marian

Analista de Sistemas

|/-\|

Link para o comentário
Compartilhar em outros sites

  • Moderadores

Caro Carlos ,

Fiz um estudo da sua implementação

Segue a minha Sugestão para geração da Tag infProt Id. de acordo com manual de integração.

Sugiro criar uma Funcao em pcnConversao.pas para checar o órgão gerador ( Vide item 5.6 do manual pag. 86 ) e retornar a Tag infProt ou infProt Id.

Function GerarId ( Var sProtocolo : String ) : String;

var

IOrgaoGerador : Integer;

begin

IOrgaoGerador := StrToInt( Copy(sProtocolo , 1,1) );

// 1 - Secretaria de Fazenda Estadual

// 2 - Receita Federal

// 3 – SEFAZ Virtual RS

// 4 – SEFAZ Virtual RFB

case IOrgaoGerador of

1 : Result := '';

2 ,

3,

4 : Result := '' ;

else

Result := 'Erro';

end

end;

Altera Em pcnProcNFe;

function TProcNFe.GerarXML: boolean;

xProtNFe :=

(**)'' +

De (******)''+// + RetornarConteudoEntre(XMLinfProt.text, '') +

Para (******)GerarId( XMLinfProt2.text ) +

(*********)PreencherTAG('tpAmb', XMLinfProt.text) +

(*********)PreencherTAG('verAplic', XMLinfProt.text) +

(*********)PreencherTAG('chNFe', XMLinfProt.text) +

(*********)PreencherTAG('dhRecbto', XMLinfProt2.text) +

(*********)PreencherTAG('nProt', XMLinfProt2.text) +

(*********)PreencherTAG('digVal', XMLinfProt.text) +

(*********)PreencherTAG('cStat', XMLinfProt.text) +

(*********)PreencherTAG('xMotivo', XMLinfProt.text) +

(******)'' +

{****}'';

end;

if ProtLido then

begin

xProtNFe :=

(**)'' +

De (******)''+

Para (******)GerarId(FnProt ) +

(*********)''+TpAmbToStr(FtpAmb)+''+

(*********)''+FverAplic+''+

(*********)''+FchNFe+''+

(*********)''+FormatDateTime('yyyy-mm-dd"T"hh:nn:ss',FdhRecbto)+''+

(*********)''+FnProt+''+

(*********)''+FdigVal+''+

(*********)''+IntToStr(FcStat)+''+

(*********)''+FxMotivo+''+

(******)''+

{****}'';

end;

Altera Em pcnNFeW;

function TNFeW.GerarXml: boolean;

if nfe.procNFe.nProt <> '' then

begin

xProtNFe :=

(**)'' +

De (******)''

Para (******)GerarId(nfe.procNFe.nProt ) +

(*********)''+TpAmbToStr(nfe.procNFe.tpAmb)+''+

(*********)''+nfe.procNFe.verAplic+''+

(*********)''+nfe.procNFe.chNFe+''+

(*********)''+FormatDateTime('yyyy-mm-dd"T"hh:nn:ss',nfe.procNFe.dhRecbto)+''+

(*********)''+nfe.procNFe.nProt+''+

(*********)''+nfe.procNFe.digVal+''+

(*********)''+IntToStr(nfe.procNFe.cStat)+''+

(*********)''+nfe.procNFe.xMotivo+''+

(******)''+

{****}'';

(**)Gerador.wTexto(xProtNFe);

Gerador.wGrupo('/nfeProc');

end;

Muito agradecido por propor uma solução

ATENÇÃO CÓDIGO NÃO TESTADO.

Equipe ACBr Henrique Leonardo
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Tecnólogo em processamento de dados

E-mail [email protected] - Skype : hleorj

Link para o comentário
Compartilhar em outros sites

  • Moderadores

Caro carlos,

Temos aqui um ICEBERG, pois a minha solução NÃO irá atender o componente. Pelo que estou lendo, existem outras unit's que deveram ser atualizadas. Sendo que uma delas terá que ser adicionado algumas propriedades para funcionar corretamente a configuração da Tag ( infProt ou infProt Id ).

Até Breve

Equipe ACBr Henrique Leonardo
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Tecnólogo em processamento de dados

E-mail [email protected] - Skype : hleorj

Link para o comentário
Compartilhar em outros sites

  • Moderadores

Caro carlos ,

O inicio do Iceberg

Na pcnProcNFe.pas

private

FGerador: TGerador;

FSchema: TpcnSchema;

FPathNFe: string;

FPathRetConsReciNFe: string;

FPathRetConsSitNFe: string;

// Novos campos

FinfProt : string;

fId :String;

FtpAmb: TpcnTipoAmbiente;

FverAplic: string;

FchNFe: string;

FdhRecbto: TDateTime;

FnProt: string;

FdigVal: string;

FcStat: integer;

FxMotivo: string;

.

.

.

published

property Gerador: TGerador read FGerador write FGerador;

property Schema: TpcnSchema read Fschema write Fschema;

property PathNFe: string read FPathNFe write FPathNFe;

property PathRetConsReciNFe: string read FPathRetConsReciNFe write FPathRetConsReciNFe;

property PathRetConsSitNFe: string read FPathRetConsSitNFe write FPathRetConsSitNFe;

// novo

property infProt : string Read FinfProt write FinfProt;

property Id : String Read fId write fId;

property tpAmb: TpcnTipoAmbiente read FtpAmb write FtpAmb;

property verAplic: string read FverAplic write FverAplic;

property chNFe: string read FchNFe write FchNFe;

property dhRecbto: TDateTime read FdhRecbto write FdhRecbto;

property nProt: string read FnProt write FnProt;

property digVal: string read FdigVal write FdigVal;

property cStat: integer read FcStat write FcStat;

property xMotivo: string read FxMotivo write FxMotivo;

end;

.

.

.

function TProcNFe.GerarXML: boolean;

.

.

.

if ProtLido then

begin

// Nova implementacao para atribuir as devidas tag

xProtNFe :=

(**)'';

if finfProt = 'infProt' then

xProtNFe := xProtNFe + '<'+finfProt+'>'

else

xProtNFe := xProtNFe + '<'+finfProt+fId+'">';

xProtNFe := xProtNFe +

(*********)'' + TpAmbToStr(FtpAmb)+''+

(*********)'' + FverAplic+''+

(*********)'' + FchNFe+''+

(*********)'' + FormatDateTime('yyyy-mm-dd"T"hh:nn:ss',FdhRecbto)+''+

(*********)'' + FnProt+''+

(*********)'' + FdigVal+''+

(*********)'' + IntToStr(FcStat)+''+

(*********)'' + FxMotivo+''+

(******)''+

{****}'';

end;

...

Em breve mais do ICEBERG

Equipe ACBr Henrique Leonardo
Ajude o Projeto ACBr crescer - Assine o SAC

Projeto ACBr

Tecnólogo em processamento de dados

E-mail [email protected] - Skype : hleorj

Link para o comentário
Compartilhar em outros sites

  • 3 semanas depois ...
  • 3 semanas depois ...
  • 1 mês depois ...

Olá,

  a princípio no fonte método "function TNFeW.GerarXml: boolean;"

  eu troque de 

  

  if nfe.procNFe.nProt <> '' then
   begin
     xProtNFe :=
       (**)'<protNFe versao="2.00">' +
     (******)'<infProt>'+

 

para

if nfe.procNFe.nProt <> '' then
   begin
     xProtNFe :=
       (**)'<protNFe versao="2.00">' +
     (******)'<infProt Id="'+ IIf( Pos('ID', nfe.procNFe.nProt) > 0, nfe.procNFe.nProt, 'ID'+ nfe.procNFe.nProt ) +'">'+

 

E com isso esta atendendo.

 

at+

Carlos H. Marian

Analista de Sistemas

|/-\|

Link para o comentário
Compartilhar em outros sites

e o fonte 

function TProcNFe.GerarXML: boolean;
  function PreencherTAG(const TAG: string; Texto: string): string;
  begin
    result := '<' + TAG + '>' + RetornarConteudoEntre(Texto, '<' + TAG + '>', '</' + TAG + '>') + '</' + TAG + '>';
  end;
var
  XMLNFe: TstringList;
  XMLinfProt: TstringList;
  XMLinfProt2: TstringList;
  wCstat: string;
  xProtNFe,
  nProtLoc: string;
  LocLeitor: TLeitor;
  i : Integer;
  ProtLido : Boolean; //Protocolo lido do arquivo
begin
  Result := False;
  ProtLido := False;
  // Alterado por Italo em 28/09/2012

//  if retornarVersaoLayout(FSchema, tlProcNFe) = '1.10' then
//  begin

    XMLNFe := TStringList.Create;
    XMLinfProt := TStringList.Create;
    XMLinfProt2 := TStringList.Create;
    xProtNFe := '';
    FnProt := '';

    // Arquivo NFe
    if not FileExists(FPathNFe) then
      Gerador.wAlerta('XR04', 'NFE', 'NFE', ERR_MSG_ARQUIVO_NAO_ENCONTRADO)
    else
      XMLNFE.LoadFromFile(FPathNFe);
    FchNFe := RetornarConteudoEntre(XMLNFE.Text, 'Id="NFe', '"');
    if trim(FchNFe) = '' then
      Gerador.wAlerta('XR01', 'ID/NFE', 'Numero da chave da NFe', ERR_MSG_VAZIO);

    if (FPathRetConsReciNFe = '') and (FPathRetConsSitNFe = '') then
     begin
      if (FchNFe = '') and (FnProt = '') then
         Gerador.wAlerta('XR06', 'RECIBO/SITUAÇÃO', 'RECIBO/SITUAÇÃO', ERR_MSG_ARQUIVO_NAO_ENCONTRADO)
      else
         ProtLido := True;
     end;

    // Gerar arquivo pelo Recibo da NFe                                       //
    if (FPathRetConsReciNFe <> '') and (FPathRetConsSitNFe = '') and (not ProtLido) then
    begin
      if not FileExists(FPathRetConsReciNFe) then
        Gerador.wAlerta('XR06', 'PROTOCOLO', 'PROTOCOLO', ERR_MSG_ARQUIVO_NAO_ENCONTRADO)
      else
      begin
        I := 0;
        LocLeitor := TLeitor.Create;
        LocLeitor.CarregarArquivo(FPathRetConsReciNFe);
        while LocLeitor.rExtrai(1, 'protNFe', '', i + 1) <> '' do
         begin
           if LocLeitor.rCampo(tcStr, 'chNFe') = FchNFe then
             FnProt := LocLeitor.rCampo(tcStr, 'nProt');
           if trim(FnProt) = '' then
             Gerador.wAlerta('XR01', 'PROTOCOLO/NFe', 'Numero do protocolo', ERR_MSG_VAZIO)
           else
            begin
             xProtNFe := LocLeitor.rExtrai(1, 'protNFe', '', i + 1)+'</protNFe>';
             Gerador.ListaDeAlertas.Clear;
             break;
            end;
            I := I + 1;
         end;
         LocLeitor.Free;
      end;
    end;

    // Gerar arquivo pelo arquivo de consulta da situação da NFe              //
    if (FPathRetConsReciNFe = '') and (FPathRetConsSitNFe <> '') and (not ProtLido) then
    begin
      if not FileExists(FPathRetConsSitNFe) then
        Gerador.wAlerta('XR06', 'SITUAÇÃO', 'SITUAÇÃO', ERR_MSG_ARQUIVO_NAO_ENCONTRADO)
      else
      begin
        XMLinfProt.LoadFromFile(FPathRetConsSitNFe);

        wCstat:=RetornarConteudoEntre(XMLinfProt.text, '<cStat>', '</cStat>');
        if ((trim(wCstat) = '101') or
            (trim(wCstat) = '151') or
            (trim(wCstat) = '155')) then //esta cancelada
           XMLinfProt2.Text:=RetornarConteudoEntre(XMLinfProt.text, '<infCanc', '</infCanc>')
        else
           XMLinfProt2.Text:=RetornarConteudoEntre(XMLinfProt.text, '<infProt', '</infProt>');

        //0011641/0011373 - Controle da tag "InfProt";
        nProtLoc := RetornarConteudoEntre(XMLinfProt2.text, '<nProt>', '</nProt>');
        // Alterado por Italo em 28/09/2012
        xProtNFe :=
          '<protNFe versao="' + Versao + '">' +
        (******)'<infProt Id="ID'+ nProtLoc +'">'+// + RetornarConteudoEntre(XMLinfProt.text, '<infProt', '<tpAmb>') +
        (*********)PreencherTAG('tpAmb', XMLinfProt.text) +
        (*********)PreencherTAG('verAplic', XMLinfProt.text) +
        (*********)PreencherTAG('chNFe', XMLinfProt.text) +
        (*********)PreencherTAG('dhRecbto', XMLinfProt2.text) +
        (*********)PreencherTAG('nProt', XMLinfProt2.text) +
        (*********)PreencherTAG('digVal', XMLinfProt.text) +
        (*********)PreencherTAG('cStat', XMLinfProt.text) +
        (*********)PreencherTAG('xMotivo', XMLinfProt.text) +
        (******)'</infProt>' +
        {****}'</protNFe>';
      end;
    end;

    if ProtLido then
     begin
        //0011641/0011373 - Controle da tag "InfProt";
        xProtNFe :=
          '<protNFe versao="' + Versao + '">' +
        (******)'<infProt Id="'+ IIf( Pos('ID', FnProt) > 0, FnProt, 'ID'+ FnProt ) +'">'+
        (*********)'<tpAmb>'+TpAmbToStr(FtpAmb)+'</tpAmb>'+
        (*********)'<verAplic>'+FverAplic+'</verAplic>'+
        (*********)'<chNFe>'+FchNFe+'</chNFe>'+
        (*********)'<dhRecbto>'+FormatDateTime('yyyy-mm-dd"T"hh:nn:ss',FdhRecbto)+'</dhRecbto>'+
        (*********)'<nProt>'+FnProt+'</nProt>'+
        (*********)'<digVal>'+FdigVal+'</digVal>'+
        (*********)'<cStat>'+IntToStr(FcStat)+'</cStat>'+
        (*********)'<xMotivo>'+FxMotivo+'</xMotivo>'+
        (******)'</infProt>'+
        {****}'</protNFe>';

     end;

    // Gerar arquivo
    if Gerador.ListaDeAlertas.Count = 0 then
    begin
      Gerador.ArquivoFormatoXML := '';
      Gerador.wGrupo(ENCODING_UTF8, '', False);
      Gerador.wGrupo('nfeProc versao="' + Versao + '" ' + NAME_SPACE, '');
      Gerador.wTexto('<NFe xmlns' + RetornarConteudoEntre(XMLNFE.Text, '<NFe xmlns', '</NFe>') + '</NFe>');
      Gerador.wTexto(xProtNFe);
      Gerador.wGrupo('/nfeProc');
    end;

    XMLNFE.Free;
    XMLinfProt.Free;
    XMLinfProt2.Free;
    Result := (Gerador.ListaDeAlertas.Count = 0);

//  end;
end;////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//              PCN - Projeto Cooperar NFe                                    //
//                                                                            //
//   Descrição: Classes para geração/leitura dos arquivos xml da NFe          //
//                                                                            //
//        site: www.projetocooperar.org                                       //
//       email: [email protected]                                //
//       forum: http://br.groups.yahoo.com/group/projeto_cooperar_nfe/        //
//     projeto: http://code.google.com/p/projetocooperar/                     //
//         svn: http://projetocooperar.googlecode.com/svn/trunk/              //
//                                                                            //
// Coordenação: © 2009 - Paulo Casagrande                                   //
//                                                                            //
//      Equipe: Vide o arquivo leiame.txt na pasta raiz do projeto            //
//                                                                            //
//      Versão: Vide o arquivo leiame.txt na pasta raiz do projeto            //
//                                                                            //
//     Licença: GNU Lesser General Public License (GNU LGPL)                  //
//                                                                            //
//              - Este programa é software livre; você pode redistribuí-lo    //
//              e/ou modificá-lo sob os termos da Licença Pública Geral GNU,  //
//              conforme publicada pela Free Software Foundation; tanto a     //
//              versão 2 da Licença como (a seu critério) qualquer versão     //
//              mais nova.                                                    //
//                                                                            //
//              - Este programa é distribuído na expectativa de ser útil,     //
//              mas SEM QUALQUER GARANTIA; sem mesmo a garantia implícita de  //
//              COMERCIALIZAÇÃO ou de ADEQUAÇÃO A QUALQUER PROPÓSITO EM       //
//              PARTICULAR. Consulte a Licença Pública Geral GNU para obter   //
//              mais detalhes. Você deve ter recebido uma cópia da Licença    //
//              Pública Geral GNU junto com este programa; se não, escreva    //
//              para a Free Software Foundation, Inc., 59 Temple Place,       //
//              Suite 330, Boston, MA - 02111-1307, USA ou consulte a         //
//              licença oficial em http://www.gnu.org/licenses/gpl.txt        //
//                                                                            //
//    Nota (1): - Esta  licença  não  concede  o  direito  de  uso  do nome   //
//              "PCN  -  Projeto  Cooperar  NFe", não  podendo o mesmo ser    //
//              utilizado sem previa autorização.                             //
//                                                                            //
//    Nota (2): - O uso integral (ou parcial) das units do projeto esta       //
//              condicionado a manutenção deste cabeçalho junto ao código     //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

unit pcnRetConsSitNFe;

interface uses
  SysUtils, Classes, pcnAuxiliar, pcnConversao, pcnLeitor, pcnProcNFe,
  pcnRetCancNFe, pcnRetEnvEventoNFe;

type

  //////////////////////////////////////////////////////////////////////////////
  //                                                                          //
  //    E M   D E S E N V O L V I M E N T O   -   N Ã O   T E S T A D O       //
  //                                                                          //
  //////////////////////////////////////////////////////////////////////////////

  {eventos_juaumkiko}
  TRetEventoNFeCollection = class;
  TRetEventoNFeCollectionItem = class;
  TRetConsSitNFe = class;

  {eventos_juaumkiko}
  TRetEventoNFeCollection = class(TCollection)
  private
    function GetItem(Index: Integer): TRetEventoNFeCollectionItem;
    procedure SetItem(Index: Integer; Value: TRetEventoNFeCollectionItem);
  public
    constructor Create(AOwner: TPersistent);
    function Add: TRetEventoNFeCollectionItem;
    property Items[index: Integer]: TRetEventoNFeCollectionItem read GetItem write SetItem; default;
  end;

  {eventos_juaumkiko}
  TRetEventoNFeCollectionItem = class(TCollectionItem)
  private
    FRetEventoNFe: TRetEventoNFe;
  public
    constructor Create; reintroduce;
    destructor Destroy; override;
  published
    property RetEventoNFe: TRetEventoNFe read FRetEventoNFe write FRetEventoNFe;
  end;

  TRetConsSitNFe = class(TPersistent)
  private
    FLeitor: TLeitor;
    FtpAmb: TpcnTipoAmbiente;
    FverAplic: string;
    FcStat: Integer;
    FxMotivo: string;
    FcUF: integer;
    FchNFe: string;
    FprotNFe: TProcNFe;
    FretCancNFe: TRetCancNFe;
    FprocEventoNFe: TRetEventoNFeCollection;   {eventos_juaumkiko}
  public
    constructor Create;
    destructor Destroy; override;
    function LerXml: boolean;
  published
    property Leitor: TLeitor read FLeitor write FLeitor;
    property tpAmb: TpcnTipoAmbiente read FtpAmb write FtpAmb;
    property verAplic: string read FverAplic write FverAplic;
    property cStat: Integer read FcStat write FcStat;
    property xMotivo: string read FxMotivo write FxMotivo;
    property cUF: integer read FcUF write FcUF;
    property chNfe: string read FchNfe write FchNfe;
    property protNFe: TProcNFe read FprotNFe write FprotNFe;
    property retCancNFe: TRetCancNFe read FretCancNFe write FretCancNFe;
    property procEventoNFe: TRetEventoNFeCollection read FprocEventoNFe write FprocEventoNFe;
  end;

implementation

{ TRetConsSitNFe }

constructor TRetConsSitNFe.Create;
begin
  FLeitor := TLeitor.Create;
  FprotNFe := TProcNFe.create;
  FretCancNFe := TRetCancNFe.create;
end;

destructor TRetConsSitNFe.Destroy;
begin
  FLeitor.Free;
  FprotNFe.Free;
  FretCancNFe.Free;
  if Assigned(procEventoNFe) then
    procEventoNFe.Free;
  inherited;
end;

function TRetConsSitNFe.LerXml: boolean;
var
  ok: boolean;
  i: integer;
begin
  Result := False;
  try
    if leitor.rExtrai(1, 'retConsSitNFe') <> '' then
    begin
      (*ER03 *)FtpAmb     := StrToTpAmb(ok, leitor.rCampo(tcStr, 'tpAmb'));
      (*ER04 *)FverAplic  := leitor.rCampo(tcStr, 'verAplic');
      (*ER05 *)FcStat     := leitor.rCampo(tcInt, 'cStat');
      (*ER06 *)FxMotivo   := leitor.rCampo(tcStr, 'xMotivo');
      (*ER07 *)FcUF       := leitor.rCampo(tcInt, 'cUF');
      (*EP07a*)FchNFe     := leitor.rCampo(tcStr, 'chNFe');
      //if FcStat in  [100,101,150,151,155] then
      if FcStat in  [100,101, 110,150,151,155] then
      begin
        if ((Leitor.rExtrai(1, 'protNFe') <> '') or (Leitor.rExtrai(1, 'infProt') <> '')) then
        begin
          protNFe.tpAmb    := StrToTpAmb(ok, Leitor.rCampo(tcStr, 'tpAmb'));
          protNFe.verAplic := Leitor.rCampo(tcStr, 'verAplic');
          protNFe.chNFe    := Leitor.rCampo(tcStr, 'chNFe');
          protNFe.dhRecbto := Leitor.rCampo(tcDatHor, 'dhRecbto');
          protNFe.nProt    := Leitor.rCampo(tcStr, 'nProt');
          protNFe.digVal   := Leitor.rCampo(tcStr, 'digVal');
          protNFe.cStat    := Leitor.rCampo(tcInt, 'cStat');
          protNFe.xMotivo  := Leitor.rCampo(tcStr, 'xMotivo');
        end;
      end;
      if FcStat in [101,151,155] then
      begin
        if Leitor.rExtrai(1, 'infCanc') <> '' then
        begin
          retCancNFe.tpAmb    := StrToTpAmb(ok, Leitor.rCampo(tcStr, 'tpAmb'));
          retCancNFe.verAplic := Leitor.rCampo(tcStr, 'verAplic');
          retCancNFe.cStat    := Leitor.rCampo(tcInt, 'cStat');
          retCancNFe.xMotivo  := Leitor.rCampo(tcStr, 'xMotivo');
          retCancNFe.cUF      := Leitor.rCampo(tcInt, 'cUF');
          retCancNFe.chNFe    := Leitor.rCampo(tcStr, 'chNFe');
          retCancNFe.dhRecbto := Leitor.rCampo(tcDatHor, 'dhRecbto');
          retCancNFe.nProt    := Leitor.rCampo(tcStr, 'nProt');
        end;
      end;
      {eventos_juaumkiko}
      if Assigned(procEventoNFe) then
        procEventoNFe.Free;
      procEventoNFe := TRetEventoNFeCollection.Create(Self);
      i:=0;
      while Leitor.rExtrai(1, 'procEventoNFe', '', i + 1) <> '' do
      begin
        procEventoNFe.Add;
        procEventoNFe.Items[i].RetEventoNFe.Leitor.Arquivo := Leitor.Grupo;
        procEventoNFe.Items[i].RetEventoNFe.LerXml;
        inc(i);
      end;
      Result := True;
    end;
  except
    Result := False;
  end;
end;

{ TRetEventoCollection }

function TRetEventoNFeCollection.Add: TRetEventoNFeCollectionItem;
begin
  Result := TRetEventoNFeCollectionItem(inherited Add);
  Result.create;
end;

constructor TRetEventoNFeCollection.Create(AOwner: TPersistent);
begin
  inherited Create(TRetEventoNFeCollectionItem);
end;

function TRetEventoNFeCollection.GetItem(Index: Integer): TRetEventoNFeCollectionItem;
begin
  Result := TRetEventoNFeCollectionItem(inherited GetItem(Index));
end;

procedure TRetEventoNFeCollection.SetItem(Index: Integer;
  Value: TRetEventoNFeCollectionItem);
begin
  inherited SetItem(Index, Value);
end;

{ TRetEventoCollectionItem }

constructor TRetEventoNFeCollectionItem.Create;
begin
  FRetEventoNFe := TRetEventoNFe.Create;
end;

destructor TRetEventoNFeCollectionItem.Destroy;
begin
  FRetEventoNFe.Free;
  inherited;
end;

end.

Carlos H. Marian

Analista de Sistemas

|/-\|

Link para o comentário
Compartilhar em outros sites

  • 1 mês depois ...
  • 5 meses depois ...
  • Membros Pro

Boa tarde

 

Esta semana foi solicitado por diversos clientes a informação do atributo ID na tag infprot.

 

 

XML da nota fiscal gerado pelo ACBr (sem a informacao de ID)

<infProt><tpAmb>1</tpAmb>
  <verAplic>13_1_02</verAplic>
  <chNFe>31131004057844000120550010001253651001253656</chNFe>
  <dhRecbto>2013-10-22T10:52:12</dhRecbto>
  <nProt>131131240224903</nProt>
  <digVal>c+jFQdFk8NT+OwS2Es44niNVmPA=</digVal>
  <cStat>100</cStat>
  <xMotivo>Autorizado o uso da NF-e</xMotivo>
</infProt>

XML da consulta da mesma NF pelo ACBr (agora com o ID)

<infProt Id="ID131131240224903">
  <tpAmb>1</tpAmb> 
  <verAplic>13_1_02</verAplic> 
  <chNFe>31131004057844000120550010001253651001253656</chNFe> 
  <dhRecbto>2013-10-22T10:52:12</dhRecbto> 
  <nProt>131131240224903</nProt> 
  <digVal>c+jFQdFk8NT+OwS2Es44niNVmPA=</digVal> 
  <cStat>100</cStat> 
  <xMotivo>Autorizado o uso da NF-e</xMotivo> 
  </infProt>

Existe algum parâmetro para que o XML seja gerado com a informação deste ID?

 

 

Ederson Selvati

Ederson Selvati
www.criareti.com.br

Skype: eselvati

Link para o comentário
Compartilhar em outros sites

  • 7 meses depois ...

Boa tarde, implementei a pouco a NF-e 3.10, e agora que fiquei ciente de tal problema, através de reclamações de clientes que estão com problemas com outros softwares de contabilidade.

 

Gostaria de saber se foi implementado alguma coisa no ACBr ou qual a posição deles para essa TAG? Entendo que não é obrigatório, mas pelo que li aqui para resolver somente se alterar alguns códigos DO ACBr para ajustar.

 

Att.,

Lucas Souza

Link para o comentário
Compartilhar em outros sites

Boa tarde Lucas,

 

Qual é a TAG que você se refere?

 

Italo, desculpa, eu não referi a TAG: infProt, referente ao ID que na 3.10 foi retirado.

 

Mas de qualquer maneira, acabei de verificar que o software de contabilidade do cliente estava desatualizado.

 

Portanto acredito que nem tenha necessidade de ser colocado no ACBr, mas fica qui a dica para quem pesquisar, peça que seja vista a atualização do programa que tiver problemas com o XML da NF-e 3.10.

 

E obrigado pela atenção Italo.

 

Att.,

Lucas Souza

Link para o comentário
Compartilhar em outros sites

Estou com um problema parecido.

Eu estou com a xml emitido de uma nfce sem problemas e faço um load deste arquivo e realizo um cancelamento, logo após o cancelamento realizo uma consultar para atualizar o xml com os dados de cancelamento e a principio esta funcionando, mas esta TAG não foi gerada neste caso, embora na emissão gerou sem problemas.

 

Att 

Marlon

Link para o comentário
Compartilhar em outros sites

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

Crie uma conta ou entre para comentar

Você precisar ser um membro para fazer um comentário

Criar uma conta

Crie uma nova conta em nossa comunidade. É fácil!

Crie uma nova conta

Entrar

Já tem uma conta? Faça o login.

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