Sha256: a516e37ffd3fd694d12920b1547ffdd040ca52b1af3a9e97c6f154e64b439b49

Contents?: true

Size: 1.17 KB

Versions: 3

Compression:

Stored size: 1.17 KB

Contents

module Credere
  # == Security:
  # Only GET requests are supported. You should ensure that your application
  # controller enforces its own authentication and authorization, which this
  # controller will inherit.
  #

  class ReportsController <  Credere::ApplicationController
    unloadable

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

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credere-0.10.3 app/controllers/credere/reports_controller.rb
credere-0.10.2 app/controllers/credere/reports_controller.rb
credere-0.10.1 app/controllers/credere/reports_controller.rb