Skip to content

Commit

Permalink
update date fields on balance sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
mbulat committed Jul 28, 2015
1 parent b04ff0a commit 4e4d7bf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/controllers/plutus/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class ReportsController < Plutus::ApplicationController
# @example
# GET /reports/balance_sheet
def balance_sheet
@date = params[:date] ? Date.parse(params[:date]) : Date.today
@from_date = Plutus::Entry.order('date ASC').first.date
@to_date = params[:date] ? Date.parse(params[:date]) : Date.today
@assets = Plutus::Asset.all
@liabilities = Plutus::Liability.all
@equity = Plutus::Equity.all
Expand Down
2 changes: 1 addition & 1 deletion app/views/plutus/reports/_account.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<% accounts.each do |account| %>
<tr class="<%= cycle("even", "odd") -%>">
<td><%=h account.name %></td>
<td><%=h account.balance(:from_date => "2000-01-01", :to_date => @date) %></td>
<td><%=h account.balance(:from_date => @from_date, :to_date => @to_date) %></td>
</tr>
<% end %>
</tbody>
Expand Down
2 changes: 1 addition & 1 deletion app/views/plutus/reports/balance_sheet.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= form_tag({:action => 'balance_sheet'}, {:method => :get, :class => 'form-inline'}) do%>
<div class="form-group">
<%= label_tag :date, nil, class: 'sr-only'%>
<%= text_field_tag :date, @date, :class => 'datepicker form-control', :placeholder => "Date" %>
<%= text_field_tag :date, @to_date, :class => 'datepicker form-control' %>
</div>
<button type="submit" class="btn btn-default">Get Report</button>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Plutus::Engine.routes.draw do
root :to => "accounts#index"
root :to => 'reports#balance_sheet'

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

Expand Down

0 comments on commit 4e4d7bf

Please sign in to comment.