Class: BrDanfe::DanfeLib::NfeLib::Issqn

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

Constant Summary collapse

Y_POSITION =
25.72 + SPACE_BETWEEN_GROUPS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ Issqn

Returns a new instance of Issqn.



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

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

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

  @serv = 'total/ISSQNtot/vServ'
  @bc = 'total/ISSQNtot/vBC'
  @iss = 'total/ISSQNtot/vISS'
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/issqn.rb', line 5

def y_position
  @y_position
end

Instance Method Details

#renderObject



21
22
23
24
25
26
27
28
29
# File 'lib/br_danfe/danfe_lib/nfe_lib/issqn.rb', line 21

def render
  if can_render?
    @pdf.ititle 0.42, 10.00, 0.75, @title, 'issqn.title'
    @pdf.lbox LINE_HEIGHT, 4.64, 0.75, @y_position, @xml, 'emit/IM'
    @pdf.lnumeric LINE_HEIGHT, 5.14, 5.39, @y_position, @xml, @serv
    @pdf.lnumeric LINE_HEIGHT, 5.14, 10.53, @y_position, @xml, @bc
    @pdf.lnumeric LINE_HEIGHT, 4.64, 15.67, @y_position, @xml, @iss
  end
end