Class: Xeroizer::Report::AgedReceivablesByContact
- Inherits:
-
Base
- Object
- Base
- Xeroizer::Report::AgedReceivablesByContact
show all
- Defined in:
- lib/xeroizer/report/aged_receivables_by_contact.rb
Instance Attribute Summary
Attributes inherited from Base
#date, #factory, #header, #id, #name, #rows, #sections, #summary, #titles, #type, #updated_at
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods included from XmlHelper
included
Instance Method Details
#sum(column_name, &block) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 33
def sum(column_name, &block)
sections.first.rows.inject(BigDecimal.new('0')) do | sum, row |
cell = row.cell(column_name)
sum += row.cell(column_name).value if row.class == Xeroizer::Report::Row && (block.nil? || block.call(row))
sum
end
end
|
#total ⇒ Object
7
8
9
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 7
def total
@_total_cache ||= summary.cell(:Total).value
end
|
#total_credited ⇒ Object
15
16
17
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 15
def total_credited
@_total_credited_cache ||= summary.cell(:Credited).value
end
|
#total_due ⇒ Object
19
20
21
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 19
def total_due
@_total_due_cache ||= summary.cell(:Due).value
end
|
#total_overdue ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 23
def total_overdue
return @_total_due_cache if @_total_due_cache
now = Time.now
@_total_due_cache = sum(:Due) do | row |
due_date = row.cell('Due Date').value
due_date && due_date < now
end
end
|
#total_paid ⇒ Object
11
12
13
|
# File 'lib/xeroizer/report/aged_receivables_by_contact.rb', line 11
def total_paid
@_total_paid_cache ||= summary.cell(:Paid).value
end
|