Class: SunatBooks::Pdf::Buys

Inherits:
TradingBook show all
Includes:
PagesUtils
Defined in:
lib/sunat_books/pdf/buys.rb

Constant Summary

Constants included from Utils

Utils::MONTHS

Instance Method Summary collapse

Methods included from PagesUtils

#not_moviment_page, #page_index, #page_not_full, #row_data, #setup_final_row_data, #setup_new_page, #setup_pages, #setup_row_pages, #split_data

Methods inherited from TradingBook

#book_body, #prawn_book

Methods inherited from Base

#book_header, #book_title, #get_counts, #get_mother_counts, #get_value, #make_sub_table, #prawn_header, #sub_head, #sub_head_options, #sub_head_table, #table_body, #table_hash, #table_head

Methods included from Utils

#add_align, #add_widths, #field_value, #formated_number, #get_column_widths, #get_date, #get_period, #get_row_sums, #order_data_row, #parse_day, #sum_count, #txt, #zero

Methods included from CommonUtils

#available_value?

Constructor Details

#initialize(company, tickets, month, year) ⇒ Buys

Returns a new instance of Buys.



11
12
13
14
# File 'lib/sunat_books/pdf/buys.rb', line 11

def initialize(company, tickets, month, year)
  super
  prawn_book("REGISTRO DE COMPRAS", 27)
end

Instance Method Details

#final_row(foot_line_text, page) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/sunat_books/pdf/buys.rb', line 16

def final_row(foot_line_text, page)
  [{ content: foot_line_text, colspan: 5 },
   make_sub_table([page.bi_sum, page.igv_sum], 32),
   make_sub_table([zero, zero], 25),
   make_sub_table([zero, zero], 25),
   formated_number(page.non_taxable),
   zero, zero,
   formated_number(page.total_sum)]
end

#render_prawn_table(data) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/sunat_books/pdf/buys.rb', line 26

def render_prawn_table(data)
  table(data, header: true, cell_style: { borders: [], size: 5,
                                          align: :right },
              column_widths: { 0 => 22, 1 => 35, 2 => 30, 8 => 30,
                               10 => 30, 9 => 22, 11 => 33, 12 => 33 }) do
    row(0).borders = i[bottom top]
  end
end