Class: TenantsController
- Inherits:
-
AuthorizedController
- Object
- InheritedResources::Base
- AuthorizedController
- TenantsController
- Defined in:
- app/controllers/tenants_controller.rb
Instance Method Summary collapse
Methods inherited from AuthorizedController
Instance Method Details
#balance_sheet ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/tenants_controller.rb', line 27 def balance_sheet @company = current_tenant.company # use current date if not specified otherwise if params[:by_value_period] @dates = [Date.parse(params[:by_value_period][:to])] elsif params[:years] @dates = params[:years].map{|year| current_tenant.fiscal_period(year.to_i)[:to]} else @dates = [Date.today] end end |
#current ⇒ Object
Actions
3 4 5 |
# File 'app/controllers/tenants_controller.rb', line 3 def current redirect_to current_user.tenant end |
#profit_sheet ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/tenants_controller.rb', line 7 def profit_sheet @company = current_tenant.company # use current date if not specified otherwise params[:profit] ||= {} # use current date if not specified otherwise if params[:by_value_period] @end_date = Date.parse(params[:by_value_period][:to]) @start_date = Date.parse(params[:by_value_period][:from]) @dates = [@start_date..@end_date] elsif params[:years] @dates = params[:years].map{|year| current_tenant.fiscal_period(year.to_i)[:from]..current_tenant.fiscal_period(year.to_i)[:to]} else @end_date = Date.today @start_date = @end_date.to_time.advance(:years => -1, :days => 1).to_date @dates = [@start_date..@end_date] end end |