Sha256: 6846d13cc315ff8f1ca8bf20c9f9430d1cc7a28ad270b951e51c4d35eee7a3c6

Contents?: true

Size: 1.19 KB

Versions: 7

Compression:

Stored size: 1.19 KB

Contents

module Plutus
  # == 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 <  Plutus::ApplicationController
    unloadable

    # @example
    #   GET /reports/balance_sheet
    def balance_sheet
      first_entry = Plutus::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 = Plutus::Asset.all
      @liabilities = Plutus::Liability.all
      @equity = Plutus::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 = Plutus::Revenue.all
      @expenses = Plutus::Expense.all

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

  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
plutus-0.16 app/controllers/plutus/reports_controller.rb
plutus-0.15 app/controllers/plutus/reports_controller.rb
plutus-0.14 app/controllers/plutus/reports_controller.rb
tyche-0.14 app/controllers/plutus/reports_controller.rb
odania_plutus-0.13 app/controllers/plutus/reports_controller.rb
plutus-0.13 app/controllers/plutus/reports_controller.rb
plutus-0.12.2 app/controllers/plutus/reports_controller.rb