Class: BrDanfe::DanfeLib::NfceLib::NfceIdentification

Inherits:
Object
  • Object
show all
Defined in:
lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ NfceIdentification

Returns a new instance of NfceIdentification.



5
6
7
8
# File 'lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb', line 5

def initialize(pdf, xml)
  @pdf = pdf
  @xml = xml
end

Instance Method Details

#renderObject



10
11
12
13
14
15
16
17
18
# File 'lib/br_danfe/danfe_lib/nfce_lib/nfce_identification.rb', line 10

def render
  emitted_at = BrDanfe::Helper.format_datetime(@xml['ide/dhEmi'])
  identification = "NFC-e nº #{@xml['ide/nNF']} Série #{@xml['ide/serie']} #{emitted_at}"

  @pdf.render_blank_line
  @pdf.text identification, size: 9, align: :center, style: :bold
  @pdf.text "<b>Protocolo de autorização:</b> #{@xml['infProt/nProt']}", size: 9, align: :center, inline_format: true
  @pdf.text "<b>Data de autorização: </b> #{BrDanfe::Helper.format_datetime(@xml['infProt/dhRecbto'])}", size: 9, align: :center, inline_format: true
end