Class: BrDanfe::DanfeLib::NfeLib::Transp

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

Constant Summary collapse

Y_POSITION =
15.89 + SPACE_BETWEEN_GROUPS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pdf, xml) ⇒ Transp

Returns a new instance of Transp.



9
10
11
12
13
14
15
16
17
18
# File 'lib/br_danfe/danfe_lib/nfe_lib/transp.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
  @l1 = @y_position
  @l2 = @y_position + LINE_HEIGHT
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/transp.rb', line 5

def y_position
  @y_position
end

Instance Method Details

#renderObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/br_danfe/danfe_lib/nfe_lib/transp.rb', line 20

def render
  @pdf.ititle 0.42, 10.00, 0.75, @ltitle, 'transporta.title'

  @pdf.lbox LINE_HEIGHT, 8.52, 0.75, @l1, @xml, 'transporta/xNome'
  @pdf.i18n_lbox LINE_HEIGHT, 2.79, 9.27, @l1, 'transp.modFrete.title', mod_frete
  @pdf.lbox LINE_HEIGHT, 1.78, 12.06, @l1, @xml, 'veicTransp/RNTC'
  @pdf.i18n_lbox LINE_HEIGHT, 2.29, 13.84, @l1, 'veicTransp.placa', plate
  @pdf.lbox LINE_HEIGHT, 0.76, 16.13, @l1, @xml, 'veicTransp/UF'
  @pdf.lcnpj LINE_HEIGHT, 3.44, 16.89, @l1, @xml, 'transporta/CNPJ'
  @pdf.lbox LINE_HEIGHT, 8.52, 0.75, @l2, @xml, 'transporta/xEnder'
  @pdf.lbox LINE_HEIGHT, 6.86, 9.27, @l2, @xml, 'transporta/xMun'
  @pdf.lbox LINE_HEIGHT, 0.76, 16.13, @l2, @xml, 'transporta/UF'
  @pdf.lie LINE_HEIGHT, 3.44, 16.89, @l2, @xml, 'transporta/UF', 'transporta/IE'
end