asanghi-fiscali 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +135 -4
- data/VERSION +1 -1
- data/fiscali.gemspec +1 -1
- data/lib/rising_sun/fiscali.rb +1 -0
- metadata +1 -1
data/README.markdown
CHANGED
@@ -26,16 +26,147 @@ Next step is to provide your Date/Time class your start zone. Stick this in an i
|
|
26
26
|
|
27
27
|
Date.fiscal_zone = :india
|
28
28
|
Time.fiscal_zone = :india
|
29
|
-
|
29
|
+
or
|
30
30
|
Date.start_month = 4
|
31
31
|
|
32
32
|
|
33
33
|
### Default options
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
By default, the financial year start in January. (Correct me but thats not a common start of financial year!)
|
36
|
+
Known Zones are -
|
37
37
|
{:india => 4, :uk => 4, :us => 10, :pakistan => 7,
|
38
38
|
:australia => 7, :ireland => 1, :nz => 7, :japan => 4}
|
39
39
|
|
40
|
-
##
|
40
|
+
## Date or Time Class Methods
|
41
|
+
|
42
|
+
Date.fy_start_month
|
43
|
+
=> 1
|
44
|
+
Date.fiscal_zone = :india
|
45
|
+
=> :india
|
46
|
+
Date.fy_start_month
|
47
|
+
=> 4
|
48
|
+
Date.fiscal_zone
|
49
|
+
=> :india
|
50
|
+
Date.fy_start_month = 7
|
51
|
+
=> 7
|
52
|
+
Date.fy_start_month
|
53
|
+
=> 7
|
54
|
+
Date.fiscal_zone
|
55
|
+
=> nil
|
56
|
+
|
57
|
+
If you want to add your own fiscal zone
|
58
|
+
|
59
|
+
RisingSun::Fiscali::FISCAL_ZONE.merge!(:my_own_zone => 2)
|
60
|
+
|
61
|
+
should do the trick.
|
62
|
+
|
63
|
+
## Date or Time Instance Methods
|
64
|
+
|
65
|
+
Date.fiscal_zone = :india
|
66
|
+
=> :india
|
67
|
+
Date.fy_start_month
|
68
|
+
=> 4
|
69
|
+
|
70
|
+
Indian Fiscal Year starts from 1st of April
|
71
|
+
Assume Date.today is 1st May 2009
|
72
|
+
|
73
|
+
|
74
|
+
* financial_year
|
75
|
+
Returns the financial year of the date/time
|
76
|
+
Date.today.financial_year
|
77
|
+
=> 2009
|
78
|
+
Date.today.beginning_of_year.financial_year
|
79
|
+
=> 2008
|
80
|
+
Since 1st Jan 2009 in India falls in the 2008-09 financial year
|
81
|
+
|
82
|
+
* beginning_of_financial_year
|
83
|
+
Returns the beginning of financial year
|
84
|
+
Date.today.beginning_of_financial_year
|
85
|
+
=> 1st April 2009
|
86
|
+
Date.today.beginning_of_year.beginning_of_financial_year
|
87
|
+
=> 1st April 2008
|
88
|
+
|
89
|
+
* end_of_financial_year
|
90
|
+
|
91
|
+
* beginning_of_financial_q1
|
92
|
+
* end_of_financial_q1
|
93
|
+
|
94
|
+
* beginning_of_financial_q2
|
95
|
+
* end_of_financial_q2
|
96
|
+
|
97
|
+
* beginning_of_financial_q3
|
98
|
+
* end_of_financial_q3
|
99
|
+
|
100
|
+
* beginning_of_financial_q4
|
101
|
+
* end_of_financial_q4
|
102
|
+
|
103
|
+
* beginning_of_financial_h1
|
104
|
+
* end_of_financial_h1
|
105
|
+
|
106
|
+
* beginning_of_financial_h2
|
107
|
+
* end_of_financial_h2
|
108
|
+
|
109
|
+
* financial_quarter
|
110
|
+
Returns Q1, Q2, Q3, Q4 depending on where the date falls
|
111
|
+
Date.today.financial_quarter
|
112
|
+
=> Q1
|
113
|
+
Date.today.beginning_of_year.financial_quarter
|
114
|
+
=> Q4
|
115
|
+
|
116
|
+
* financial_half
|
117
|
+
Returns H1, H2 depending on where the date falls
|
118
|
+
Date.today.financial_half
|
119
|
+
=> H1
|
120
|
+
Date.today.beginning_of_year.financial_half
|
121
|
+
=> H2
|
122
|
+
|
123
|
+
* next_financial_quarter
|
124
|
+
Takes you to the beginning of the next financial quarter
|
125
|
+
Date.today.next_financial_quarter
|
126
|
+
=> 1st July 2009
|
127
|
+
|
128
|
+
* next_financial_half
|
129
|
+
Takes you to the beginning of the next financial half
|
130
|
+
Date.today.next_financial_half
|
131
|
+
=> 1st October 2009
|
132
|
+
|
133
|
+
* beginning_of_financial_quarter
|
134
|
+
Take you to the beginning of the current financial quarter
|
135
|
+
Date.today.beginning_of_financial_quarter
|
136
|
+
=> 1st April 2009
|
137
|
+
Date.today.beginning_of_year.beginning_of_financial_quarter
|
138
|
+
=> 1st Jan 2009
|
139
|
+
|
140
|
+
* beginning_of_financial_half
|
141
|
+
Take you to the beginning of the current financial half
|
142
|
+
Date.today.beginning_of_financial_half
|
143
|
+
=> 1st April 2009
|
144
|
+
Date.today.beginning_of_year.beginning_of_financial_quarter
|
145
|
+
=> 1st Oct 2008
|
146
|
+
|
147
|
+
* previous_financial_quarter
|
148
|
+
Take you to the beginning of the previous financial quarter
|
149
|
+
Date.today.previous_financial_quarter
|
150
|
+
=> 1st Jan 2009
|
151
|
+
Date.today.beginning_of_year.previous_financial_quarter
|
152
|
+
=> 1st Oct 2008
|
153
|
+
|
154
|
+
* previous_financial_half
|
155
|
+
Take you to the beginning of the previous financial half
|
156
|
+
Date.today.previous_financial_half
|
157
|
+
=> 1st Oct 2008
|
158
|
+
Date.today.beginning_of_year.previous_financial_quarter
|
159
|
+
=> 1st Apr 2008
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
41
169
|
|
170
|
+
|
171
|
+
|
172
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.5
|
data/fiscali.gemspec
CHANGED
data/lib/rising_sun/fiscali.rb
CHANGED