Class: BrDanfe::DanfeLib::NfeLib::Dup

Inherits:
Object
  • Object
show all
Defined in:
lib/br_danfe/danfe_lib/nfe_lib/dup.rb

Constant Summary collapse

Y_POSITION =
12.92

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ Dup

Returns a new instance of Dup.



9
10
11
12
13
14
15
16
# File 'lib/br_danfe/danfe_lib/nfe_lib/dup.rb', line 9

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

  @y_position = Entrega.delivery_local?(@xml) ? Y_POSITION + 3.00 : Y_POSITION

  @ltitle = @y_position - 0.42
end

Instance Attribute Details

#y_positionObject (readonly)

Returns the value of attribute y_position.



5
6
7
# File 'lib/br_danfe/danfe_lib/nfe_lib/dup.rb', line 5

def y_position
  @y_position
end

Instance Method Details

#renderObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/br_danfe/danfe_lib/nfe_lib/dup.rb', line 18

def render
  @pdf.ititle 0.42, 10.00, 0.75, @ltitle, 'dup.title'
  @pdf.ibox 0.85, 19.57, 0.75, @y_position

  x = 0.75
  y = @y_position
  @xml.collect('xmlns', 'dup') do |det|
    render_dup(det, x, y)
    x += 2.30
  end
end