Class: SunatBooks::Pdf::Page
- Defined in:
- lib/sunat_books/pdf/page.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary collapse
-
#bi_sum ⇒ Object
Returns the value of attribute bi_sum.
-
#data ⇒ Object
Returns the value of attribute data.
-
#igv_sum ⇒ Object
Returns the value of attribute igv_sum.
-
#length ⇒ Object
Returns the value of attribute length.
-
#non_taxable ⇒ Object
Returns the value of attribute non_taxable.
-
#total_sum ⇒ Object
Returns the value of attribute total_sum.
Instance Method Summary collapse
-
#initialize(page_number, length) ⇒ Page
constructor
A new instance of Page.
- #update_data_buys(ticket) ⇒ Object
- #update_data_sales(ticket) ⇒ Object
- #update_fields(fields = nil, source = nil) ⇒ Object
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
Constructor Details
#initialize(page_number, length) ⇒ Page
Returns a new instance of Page.
10 11 12 13 14 15 16 17 18 |
# File 'lib/sunat_books/pdf/page.rb', line 10 def initialize(page_number, length) @page_number = page_number @length = length @bi_sum = BigDecimal(0) @igv_sum = BigDecimal(0) @total_sum = BigDecimal(0) @non_taxable = BigDecimal(0) @data = [] end |
Instance Attribute Details
#bi_sum ⇒ Object
Returns the value of attribute bi_sum.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def bi_sum @bi_sum end |
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def data @data end |
#igv_sum ⇒ Object
Returns the value of attribute igv_sum.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def igv_sum @igv_sum end |
#length ⇒ Object
Returns the value of attribute length.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def length @length end |
#non_taxable ⇒ Object
Returns the value of attribute non_taxable.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def non_taxable @non_taxable end |
#total_sum ⇒ Object
Returns the value of attribute total_sum.
8 9 10 |
# File 'lib/sunat_books/pdf/page.rb', line 8 def total_sum @total_sum end |
Instance Method Details
#update_data_buys(ticket) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/sunat_books/pdf/page.rb', line 20 def update_data_buys(ticket) @bi_sum += ticket.taxable_to_taxable_export_bi.round(2) @igv_sum += ticket.taxable_to_taxable_export_igv.round(2) @total_sum += ticket.total_operation_buys.round(2) @non_taxable += ticket.non_taxable unless ticket.non_taxable.nil? end |
#update_data_sales(ticket) ⇒ Object
27 28 29 30 31 |
# File 'lib/sunat_books/pdf/page.rb', line 27 def update_data_sales(ticket) @bi_sum += ticket.taxable_bi.round(2) @igv_sum += ticket.igv.round(2) @total_sum += ticket.total_operation_sales.round(2) end |
#update_fields(fields = nil, source = nil) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/sunat_books/pdf/page.rb', line 33 def update_fields(fields = nil, source = nil) # update fields from a given source return if source.nil? fields&.each do |field| send("#{field}=", source.send(field)) if available?(field, source) end end |