class BrDanfe::DanfeLib::NfeLib::Dup
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/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
Public Instance Methods
render()
click to toggle source
# 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
Private Instance Methods
dtduplicata(det)
click to toggle source
# File lib/br_danfe/danfe_lib/nfe_lib/dup.rb, line 43 def dtduplicata(det) dtduplicata = det.css('dVenc').text "#{dtduplicata[8, 2]}/#{dtduplicata[5, 2]}/#{dtduplicata[0, 4]}" end
italic()
click to toggle source
# File lib/br_danfe/danfe_lib/nfe_lib/dup.rb, line 52 def italic normal.merge(style: :italic) end
normal()
click to toggle source
# File lib/br_danfe/danfe_lib/nfe_lib/dup.rb, line 48 def normal { size: 6, border: 0 } end
render_dup(det, x, y)
click to toggle source
# File lib/br_danfe/danfe_lib/nfe_lib/dup.rb, line 32 def render_dup(det, x, y) @pdf.ibox 0.85, 2.12, x, y, '', I18n.t('danfe.dup.nDup'), italic @pdf.ibox 0.85, 2.12, x + 0.70, y, '', det.css('nDup').text, normal @pdf.ibox 0.85, 2.12, x, y + 0.20, '', I18n.t('danfe.dup.dVenc'), italic @pdf.ibox 0.85, 2.12, x + 0.70, y + 0.20, '', dtduplicata(det), normal @pdf.ibox 0.85, 2.12, x, y + 0.40, '', I18n.t('danfe.dup.vDup'), italic @pdf.inumeric 0.85, 1.25, x + 0.70, y + 0.40, '', det.css('vDup').text, normal end