Python/Flask application for generating and/or serving HTML reports from ledger-cli data
This repository has been archived on 2024-11-09. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
2020-04-01 13:53:02 +11:00
demo Implement separate reporting of Other Comprehensive Income (e.g. unrealised gains) 2020-04-01 13:53:02 +11:00
ledger_pyreport Implement separate reporting of Other Comprehensive Income (e.g. unrealised gains) 2020-04-01 13:53:02 +11:00
.gitignore Update documentation 2020-04-01 11:57:29 +11:00
config.example.yml Implement separate reporting of Other Comprehensive Income (e.g. unrealised gains) 2020-04-01 13:53:02 +11:00
COPYING Initial commit 2020-01-14 00:06:22 +11:00
README.md Update README to note debit/credit convention 2020-04-01 13:53:02 +11:00
requirements.txt Update documentation 2020-04-01 11:57:29 +11:00

ledger-pyreport

ledger-pyreport is a lightweight Flask webapp for generating interactive and printable accounting reports from ledger-cli data.

Reports

  • Trial balance, and comparative trial balance
  • Balance sheet, and comparative balance sheet
  • Income statement, and comparative income statement
  • General ledger
  • Account transactions, with or without itemisation of commodities
  • Transaction detail, with or without itemisation of commodities

Features

  • Correctly values assets/liabilities at market value, and income/expenses at cost (pursuant to AASB 121/IAS 21 para 39)
  • Correctly computes unrealised gains (even when Ledger does not)
  • Accounts for both profit and loss, and other comprehensive income
  • Simulates annual closing of books, with presentation of income/expenses on the balance sheet as retained earnings and current year earnings
  • Can simulate cash basis accounting, using FIFO methodology to recode transactions involving liabilities and non-cash assets

Background, demo and screenshots

See https://yingtongli.me/blog/2020/03/31/ledger-pyreport.html for further discussion.

Usage

Install the dependencies from PyPI, optionally in a virtual environment: (Commands presented for Linux/Mac)

virtualenv venv
. venv/bin/activate
pip install -r requirements.txt

Copy config.example.yml to config.yml (or set the LEDGER_PYREPORT_CONFIG environment variable to the path to the config file).

Run as per a usual Flask app, for example:

FLASK_APP=ledger_pyreport python -m flask run

Notes on Ledger setup

ledger-pyreport expects each of assets, liabilities, equity, income and expenses to be setup in Ledger as a separate top-level account. These accounts should contain a zero balance, with all transactions in child accounts.

Additionally, ledger-pyreport expects the next level of assets and liabilities to be categories of asset and liability (e.g. Assets:Current, Liabilities:Non-current). These, too, should contain a zero balance.

Ledger-pyreport by default observes the convention that positive amounts in Ledger represent debits, and negative amounts in Ledger represent credits.