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
16 changed files
with
136 additions
and
155 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
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,39 @@ | ||
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 | ||
@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 | ||
|
||
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 = Plutus::Revenue.all | ||
@expenses = Plutus::Expense.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 |
---|---|---|
@@ -1,2 +1,5 @@ | ||
<%# add navigation links to this file %> | ||
<li><%= link_to "Dashboard", root_path%></li> | ||
<li><%= link_to "Balance Sheet", reports_balance_sheet_path%></li> | ||
<li><%= link_to "Income Statement", reports_income_statement_path%></li> | ||
<li><%= link_to "General Ledger", accounts_path%></li> | ||
<li><%= link_to "Journal", entries_path%></li> |
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 was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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 @@ | ||
<table class="table table-striped table-hover"> | ||
<caption class="text-left"><b><%=name%></b></caption> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<% if accounts.count > 0%> | ||
<tbody> | ||
<% accounts.each do |account| %> | ||
<tr class="<%= cycle("even", "odd") -%>"> | ||
<td><%=h account.name %></td> | ||
<td><%=h account.balance(:from_date => @from_date, :to_date => @to_date) %></td> | ||
</tr> | ||
<% end %> | ||
</tbody> | ||
<% end %> | ||
</table> |
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, @to_date, :class => 'datepicker form-control' %> | ||
</div> | ||
<button type="submit" class="btn btn-default">Get Report</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 |
---|---|---|
@@ -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> |
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,9 @@ | ||
Plutus::Engine.routes.draw do | ||
root :to => "accounts#index" | ||
root :to => 'reports#balance_sheet' | ||
|
||
resources :accounts, only: [:show, :index] | ||
resources :entries, only: [:show, :index] | ||
get 'reports/balance_sheet' => 'reports#balance_sheet' | ||
get 'reports/income_statement' => 'reports#income_statement' | ||
|
||
resources :accounts, only: [:index] | ||
resources :entries, only: [: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