module BrInvoicesPdf::Cfe::Renderer::PaymentForms
Public Instance Methods
add_default_values(payments_data, data)
click to toggle source
# File lib/br_invoices_pdf/cfe/renderer/payment_forms.rb, line 40 def add_default_values(payments_data, data) payments_data.push(['TROCO', format_currency(data[:cashback])]) payments_data.push(['TOTAL', format_currency(data[:paid])]) end
execute(pdf, data)
click to toggle source
# File lib/br_invoices_pdf/cfe/renderer/payment_forms.rb, line 12 def execute(pdf, data) execute_payment_form(pdf, payments_table_data(data)) end
format_table(table, table_data)
click to toggle source
:reek: FeatureEnvy
# File lib/br_invoices_pdf/cfe/renderer/payment_forms.rb, line 24 def format_table(table, table_data) table.columns([0, 1]).valign = :center table.columns(1).align = :right table_size = table_data.size table.row([0, table_size - 1]).font_style = :bold table.row([0, table_size - 2]).font_style = :bold end
payments_table_data(data)
click to toggle source
# File lib/br_invoices_pdf/cfe/renderer/payment_forms.rb, line 33 def payments_table_data(data) payments_data = mount_payment_data(data) add_default_values(payments_data, data[:totals]) end
render_table(pdf, table_data, width)
click to toggle source
# File lib/br_invoices_pdf/cfe/renderer/payment_forms.rb, line 16 def render_table(pdf, table_data, width) pdf.table(table_data, width: width) do |table| format_table(table, table_data) end end