Class: Tenant

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/tenant.rb

Instance Method Summary collapse

Instance Method Details

#fiscal_period(year) ⇒ Object



20
21
22
23
24
25
# File 'app/models/tenant.rb', line 20

def fiscal_period(year)
  final_day_of_fiscal_year = Date.new(year, fiscal_year_ends_on.month, fiscal_year_ends_on.day)
  first_day_of_fiscal_year = final_day_of_fiscal_year.ago(1.year).in(1.day)

  return :from => first_day_of_fiscal_year.to_date, :to => final_day_of_fiscal_year.to_date
end

#fiscal_yearsObject



27
28
29
30
31
32
33
34
35
36
37
# File 'app/models/tenant.rb', line 27

def fiscal_years
  first_year = fiscal_year_ends_on.year
  final_year = Date.today.year + 1

  years = {}
  (first_year..final_year).map{|year|
    years[year] = fiscal_period(year)
  }

  return years
end

#to_sObject

String



12
13
14
# File 'app/models/tenant.rb', line 12

def to_s
  company.to_s
end