forked from mbulat/plutus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jQuery -> | ||
$('.datepicker').datepicker dateFormat: "yy-mm-dd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
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 | ||
@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 | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<% if accounts.count > 0%> | ||
<table class="table table-striped table-hover"> | ||
<caption class="text-left"><b><%=name%></b></caption> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<% accounts.each do |account| %> | ||
<tr class="<%= cycle("even", "odd") -%>"> | ||
<td><%=h account.name %></td> | ||
<td><%=h account.balance %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
</table> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<div class="container"> | ||
<center> | ||
<h1>Balance Sheet</h1> | ||
|
||
<%= 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" %> | ||
</div> | ||
<button type="submit" class="btn btn-default">Set Date</button> | ||
<% end %> | ||
</center> | ||
|
||
<br> | ||
|
||
<%= render 'account', :name => "Assets", :accounts => @assets %> | ||
<%= render 'account', :name => "Liabilities", :accounts => @liabilities %> | ||
<%= render 'account', :name => "Equity", :accounts => @equity %> | ||
|
||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
Plutus::Engine.routes.draw do | ||
root :to => "accounts#index" | ||
|
||
get 'reports/balance_sheet' => 'reports#balance_sheet' | ||
|
||
resources :accounts, only: [:show, :index] | ||
resources :entries, only: [:show, :index] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters