Giter Club home page Giter Club logo

ledger's Introduction

Ledger

Ledger is a REST-ful double-entry accounting software. Its main principle is simplicity. Currently it allows you to:

  1. Create a chart of accounts.
  2. Record transactions affecting the accounts.
  3. Generate a balance sheet corresponding to any point in time.
  4. Generate an income statement corresponding to any interval of time.

Installation

You need Python 2.7 and virtualenvwrapper.

# Step 1: Clone the repository
git clone https://github.com/gregnavis/ledger.git ledger

# Step 2: Enter the project root
cd ledger

# Step 3: create a virtual environment
mkvirtualenv -a "${PWD}" -r requirements.txt

# Step 4: set environment variables
export FLASK_APP=webapp.py

# Step 5: initialize the database
flask init

# Step 6: run!
flask run --host=0.0.0.0

Ledger is listening on port 5000 on all interfaces.

Usage

First, you need to create the chart of accounts. You can do this by POST-ing the following JSON to /accounts:

{"name":"Cash","code":"101","type":"asset"}

This will create an account named Cash. The name of an account is only for display purposes. Accounts are internally references using the code. For example, if you GET /accounts/101 the server will return the data you've posted to created the account.

There are five types of accounts: asset, liability, equity, revenue and expense. Before recording your first transaction, you need some other accounts, say Equipment (an asset account) and Share Capital (an equity account). You can create them by POST-ing:

{"name":"Equipment","code":"102","type":"asset"}

and

{"name":"Share Capital","code":"301","type":"equity"}

You'll also need a revenue account:

{"name":"Consulting Revenue","code":"401","type":"revenue"}

For simplicity, we'll skip expenses.

With the chart of accounts in place, you're ready to start recording transactions. In order to record the initial investment of $10,000 POST the following to /transactions:

{
  "date":"2016-09-01",
  "description":"Record the initial investment",
  "items":[
    {"account_code":"101","amount":1000000},
    {"account_code":"301","amount":-1000000}
  ]
}

The convention is that positive amounts are debits, negative are credits. Also, all amounts are assumed to be expressed in cents hence 1000000.

If you buy an asset, e.g. a laptop for $2,000, you can record it with:

{
  "date":"2016-09-02",
  "description":"Buy a computer",
  "items":[
    {"account_code":"101","amount":-200000},
    {"account_code":"102","amount":200000},
  ]
}

A consulting service for Acme, Inc., paid $1,500 in cash, can be recorded as:

{
  "date":"2016-09-03",
  "description":"Consulting for Acme, Inc.",
  "items":[
    {"account_code":"101","amount":150000},
    {"account_code":"401","amount":-150000},
  ]
}

To see the balance sheet on 5 September 2016 go to /balance-sheets/2016-09-05.html. You should see

The balance sheet on 5 September 2016

Similarly, if you go to /income-statements/2016-09-01-to-2016-09-05.html you should see:

The income statement from 1 to 5 September 2016

To sum up:

  • POST /accounts creates an account.
  • GET /accounts/<code> retrieves account information.
  • POST /transactions record a transaction.
  • GET /balance-sheets/<YYYY-MM-DD>.html generates a balance sheet on a given day.
  • GET /income-statements/<YYYY-MM-DD>-to-<YYYY-MM-DD>.html generates an income statement corresponding to a given period of time.

Under the Hood

Ledger has minimal dependencies. It stores data in SQLite 3 using the built-in sqlite3 module. The web component uses Flask and Jinja 2.

Missing Features

Financial accounting is a huge subject. Ledger is not a fully-fledged accounting system. Below is a list of things that it lacks:

  • Adjusted and unadjusted trial balances.
  • Statement of changes in equity.
  • Contra accounts.
  • Classified balance sheets and income statements.
  • Subledgers.
  • Automatic capitalization, depreciation and amortization.
  • Industry-specific financial statements (e.g. income statements reporting cost of goods sold and gross profit in a merchandising business).
  • Inventor systems (perpetual and periodic).
  • Cost flow assumptions (specific identification, FIFO and weighted average).
  • Estimation of balance in merchandise inventory (gross profit method and retail inventory method).
  • Notes to financial statements.
  • Security features (e.g. SSL, authentication).
  • Configuration knobs (e.g. database location, network interface to use).

If you'd like to help to implement a feature feel free to drop me a line. I'll try to give you some guidance.

Author

Ledger is developed and maintained by Greg Navis.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.