Class: Plutus::ReportsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/plutus/reports_controller.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#balance_sheetObject

Examples:

GET /reports/balance_sheet

13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/controllers/plutus/reports_controller.rb', line 13

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

#income_statementObject

Examples:

GET /reports/income_statement

28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/plutus/reports_controller.rb', line 28

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