ledger-pyreport: Formal accounting reports for ledger-cli
Ledger is a powerful command-line plain-text double-entry bookkeeping system. It is agnostic as to higher-level accounting principles, which makes it a very versatile tool for a wide variety of use cases, but does create challenges when extracting formal accounting reports. For example, Ledger struggles to correctly account for unrealised gains and changes in commodity values. In response to these issues, I developed ledger-pyreport.
ledger-pyreport is a lightweight Flask webapp for generating interactive and printable accounting reports from Ledger data.
Consider this Ledger journal. ledger-pyreport can process this data to produce a general ledger report:
Note from the final line that ledger-pyreport has correctly calculated the amount of unrealised gains, in a situation where Ledger would not. Note also that ledger-pyreport is extensible with custom programming hooks, which we have used to automatically recode a pending transaction to a pending transactions liability account.
From the general ledger, we can extract a trial balance:
Note that, as expected, the trial balance balances correctly. Unlike Ledger natively, ledger-pyreport is clever enough to value commodities correctly: monetary assets at fair market value, inventory at cost price and income/expenses at historical cost.
We can accordingly generate a formatted balance sheet:
And an income statement:
Note that ledger-pyreport is able to separately present business income and expenses, and report the net business profit figure as a component of overall income.
In addition to being printable, these reports are also interactive in the browser. Clicking on the International Account line in the balance sheet, we can view a report of all transactions against that account:
We can even generate a more detailed report breaking down the transactions and balance by commodity:
ledger-pyreport also has the capacity to simulate cash basis accounting, using FIFO methodology to recode transactions involving liabilities and non-cash assets. Below is a simulated cash basis balance sheet with liabilities and non-cash assets excluded.
Here we can see that the $600 business loan has been charged as an inward cash flow to Other Income and included under Current Year Earnings, while depreciation expenses have been excluded.
Additionally, ledger-pyreport can apply both the direct (left) and indirect (right) methods to generate a cash flow statement:
ledger-pyreport is open source and available here, will a full description of features and usage.