class BrDanfe::DanfeLib::NfeLib::Issqn

Constants

Y_POSITION

Attributes

y_position[R]

Public Class Methods

new(pdf, xml) click to toggle source
# 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

Public Instance Methods

render() click to toggle source
# 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

Private Instance Methods

can_render?() click to toggle source
# File lib/br_danfe/danfe_lib/nfe_lib/issqn.rb, line 33
def can_render?
  @xml[@serv].to_f.positive? || @xml[@bc].to_f.positive? || @xml[@iss].to_f.positive?
end