PackageDescription: GnuCash

Gnu Cash

Last published: November 22, 2012 by 'mkobetic'

Defines 8 Classes
Extends 9 Classes

This package provides Glorp mapping to a GnuCash database (GnuCash supports relational database back-end as of version 2.4). The mapping isn't complete, it doesn't include the "business" features, like Books, Customers, Invoices, etc. It does include the basic accounting entities as follows. There is a hierarchical structure of Accounts. A Transaction between two or more Accounts is composed of Splits. A Split represents the particular change (credit or debit) of a particular Account involved in the Transaction. For example a transaction of paying for groceries with a bank card, could be represented as a debit Split of the amount from the "bank account" asset Account and a credit Split of the amount to the "groceries" expense Account. If the purchase included also "supplies" the "groceries" credit would be appropriately smaller and there would be a third Split crediting the "supplies" expense Account in the same transaction with the rest or the amount. In any case the sum of all credits and debits in a transaction must be zero (The GnuCash help provides a lot more introductory material on book-keeping rules). All Transactions are expressed in terms of a Commodity which is usually a Currency. However GnuCash also allows managing investment accounts where the Commodity is whatever the investment is, e.g. a Stock or MutualFund, etc. Obviously the Price of these Commodities changes over time, so GnuCash tracks these changes with Price. An instance of Price ties the value of a unit of Commodity at given time to an amount of some currency. Note that currencies are modeled as Commodities as well, and their value can be also tracked via Price against some other currency (e.g. you can track the CAD against the USD). Prices are especially relevant when there are transactions involving Accounts with different Commodities. At that point the "exchange rate" between the Commodities must be specified, so that the Transaction can be balanced.

This package includes a Glorp Workbook accessible via Launcher>Tools>GnuCash Workbook menu item. It opens a workbook with a database session captured by a workspace variable named 'session' and some sample expressions in the workbook to play with. Note that the session login assumes a SQLite database in a file pointed to by the global variable GnuCash.Database. If the variable isn't set to a String naming an existing file, a file selection dialog will pop up allowing you to set it.