Sha256: 431c63cb826c53219a3ad22d88bb4742bcfcc2b7a45ec5cf32147c4a10301b88
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
module BrInvoicesPdf module Cfe module Renderer module Totals extend BaseRenderer module_function def execute(pdf, data) insert_box_info(pdf, data) pdf.move_down(5) end def insert_box_info(pdf, data, xpos = 0) third_width = page_content_width(pdf) * 0.333333333 ypos = pdf.cursor box_info(data[:payment]).each do |(title, value)| insert_box(pdf, title: title, value: value, xpos: xpos, ypos: ypos, third_width: third_width) xpos += third_width end end private_class_method :insert_box_info # :reek:FeatureEnvy def insert_box(pdf, params) box(pdf, [params[:xpos], params[:ypos]], params[:third_width]) do insert_texts(pdf, params[:title], params[:value]) end end private_class_method :insert_box def insert_texts(pdf, title, value) pdf.text(title, style: :italic) pdf.text(value, align: :right) end private_class_method :insert_texts def box_info(data_payment) [ ['Total bruto dos itens', format_currency(data_payment[:total_price])], ['Desconto', format_currency(data_payment[:discount])], ['Total', format_currency(data_payment[:total])] ] end private_class_method :box_info end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
br_invoices_pdf-0.2.6 | lib/br_invoices_pdf/cfe/renderer/totals.rb |
br_invoices_pdf-0.2.6.alpha.18 | lib/br_invoices_pdf/cfe/renderer/totals.rb |