class Xeroizer::Report::AgedReceivablesByContact

Public Instance Methods

sum(column_name, &block) click to toggle source
# File lib/xeroizer/report/aged_receivables_by_contact.rb, line 33
def sum(column_name, &block)
  sections.first.rows.inject(BigDecimal('0')) do | sum, row |
    sum += row.cell(column_name).value if row.class == Xeroizer::Report::Row && (block.nil? || block.call(row))
    sum
  end
end
total() click to toggle source
# File lib/xeroizer/report/aged_receivables_by_contact.rb, line 7
def total
  @_total_cache ||= summary.cell(:Total).value 
end
total_credited() click to toggle source
# File lib/xeroizer/report/aged_receivables_by_contact.rb, line 15
def total_credited
  @_total_credited_cache ||= summary.cell(:Credited).value
end
total_due() click to toggle source
# File lib/xeroizer/report/aged_receivables_by_contact.rb, line 19
def total_due
  @_total_due_cache ||= summary.cell(:Due).value
end
total_overdue() click to toggle source
# 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() click to toggle source
# File lib/xeroizer/report/aged_receivables_by_contact.rb, line 11
def total_paid
  @_total_paid_cache ||= summary.cell(:Paid).value
end