Class: SunatBooks::Pdf::Sales

Inherits:
TradingBook show all
Includes:
PagesUtils
Defined in:
lib/sunat_books/pdf/sales.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) ⇒ Sales

Returns a new instance of Sales.



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

def initialize(company, tickets, month, year)
  super
  prawn_book("REGISTRO DE VENTAS", 29)
end

Instance Method Details

#final_row(foot_line_text, page) ⇒ Object



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

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

#render_prawn_table(data) ⇒ Object



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

def render_prawn_table(data)
  widths_columns = { 0 => 22, 1 => 35, 2 => 30, 5 => 27, 6 => 37, 8 => 20,
                     9 => 33, 10 => 27, 11 => 35, 12 => 29 }

  table(data, header: true,
              cell_style: { borders: [], size: 5, align: :right },
              column_widths: widths_columns) do
    row(0).borders = %i[bottom top]
  end
end