Skip to content

Commit

Permalink
simple income statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulat committed Jul 28, 2015
1 parent b8b45f1 commit e5572f5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/controllers/plutus/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,18 @@ def balance_sheet
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
24 changes: 24 additions & 0 deletions app/views/plutus/reports/income_statement.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="container">
<center>
<h1>Income Statement</h1>

<%= form_tag({:action => 'income_statement'}, {:method => :get, :class => 'form-inline'}) do%>
<div class="form-group">
<%= label_tag :from_date, nil, class: 'sr-only'%>
<%= text_field_tag :from_date, @from_date, :class => 'datepicker form-control', :placeholder => "Date" %>
</div>
<div class="form-group">
<%= label_tag :to_date, nil, class: 'sr-only'%>
<%= text_field_tag :to_date, @to_date, :class => 'datepicker form-control', :placeholder => "Date" %>
</div>
<button type="submit" class="btn btn-default">Get Report</button>
<% end %>
</center>

<br>

<%= render 'account', :name => "Revenues", :accounts => @revenues %>
<%= render 'account', :name => "Expenses", :accounts => @expenses %>


</div>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
root :to => 'reports#balance_sheet'

get 'reports/balance_sheet' => 'reports#balance_sheet'
get 'reports/income_statement' => 'reports#income_statement'

resources :accounts, only: [:index]
resources :entries, only: [:index]
Expand Down

0 comments on commit e5572f5

Please sign in to comment.