odania_plutus 0.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +23 -0
- data/README.markdown +394 -0
- data/Rakefile +11 -0
- data/app/assets/javascripts/plutus/application.js +16 -0
- data/app/assets/javascripts/plutus/reports.js +5 -0
- data/app/assets/stylesheets/bootstrap-theme.min.css +5 -0
- data/app/assets/stylesheets/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/plutus/application.css +19 -0
- data/app/controllers/plutus/accounts_controller.rb +30 -0
- data/app/controllers/plutus/application_controller.rb +4 -0
- data/app/controllers/plutus/entries_controller.rb +34 -0
- data/app/controllers/plutus/reports_controller.rb +40 -0
- data/app/models/plutus/account.rb +170 -0
- data/app/models/plutus/amount.rb +22 -0
- data/app/models/plutus/amounts_extension.rb +42 -0
- data/app/models/plutus/asset.rb +56 -0
- data/app/models/plutus/credit_amount.rb +10 -0
- data/app/models/plutus/debit_amount.rb +10 -0
- data/app/models/plutus/entry.rb +77 -0
- data/app/models/plutus/equity.rb +56 -0
- data/app/models/plutus/expense.rb +56 -0
- data/app/models/plutus/liability.rb +56 -0
- data/app/models/plutus/no_tenancy.rb +9 -0
- data/app/models/plutus/revenue.rb +56 -0
- data/app/models/plutus/tenancy.rb +15 -0
- data/app/views/layouts/plutus/_messages.html.erb +9 -0
- data/app/views/layouts/plutus/_navigation.html.erb +19 -0
- data/app/views/layouts/plutus/_navigation_links.html.erb +5 -0
- data/app/views/layouts/plutus/application.html.erb +19 -0
- data/app/views/plutus/accounts/index.html.erb +26 -0
- data/app/views/plutus/entries/index.html.erb +59 -0
- data/app/views/plutus/reports/_account.html.erb +28 -0
- data/app/views/plutus/reports/balance_sheet.html.erb +21 -0
- data/app/views/plutus/reports/income_statement.html.erb +24 -0
- data/config/backtrace_silencers.rb +7 -0
- data/config/database.yml +5 -0
- data/config/inflections.rb +10 -0
- data/config/mime_types.rb +5 -0
- data/config/routes.rb +9 -0
- data/config/secret_token.rb +7 -0
- data/config/session_store.rb +8 -0
- data/lib/generators/plutus/USAGE +22 -0
- data/lib/generators/plutus/add_date_upgrade_generator.rb +11 -0
- data/lib/generators/plutus/base_generator.rb +19 -0
- data/lib/generators/plutus/plutus_generator.rb +12 -0
- data/lib/generators/plutus/templates/add_date_migration.rb +6 -0
- data/lib/generators/plutus/templates/migration.rb +39 -0
- data/lib/generators/plutus/templates/tenant_migration.rb +6 -0
- data/lib/generators/plutus/templates/update_migration.rb +17 -0
- data/lib/generators/plutus/tenancy_generator.rb +12 -0
- data/lib/generators/plutus/upgrade_plutus_generator.rb +12 -0
- data/lib/plutus.rb +23 -0
- data/lib/plutus/version.rb +3 -0
- data/spec/controllers/accounts_controller_spec.rb +19 -0
- data/spec/controllers/entries_controller_spec.rb +19 -0
- data/spec/controllers/reports_controller_spec.rb +24 -0
- data/spec/factories/account_factory.rb +35 -0
- data/spec/factories/amount_factory.rb +19 -0
- data/spec/factories/entry_factory.rb +11 -0
- data/spec/lib/plutus_spec.rb +0 -0
- data/spec/models/account_spec.rb +133 -0
- data/spec/models/amount_spec.rb +8 -0
- data/spec/models/asset_spec.rb +7 -0
- data/spec/models/credit_amount_spec.rb +7 -0
- data/spec/models/debit_amount_spec.rb +7 -0
- data/spec/models/entry_spec.rb +170 -0
- data/spec/models/equity_spec.rb +7 -0
- data/spec/models/expense_spec.rb +7 -0
- data/spec/models/liability_spec.rb +7 -0
- data/spec/models/revenue_spec.rb +7 -0
- data/spec/models/tenancy_spec.rb +45 -0
- data/spec/rcov.opts +2 -0
- data/spec/routing/accounts_routing_spec.rb +13 -0
- data/spec/routing/entries_routing_spec.rb +13 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/account_shared_examples.rb +60 -0
- data/spec/support/active_support_helpers.rb +13 -0
- data/spec/support/amount_shared_examples.rb +21 -0
- data/spec/support/factory_girl_helpers.rb +8 -0
- metadata +225 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cc6be8ce8542b95a263675531a06a3f8e86d2156
|
4
|
+
data.tar.gz: e1ba4dbfe7ef44f95fc144aeb66f6640cd7f4283
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f79e0de3ddf04a715241ee21aabec3a8802d8f349902342491ff01509297ce274557053e969e476e9545c75ddf12f1503ff4623c55575852fdcd5277ba027f1e
|
7
|
+
data.tar.gz: 1d1409ee1c2f46c68023a6f1f003e5adbf79ce2e7ddaca02f988d3ee0ce27d8539ad8ec7c723db980a7e3fc973f9f5ed3c59b8b570e9c532f4aa9342604a5463
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Copyright (c) 2010 Michael Bulat
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
Except as contained in this notice, the name(s) of the above copyright holders
|
14
|
+
shall not be used in advertising or otherwise to promote the sale, use or
|
15
|
+
other dealings in this Software without prior written authorization.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,394 @@
|
|
1
|
+
Plutus
|
2
|
+
=================
|
3
|
+
[![Build Status](https://travis-ci.org/mbulat/plutus.svg?branch=master)](https://travis-ci.org/mbulat/plutus) [![Coverage Status](https://coveralls.io/repos/github/mbulat/plutus/badge.svg?branch=master)](https://coveralls.io/github/mbulat/plutus?branch=master)
|
4
|
+
|
5
|
+
The Plutus plugin is a Ruby on Rails Engine which provides a double entry accounting system for your application.
|
6
|
+
|
7
|
+
Compatibility
|
8
|
+
=============
|
9
|
+
|
10
|
+
* Ruby versions: MRI 2.2.2+ (should work with earlier versions if using Rails 4)
|
11
|
+
* Rails versions: ~> 5.0, ~> 4.0
|
12
|
+
|
13
|
+
For earlier versions, and upgrading, please see the section titled [Previous Versions](https://github.com/mbulat/plutus#previous-versions)
|
14
|
+
|
15
|
+
Installation
|
16
|
+
============
|
17
|
+
|
18
|
+
- Add the gem to your Gemfile `gem "plutus"`
|
19
|
+
|
20
|
+
- generate migration files `rails g plutus`
|
21
|
+
|
22
|
+
- run migrations `rake db:migrate`
|
23
|
+
|
24
|
+
Overview
|
25
|
+
========
|
26
|
+
|
27
|
+
The plutus plugin provides a complete double entry accounting system for use in any Ruby on Rails application. The plugin follows general [Double Entry Bookkeeping](http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system) practices. All calculations are done using [BigDecimal](http://www.ruby-doc.org/stdlib-2.1.0/libdoc/bigdecimal/rdoc/BigDecimal.html) in order to prevent floating point rounding errors. The plugin requires a decimal type on your database as well.
|
28
|
+
|
29
|
+
Plutus consists of tables that maintain your accounts, entries and debits and credits. Each entry can have many debits and credits. The entry table, which records your business transactions is, essentially, your accounting [Journal](http://en.wikipedia.org/wiki/Journal_entry).
|
30
|
+
|
31
|
+
Posting to a [Ledger](http://en.wikipedia.org/wiki/General_ledger) can be considered to happen automatically, since Accounts have the reverse `has_many` relationship to either its credit or debit entries.
|
32
|
+
|
33
|
+
Accounts
|
34
|
+
--------
|
35
|
+
|
36
|
+
The Account class represents accounts in the system. The Account table uses single table inheritance to store information on each type of account (Asset, Liability, Equity, Revenue, Expense). Each account must be sub-classed as one of the following types:
|
37
|
+
|
38
|
+
TYPE | NORMAL BALANCE | DESCRIPTION
|
39
|
+
--------------------------------------------------------------------------
|
40
|
+
Asset | Debit | Resources owned by the Business Entity
|
41
|
+
Liability | Credit | Debts owed to outsiders
|
42
|
+
Equity | Credit | Owners rights to the Assets
|
43
|
+
Revenue | Credit | Increases in owners equity
|
44
|
+
Expense | Debit | Assets or services consumed in the generation of revenue
|
45
|
+
|
46
|
+
Your Book of Accounts needs to be created prior to recording any entries. The simplest method is to have a number of `create` methods in your db/seeds.rb file like so:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
Plutus::Asset.create(:name => "Accounts Receivable")
|
50
|
+
Plutus::Asset.create(:name => "Cash")
|
51
|
+
Plutus::Revenue.create(:name => "Sales Revenue")
|
52
|
+
Plutus::Liability.create(:name => "Unearned Revenue")
|
53
|
+
Plutus::Liability.create(:name => "Sales Tax Payable")
|
54
|
+
```
|
55
|
+
|
56
|
+
Then simply run `rake db:seed`
|
57
|
+
|
58
|
+
Each account can also be marked as a "Contra Account". A contra account will have its normal balance swapped. For example, to remove equity, a "Drawing" account may be created as a contra equity account as follows:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Plutus::Equity.create(:name => "Drawing", :contra => true)
|
62
|
+
```
|
63
|
+
|
64
|
+
At all times the balance of all accounts should conform to the [Accounting
|
65
|
+
Equation](http://en.wikipedia.org/wiki/Accounting_equation)
|
66
|
+
|
67
|
+
Assets = Liabilities + Owner's Equity
|
68
|
+
|
69
|
+
Every account object has a `has_many` association of credit and debit entries, which means that each account object also acts as its own [Ledger](http://en.wikipedia.org/wiki/General_ledger), and exposes a method to calculate the balance of the account.
|
70
|
+
|
71
|
+
See the `Plutus::Account`, `Plutus::Entry`, and `Plutus::Amount` classes for more information.
|
72
|
+
|
73
|
+
Examples
|
74
|
+
========
|
75
|
+
|
76
|
+
Recording an Entry
|
77
|
+
------------------
|
78
|
+
|
79
|
+
Let's assume we're accounting on an [Accrual basis](http://en.wikipedia.org/wiki/Accounting_methods#Accrual_basis). We've just taken a customer's order for some widgets, which we've also billed him for. At this point we've actually added a liability to the company until we deliver the goods. To record this entry we'd need two accounts:
|
80
|
+
|
81
|
+
```ruby
|
82
|
+
>> Plutus::Asset.create(:name => "Cash")
|
83
|
+
>> Plutus::Liability.create(:name => "Unearned Revenue")
|
84
|
+
```
|
85
|
+
|
86
|
+
Next we'll build the entry we want to record. Plutus uses ActiveRecord conventions to build the transaction and its associated amounts.
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
entry = Plutus::Entry.new(
|
90
|
+
:description => "Order placed for widgets",
|
91
|
+
:date => Date.yesterday,
|
92
|
+
:debits => [
|
93
|
+
{:account_name => "Cash", :amount => 100.00}],
|
94
|
+
:credits => [
|
95
|
+
{:account_name => "Unearned Revenue", :amount => 100.00}])
|
96
|
+
```
|
97
|
+
|
98
|
+
Entries must specify a description, as well as at least one credit and debit amount. Specifying the date is optional; by default, the current date will be assigned to the entry before the record is saved. `debits` and `credits` must specify an array of hashes, with an amount value as well as an account, either by providing a `Plutus::Account` to `account` or by passing in an `account_name` string.
|
99
|
+
|
100
|
+
Finally, save the entry.
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
>> entry.save
|
104
|
+
```
|
105
|
+
|
106
|
+
If there are any issues with your credit and debit amounts, the save will fail and return false. You can inspect the errors via `entry.errors`. Because we are doing double-entry accounting, the sum total of your credit and debit amounts must always cancel out to keep the accounts in balance.
|
107
|
+
|
108
|
+
Recording an Entry with multiple accounts
|
109
|
+
-----------------------------------------
|
110
|
+
|
111
|
+
Often times a single entry requires more than one type of account. A classic example would be a entry in which a tax is charged. We'll assume that we have not yet received payment for the order, so we'll need an "Accounts Receivable" Asset:
|
112
|
+
|
113
|
+
```ruby
|
114
|
+
>> Plutus::Asset.create(:name => "Accounts Receivable")
|
115
|
+
>> Plutus::Revenue.create(:name => "Sales Revenue")
|
116
|
+
>> Plutus::Liability.create(:name => "Sales Tax Payable")
|
117
|
+
```
|
118
|
+
|
119
|
+
And here's the entry:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
entry = Plutus::Entry.build(
|
123
|
+
:description => "Sold some widgets",
|
124
|
+
:debits => [
|
125
|
+
{:account_name => "Accounts Receivable", :amount => 50}],
|
126
|
+
:credits => [
|
127
|
+
{:account_name => "Sales Revenue", :amount => 45},
|
128
|
+
{:account_name => "Sales Tax Payable", :amount => 5}])
|
129
|
+
entry.save
|
130
|
+
```
|
131
|
+
|
132
|
+
Associating Documents
|
133
|
+
---------------------
|
134
|
+
|
135
|
+
Although Plutus does not provide a mechanism for generating invoices or orders, it is possible to associate any such commercial document with a given entry.
|
136
|
+
|
137
|
+
Suppose we pull up our latest invoice in order to generate a entry for plutus (we'll assume you already have an Invoice model):
|
138
|
+
|
139
|
+
```ruby
|
140
|
+
>> invoice = Invoice.last
|
141
|
+
```
|
142
|
+
|
143
|
+
Let's assume we're using the same entry from the last example
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
entry = Plutus::Entry.new(
|
147
|
+
:description => "Sold some widgets",
|
148
|
+
:commercial_document => invoice,
|
149
|
+
:debits => [
|
150
|
+
{:account_name => "Accounts Receivable", :amount => invoice.total_amount}],
|
151
|
+
:credits => [
|
152
|
+
{:account_name => "Sales Revenue", :amount => invoice.sales_amount},
|
153
|
+
{:account_name => "Sales Tax Payable", :amount => invoice.tax_amount}])
|
154
|
+
entry.save
|
155
|
+
```
|
156
|
+
|
157
|
+
The commercial document attribute on the entry is a polymorphic association allowing you to associate any record from your models with a entry (i.e. Bills, Invoices, Receipts, Returns, etc.)
|
158
|
+
|
159
|
+
Checking the Balance of an Individual Account
|
160
|
+
----------------------------------------------
|
161
|
+
|
162
|
+
Each account can report on its own balance. This number should normally be positive. If the number is negative, you may have a problem.
|
163
|
+
|
164
|
+
```ruby
|
165
|
+
>> cash = Plutus::Asset.find_by_name("Cash")
|
166
|
+
>> cash.balance
|
167
|
+
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
168
|
+
```
|
169
|
+
|
170
|
+
The balance can also be calculated within a specified date range. Dates can be strings in the format of "yyyy-mm-dd" or Ruby Date objects.
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
>> cash = Plutus::Asset.find_by_name("Cash")
|
174
|
+
>> cash.balance(:from_date => "2014-01-01", :to_date => Date.today)
|
175
|
+
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
176
|
+
```
|
177
|
+
|
178
|
+
Checking the Balance of an Account Type
|
179
|
+
---------------------------------------
|
180
|
+
|
181
|
+
Each subclass of accounts can report on the total balance of all the accounts of that type. This number should normally be positive. If the number is negative, you may have a problem.
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
>> Plutus::Asset.balance
|
185
|
+
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
186
|
+
```
|
187
|
+
|
188
|
+
Again, a date range can be given
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
>> Plutus::Asset.balance(:from_date => "2014-01-01", :to_date => Date.today)
|
192
|
+
=> #<BigDecimal:103259bb8,'0.2E4',4(12)>
|
193
|
+
```
|
194
|
+
|
195
|
+
Calculating the Trial Balance
|
196
|
+
-----------------------------
|
197
|
+
|
198
|
+
The [Trial Balance](http://en.wikipedia.org/wiki/Trial_balance) for all accounts on the system can be found through the abstract Account class. This value should be 0 unless there is an error in the system.
|
199
|
+
|
200
|
+
```ruby
|
201
|
+
>> Plutus::Account.trial_balance
|
202
|
+
=> #<BigDecimal:1031c0d28,'0.0',4(12)>
|
203
|
+
```
|
204
|
+
|
205
|
+
Contra Accounts and Complex Entries
|
206
|
+
-----------------------------------
|
207
|
+
|
208
|
+
For complex entries, you should always ensure that you are balancing your accounts via the [Accounting Equation](http://en.wikipedia.org/wiki/Accounting_equation).
|
209
|
+
|
210
|
+
Assets = Liabilities + Owner's Equity
|
211
|
+
|
212
|
+
For example, let's assume the owner of a business wants to withdraw cash. First we'll assume that we have an asset account for "Cash" which the funds will be drawn from. We'll then need an Equity account to record where the funds are going, however, in this case, we can't simply create a regular Equity account. The "Cash" account must be credited for the decrease in its balance since it's an Asset. Likewise, Equity accounts are typically credited when there is an increase in their balance. Equity is considered an owner's rights to Assets in the business. In this case however, we are not simply increasing the owner's rights to assets within the business; we are actually removing capital from the business altogether. Hence both sides of our accounting equation will see a decrease. In order to accomplish this, we need to create a Contra-Equity account we'll call "Drawings". Since Equity accounts normally have credit balances, a Contra-Equity account will have a debit balance, which is what we need for our entry.
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
>> Plutus::Equity.create(:name => "Drawing", :contra => true)
|
216
|
+
>> Plutus::Asset.create(:name => "Cash")
|
217
|
+
```
|
218
|
+
|
219
|
+
We would then create the following entry:
|
220
|
+
|
221
|
+
```ruby
|
222
|
+
entry = Plutus::Entry.new(
|
223
|
+
:description => "Owner withdrawing cash",
|
224
|
+
:debits => [
|
225
|
+
{:account_name => "Drawing", :amount => 1000}],
|
226
|
+
:credits => [
|
227
|
+
{:account_name => "Cash", :amount => 1000}])
|
228
|
+
entry.save
|
229
|
+
```
|
230
|
+
|
231
|
+
To make the example clearer, imagine instead that the owner decides to invest his money into the business in exchange for some type of equity security. In this case we might have the following accounts:
|
232
|
+
|
233
|
+
```ruby
|
234
|
+
>> Plutus::Equity.create(:name => "Common Stock")
|
235
|
+
>> Plutus::Asset.create(:name => "Cash")
|
236
|
+
```
|
237
|
+
|
238
|
+
And out entry would be:
|
239
|
+
|
240
|
+
```ruby
|
241
|
+
entry = Plutus::Entry.new(
|
242
|
+
:description => "Owner investing cash",
|
243
|
+
:debits => [
|
244
|
+
{:account_name => "Cash", :amount => 1000}],
|
245
|
+
:credits => [
|
246
|
+
{:account_name => "Common Stock", :amount => 1000}])
|
247
|
+
entry.save
|
248
|
+
```
|
249
|
+
|
250
|
+
In this case, we've increase our cash Asset, and simultaneously increased the other side of our accounting equation in
|
251
|
+
Equity, keeping everything balanced.
|
252
|
+
|
253
|
+
Money & Currency Support
|
254
|
+
========================
|
255
|
+
|
256
|
+
Plutus aims to be agnostic about the values used for amounts. All fields are maintained as BigDecimal values, with `:precision => 20, :scale => 10`, which means that any currency can be safely stored in the tables.
|
257
|
+
|
258
|
+
Plutus is also compatible with the [Money](https://github.com/RubyMoney/money) gem. With Money versions greater than 6.0, the `money.amount` will returns a BigDecimal which you can use with plutus as follows:
|
259
|
+
|
260
|
+
```ruby
|
261
|
+
entry = Plutus::Entry.build(
|
262
|
+
:description => "Order placed for widgets",
|
263
|
+
:debits => [
|
264
|
+
{:account_name => "Cash", :amount => money.amount}],
|
265
|
+
:credits => [
|
266
|
+
{:account_name => "Unearned Revenue", :amount => money.amount}])
|
267
|
+
```
|
268
|
+
|
269
|
+
Multitenancy Support
|
270
|
+
=====================
|
271
|
+
|
272
|
+
Plutus supports multitenant applications. Multitenancy is acheived by associating all Accounts under `Plutus::Account` with a "Tenant" object (typically some model in your Rails application). To add multi-tenancy support to Plutus, you must do the following:
|
273
|
+
|
274
|
+
- Generate the migration which will add `tenant_id` to the plutus accounts table
|
275
|
+
|
276
|
+
```sh
|
277
|
+
bundle exec rails g plutus:tenancy
|
278
|
+
```
|
279
|
+
|
280
|
+
- Run the migration
|
281
|
+
|
282
|
+
```sh
|
283
|
+
rake db:migrate
|
284
|
+
```
|
285
|
+
|
286
|
+
- Add an initializer to your Rails application, i.e. `config/initializers/plutus.rb`
|
287
|
+
|
288
|
+
```ruby
|
289
|
+
Plutus.config do |config|
|
290
|
+
config.enable_tenancy = true
|
291
|
+
config.tenant_class = 'Tenant'
|
292
|
+
end
|
293
|
+
```
|
294
|
+
*NOTE: When building entries, be sure to specify the account directly, rather than use the `account_name` feature. Otherwise you'll probably end up with the wrong account.*
|
295
|
+
|
296
|
+
```ruby
|
297
|
+
debit_account = Plutus::Account.where(:name => "Cash", :tenant => my_tenant).last
|
298
|
+
credit_account = Plutus::Account.where(:name => "Unearned Revenue", :tenant => my_tenant).last
|
299
|
+
entry = Plutus::Entry.new(
|
300
|
+
:description => "Order placed for widgets",
|
301
|
+
:date => Date.yesterday,
|
302
|
+
:debits => [
|
303
|
+
{:account => debit_account, :amount => 100.00}],
|
304
|
+
:credits => [
|
305
|
+
{:account => credit_account, :amount => 100.00}])
|
306
|
+
```
|
307
|
+
|
308
|
+
Reporting Views
|
309
|
+
===============
|
310
|
+
|
311
|
+
The Engine provides controllers and views for rendering basic reports, including a Balance Sheet and Income Statement.
|
312
|
+
|
313
|
+
These views and controllers are read-only for reporting purposes. It is assumed entry creation will occur within your applications code.
|
314
|
+
|
315
|
+
Routing is supplied via an engine mount point. Plutus can be mounted on a subpath in your existing Rails 3 app by adding the following to your routes.rb:
|
316
|
+
|
317
|
+
```ruby
|
318
|
+
mount Plutus::Engine => "/plutus", :as => "plutus"
|
319
|
+
```
|
320
|
+
|
321
|
+
*NOTE: The `Plutus::ApplicationController` does not currently support authentication. If you enable routing, the views will be publicly available on your mount point. Authentication can be added by overriding the controller.*
|
322
|
+
|
323
|
+
*Future versions of plutus will allow for customization of authentication.*
|
324
|
+
|
325
|
+
|
326
|
+
Previous Versions
|
327
|
+
=================
|
328
|
+
|
329
|
+
For the rails 3 version, you can go here:
|
330
|
+
|
331
|
+
[https://github.com/mbulat/plutus/tree/rails3](https://github.com/mbulat/plutus/tree/rails3)
|
332
|
+
|
333
|
+
For the rails 2 version, you can go here:
|
334
|
+
|
335
|
+
[https://github.com/mbulat/plutus/tree/rails2](https://github.com/mbulat/plutus/tree/rails2)
|
336
|
+
|
337
|
+
* Gems in RubyGems.org >= 0.5.0 support Rails 3
|
338
|
+
* Gems in RubyGems.org >= 0.8.0 support Rails 4
|
339
|
+
* Gems in RubyGems.org >= 0.9.0 support Rails ~> 4.1
|
340
|
+
* Gems in RubyGems.org >= 0.13.0 support Rails ~> 5.0
|
341
|
+
|
342
|
+
Upgrading from older versions
|
343
|
+
-----------------------------
|
344
|
+
|
345
|
+
As Plutus is still in alpha, there have been some breaking changes with previous versions.
|
346
|
+
|
347
|
+
If you are upgrading, please check the Wiki for guides on how to properly upgrade plutus to deal with the changes:
|
348
|
+
|
349
|
+
[Upgrade Notes](https://github.com/mbulat/plutus/wiki/Updrade-Notes)
|
350
|
+
|
351
|
+
Testing
|
352
|
+
=======
|
353
|
+
|
354
|
+
[Rspec](http://rspec.info/) tests are provided. Run `bundle install` then `rake`.
|
355
|
+
|
356
|
+
Contributing and Contributors
|
357
|
+
=============================
|
358
|
+
|
359
|
+
There's a guide to contributing to Plutus (both code and general help) over in [CONTRIBUTING](https://github.com/mbulat/plutus/blob/master/CONTRIBUTING.md)
|
360
|
+
|
361
|
+
Many thanks to all our contributors! Check them all at:
|
362
|
+
|
363
|
+
https://github.com/mbulat/plutus/graphs/contributors
|
364
|
+
|
365
|
+
Community and where to get help
|
366
|
+
===============================
|
367
|
+
|
368
|
+
* Join the [mailing list](https://groups.google.com/d/forum/plutus-gem) (Google Group)
|
369
|
+
|
370
|
+
Bitcoins
|
371
|
+
========
|
372
|
+
|
373
|
+
Plutus is free software, but if you'd like to support development, feel free to send some bitcoins:
|
374
|
+
|
375
|
+
`1QFSdJheyFkLcsV8X428J8e3pYqX1nmW39`
|
376
|
+
|
377
|
+
Also, if anyone is using Plutus for bitcoin related accounting, I'd love to hear about it! Drop me a line.
|
378
|
+
|
379
|
+
ToDo
|
380
|
+
====
|
381
|
+
|
382
|
+
* Better views, including paging
|
383
|
+
* Reference for common accounting entries
|
384
|
+
|
385
|
+
Reference
|
386
|
+
=========
|
387
|
+
|
388
|
+
For a complete reference on Accounting principles, we recommend the following textbook
|
389
|
+
|
390
|
+
[http://amzn.com/0324662963](http://amzn.com/0324662963)
|
391
|
+
|
392
|
+
* * *
|
393
|
+
|
394
|
+
Copyright (c) 2010-2016 Michael Bulat
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require jquery
|
14
|
+
//= require jquery_ujs
|
15
|
+
//= require jquery-ui/widgets/datepicker
|
16
|
+
//= require_tree .
|