Sha256: 75ec933afcbc91ec23527f18232d50f4303ff3fff2d54f73fb892a7fe486f64d

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

module Borutus
  # == Security:
  # Only GET requests are supported. You should ensure that your application
  # controller enforces its own authentication and authorization, which this
  # controller will inherit.
  #
  # @author Michael Bulat
  class ReportsController < ::Borutus::ApplicationController
    unloadable

    # @example
    #   GET /reports/balance_sheet
    def balance_sheet
      first_entry = Borutus::Entry.order('date ASC').first
      @from_date = first_entry ? first_entry.date: Date.today
      @to_date = params[:date] ? Date.parse(params[:date]) : Date.today
      @assets = Borutus::Asset.all
      @liabilities = Borutus::Liability.all
      @equity = Borutus::Equity.all

      respond_to do |format|
        format.html # index.html.erb
      end
    end

    # @example
    #   GET /reports/income_statement
    def income_statement
      @from_date = params[:from_date] ? Date.parse(params[:from_date]) : Date.today.at_beginning_of_month
      @to_date = params[:to_date] ? Date.parse(params[:to_date]) : Date.today
      @revenues = Borutus::Revenue.all
      @expenses = Borutus::Expense.all

      respond_to do |format|
        format.html # index.html.erb
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
borutus-1.0.0 app/controllers/borutus/reports_controller.rb
borutus-0.2.4 app/controllers/borutus/reports_controller.rb
borutus-0.2.3 app/controllers/borutus/reports_controller.rb
borutus-0.2.2 app/controllers/borutus/reports_controller.rb
borutus-0.2.1 app/controllers/borutus/reports_controller.rb
borutus-0.2.0 app/controllers/borutus/reports_controller.rb
borutus-0.1.0 app/controllers/borutus/reports_controller.rb