A double-entry accrual accounting system for your Rails application. Currency-agnostic.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
double_double.gemspec

README.md

double_double

Build Status Code Climate

A double-entry accrual accounting system for your Rails application. Currency-agnostic but uses the Money gem. Account holder support and contexts are built-in.

Installation

Gem

Add this line to your application's Gemfile:

gem 'double_double'

And then execute:

$ bundle

Or install it yourself as:

$ gem install double_double

Setup

Generate and migrate the installation database migration

$ rails generate double_double:install
$ rake db:migrate

Overview

Double-entry accounting practices have been traced back to the 13th century. double_double strives to make accepted practices accessible and relatively easy to implement within other applications.

As with many off-the-shelf accounting systems, this project supports:

  • Accountee: an account holder.
  • Context: to track activity on invoices, purchase orders, jobs, campaigns, etc.
  • Initiator: who authorized or performed the action.

Accounts

All accounts created in a double-entry system make up the chart of accounts. This collection of accounts will determine how money is tracked as it moves through the system. It is important to design and create the chart of accounts prior to creating entries. *If we want people to hold "an individual account" in this system, we will configure them as an accountee, not with a new account. See the section on accountees *

In double_double, all accounts created are considered to be the chart of accounts. All accounts are "on the books."

Account Class Normal Balance Description Example Uses
DoubleDouble::Asset Debit Resources owned or controlled Cash, Office Computers, Grandma's Jewelry
DoubleDouble::Liability Credit Obligations Accounts Payable, Bank Loan
DoubleDouble::Equity Credit The claim to assets after all liabilities are paid Paid-In Capital, Dividends, Retained Earnings
DoubleDouble::Revenue Credit Income Sales, Interest Earned
DoubleDouble::Expense Debit Expenditures Utilities, Salaries, Rent, Taco Tuesday

Accounts have the following attributes:

  • name
  • number, for reporting purposes
  • contra flag, optional default: false

An example 'Cash' asset account as account number 20

DoubleDouble::Asset.create! name: 'Cash', number: 20

An example 'Sales' revenue account and a 'Discounts' contra revenue account.

DoubleDouble::Revenue.create! name: 'Sales',     number: 40
DoubleDouble::Revenue.create! name: 'Discounts', number: 50, contra: true

Contra accounts are used to offset a related account of the same class. The example above is a common method to track sales. The full sales value of the sale would be assigned to 'Sales' while any discounts given would be assigned to 'Discounts.'

Example Scenarios

See the double_double wiki

Tests

All code is backed by Rspec tests. Clone this repository and rake spec to execute the tests.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes & tests (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Notes

double_double was influenced by mbulat's plutus project and regularly working with quickbooks.