Class: BrDanfe::MdfeLib::FiscoControl

Inherits:
Object
  • Object
show all
Defined in:
lib/br_danfe/mdfe_lib/fisco_control.rb

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ FiscoControl

Returns a new instance of FiscoControl.



4
5
6
7
# File 'lib/br_danfe/mdfe_lib/fisco_control.rb', line 4

def initialize(pdf, xml)
  @pdf = pdf
  @nfe_key = xml['mdfeProc > protMDFe > infProt > chMDFe']
end

Instance Method Details

#generateObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/br_danfe/mdfe_lib/fisco_control.rb', line 9

def generate
  @pdf.text_box('CONTROLE DO FISCO', size: 9, align: :left, at: [250, 600])

  return if @nfe_key.blank?

  Barby::Code128C.new(@nfe_key).annotate_pdf(@pdf, x: 250, y: 530, height: 50)

  @pdf.text_box('Chave de Acesso', size: 9, align: :left, style: :bold, at: [250, 510])
  @pdf.text_box(@nfe_key, size: 11, align: :left, at: [250, 500])
end