Module: RisingSun::Fiscali::InstanceMethods

Defined in:
lib/rising_sun/fiscali.rb

Instance Method Summary collapse

Instance Method Details

#beginning_of_financial_halfObject



108
109
110
# File 'lib/rising_sun/fiscali.rb', line 108

def beginning_of_financial_half
  beginning_of_financial_year.months_since(((months_between / 6).floor) * 6)
end

#beginning_of_financial_q2Object



61
62
63
# File 'lib/rising_sun/fiscali.rb', line 61

def beginning_of_financial_q2
  beginning_of_financial_year + 3.months
end

#beginning_of_financial_q3Object Also known as: beginning_of_financial_h2



69
70
71
# File 'lib/rising_sun/fiscali.rb', line 69

def beginning_of_financial_q3
  beginning_of_financial_year + 6.months
end

#beginning_of_financial_q4Object



77
78
79
# File 'lib/rising_sun/fiscali.rb', line 77

def beginning_of_financial_q4
  beginning_of_financial_year + 9.months
end

#beginning_of_financial_quarterObject



104
105
106
# File 'lib/rising_sun/fiscali.rb', line 104

def beginning_of_financial_quarter
  beginning_of_financial_year.months_since(((months_between / 3).floor) * 3)
end

#beginning_of_financial_yearObject Also known as: beginning_of_financial_q1, beginning_of_financial_h1



48
49
50
# File 'lib/rising_sun/fiscali.rb', line 48

def beginning_of_financial_year
  change(:year => financial_year, :month => start_month, :day => 1)
end

#end_of_financial_q1Object



57
58
59
# File 'lib/rising_sun/fiscali.rb', line 57

def end_of_financial_q1
  end_of_financial_year - 9.months
end

#end_of_financial_q2Object Also known as: end_of_financial_h1



65
66
67
# File 'lib/rising_sun/fiscali.rb', line 65

def end_of_financial_q2
  end_of_financial_year - 6.months
end

#end_of_financial_q3Object



73
74
75
# File 'lib/rising_sun/fiscali.rb', line 73

def end_of_financial_q3
  end_of_financial_year - 3.months
end

#end_of_financial_yearObject Also known as: end_of_financial_q4, end_of_financial_h2



52
53
54
# File 'lib/rising_sun/fiscali.rb', line 52

def end_of_financial_year
  (beginning_of_financial_year + 1.year - 1.month).end_of_month
end

#financial_halfObject



92
93
94
# File 'lib/rising_sun/fiscali.rb', line 92

def financial_half
  "H#{( months_between / 6 ).floor + 1} #{financial_year}"
end

#financial_month_of(month) ⇒ Object



120
121
122
123
124
125
126
# File 'lib/rising_sun/fiscali.rb', line 120

def financial_month_of(month)
  if month < start_month
    Date.new(year+1,month,1) 
  else
    Date.new(year,month,1) 
  end
end

#financial_quarterObject



88
89
90
# File 'lib/rising_sun/fiscali.rb', line 88

def financial_quarter
  "Q#{( months_between / 3 ).floor + 1} #{financial_year}"
end

#financial_yearObject



44
45
46
# File 'lib/rising_sun/fiscali.rb', line 44

def financial_year
  self.month < start_month ? self.year - 1 : self.year
end

#next_financial_halfObject



100
101
102
# File 'lib/rising_sun/fiscali.rb', line 100

def next_financial_half
  beginning_of_financial_year.months_since(((months_between / 6).floor + 1) * 6)
end

#next_financial_quarterObject



96
97
98
# File 'lib/rising_sun/fiscali.rb', line 96

def next_financial_quarter
  beginning_of_financial_year.months_since(((months_between / 3).floor + 1 ) * 3)
end

#previous_financial_halfObject



116
117
118
# File 'lib/rising_sun/fiscali.rb', line 116

def previous_financial_half
  beginning_of_financial_half.months_ago(6)
end

#previous_financial_quarterObject



112
113
114
# File 'lib/rising_sun/fiscali.rb', line 112

def previous_financial_quarter
  beginning_of_financial_quarter.months_ago(3)
end