22using DFe . Utils ;
33using NFe . Classes ;
44using NFe . Classes . Informacoes . Destinatario ;
5+ using NFe . Classes . Informacoes . Identificacao . Tipos ;
56using NFe . Classes . Informacoes . Pagamento ;
67using NFe . Utils ;
78using NFe . Utils . InformacoesSuplementares ;
@@ -350,6 +351,27 @@ private void Rodape(IContainer container)
350351
351352 column . Item ( ) . LineHorizontal ( 1 ) ;
352353
354+ if ( DeveExibirMensagemContingencia ( ) )
355+ {
356+ column . Item ( ) . Row ( r =>
357+ {
358+ r . RelativeItem ( ) . AlignCenter ( ) . Column ( c =>
359+ {
360+ c . Item ( ) . AlignCenter ( ) . Text ( "EMITIDA EM CONTINGÊNCIA" ) . FontSize ( _tamanhoFontePadrao ) . ExtraBlack ( ) ;
361+ } ) ;
362+ } ) ;
363+
364+ column . Item ( ) . Row ( r =>
365+ {
366+ r . RelativeItem ( ) . AlignCenter ( ) . Column ( c =>
367+ {
368+ c . Item ( ) . AlignCenter ( ) . Text ( "Pendente de autorização" ) . FontSize ( _tamanhoFontePadrao ) . ExtraBlack ( ) ;
369+ } ) ;
370+ } ) ;
371+
372+ column . Item ( ) . LineHorizontal ( 1 ) ;
373+ }
374+
353375 column . Item ( ) . Row ( r =>
354376 {
355377 r . RelativeItem ( ) . AlignCenter ( ) . Column ( c =>
@@ -373,11 +395,18 @@ private void Rodape(IContainer container)
373395 t . Cell ( ) . AlignCenter ( ) . Image ( ImagemQrCode ( ) ) ;
374396 t . Cell ( ) . AlignLeft ( ) . Column ( c =>
375397 {
376- c . Item ( ) . Text ( $ "Série: { _nfe . infNFe . ide . serie : D3} ") . FontSize ( _tamanhoFontePadrao ) ;
377- c . Item ( ) . Text ( $ "Número: { _nfe . infNFe . ide . nNF : D9} ") . FontSize ( _tamanhoFontePadrao ) ;
378- c . Item ( ) . Text ( $ "Emissão: { _nfeProc . NFe . infNFe . ide . dhEmi : G} ") . FontSize ( _tamanhoFontePadrao ) ;
379- c . Item ( ) . Text ( $ "Protocolo: { _nfeProc . protNFe . infProt . nProt } ") . FontSize ( _tamanhoFontePadrao ) ;
380- c . Item ( ) . Text ( $ "Autorização: { _nfeProc . protNFe . infProt . dhRecbto : G} ") . FontSize ( _tamanhoFontePadrao ) ;
398+ if ( _nfe ? . infNFe ? . ide != null )
399+ {
400+ c . Item ( ) . Text ( $ "Série: { _nfe . infNFe . ide . serie : D3} ") . FontSize ( _tamanhoFontePadrao ) ;
401+ c . Item ( ) . Text ( $ "Número: { _nfe . infNFe . ide . nNF : D9} ") . FontSize ( _tamanhoFontePadrao ) ;
402+ c . Item ( ) . Text ( $ "Emissão: { _nfe . infNFe . ide . dhEmi : G} ") . FontSize ( _tamanhoFontePadrao ) ;
403+ }
404+
405+ if ( DeveExibirDadosProtocolo ( ) )
406+ {
407+ c . Item ( ) . Text ( $ "Protocolo: { _nfeProc ! . protNFe ! . infProt . nProt } ") . FontSize ( _tamanhoFontePadrao ) ;
408+ c . Item ( ) . Text ( $ "Autorização: { _nfeProc ! . protNFe ! . infProt . dhRecbto : G} ") . FontSize ( _tamanhoFontePadrao ) ;
409+ }
381410 } ) ;
382411 } ) ;
383412 } ) ;
@@ -532,6 +561,8 @@ private void CarregarXml(string xml)
532561 {
533562 try
534563 {
564+ _nfeProc = null ;
565+ _nfe = null ;
535566 _nfeProc = FuncoesXml . XmlStringParaClasse < nfeProc > ( xml ) ;
536567 _nfe = _nfeProc . NFe ;
537568 }
@@ -541,6 +572,7 @@ private void CarregarXml(string xml)
541572 {
542573 NFe . Classes . NFe nfe = FuncoesXml . XmlStringParaClasse < NFe . Classes . NFe > ( xml ) ;
543574 _nfe = nfe ;
575+ _nfeProc = null ;
544576 }
545577 catch ( Exception )
546578 {
@@ -550,6 +582,16 @@ private void CarregarXml(string xml)
550582 }
551583 }
552584
585+ private bool DeveExibirMensagemContingencia ( )
586+ {
587+ return _nfe ? . infNFe ? . ide ? . tpEmis == TipoEmissao . teOffLine && _nfeProc == null ;
588+ }
589+
590+ private bool DeveExibirDadosProtocolo ( )
591+ {
592+ return _nfeProc ? . protNFe ? . infProt != null && ! DeveExibirMensagemContingencia ( ) ;
593+ }
594+
553595 private string ObtemDescricao ( FormaPagamento ? formaPagamento )
554596 {
555597 var existeEnum = Enum
0 commit comments