Skip to content

About

Custom GnuCash reports for CodeCrucible with ability to sort and sum by project

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Latest commit

 

History

76 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reports for GnuCash customized for CodeCrucible

Motivation

Before installing you might wonder why you should do it. This section explains why.

Accounts in GnuCash are organized in an account tree. The accounts for expenses might for example be organized like this:

Simple expenses example

Figure 1: Expenses.

CodeCrucible runs multiple programs, for example one in August 2025 and one in December 2025. We would like to seperate the expenses between these programs. One bad way to do this would be:

Bad expenses example

Figure 2: Bad example.

Instead, we want to organize the account tree as in Figure 1. We differ between projects when we do transactions by "tagging" them in the description:

Transactions

Figure 3: Transactions with tags for accounts.

The reports in this file allows us to use these tags to see total expenses for the program #P-2025Aug (August holiday 2025) etc.

GnuCash

Make sure you download GnuCash and learn the basics, for example using the tutorial.

This is repository contains custom reports for GnuCash 5, customized for CodeCrucible.

The reports are:

  • Transaction Report Extended (transaction-extended.scm)

  • Project Balance (project-tags-balance.scm)

  • Budget Report Extended (budget-extended.scm)

  • CC Yearly Summary (cc-yearly-summary.scm)

(More fancy ones will be added later. (Pie-charts etc would be cool.))

Installation

The commands in this guide assumes you are using Linux, but the steps for other operating systems should be similar.

Step 1. Clone this repository

Either clone the repository or download the zip and unzip the folder in some working directory.

Screenshot of how to clone

Enter the repository with

cd gnucash-codecrucible-reports

Step 2. Setup using setup file

Give yourself permission to execute setup.sh:

chmod u+x setup.sh

Run the file setup.sh:

./setup.sh

If this didn't work, do it manually following these steps.

Step 3. Restart GnuCash

After restarting GnuCash, the custom "Transaction Report Extended" should be available under the Reports - Experimental menu.

Open the options and select accounts and date similar to the normal transaction report. It should show totals per program by default. For more configuration, check below.

The reports

Transaction Report Extended

Filename: transaction-extended.scm

Description: Similar to the built in Transaction Report, but also has the capability to sort by project (#P- tag).

Project Balance

Filename: project-tags-balance.scm

Description: Shows an overview over all projects. It shows the Incomes, Expenses, Reallocations between projects and the projects balance (Income - Expenses + Reallocations in - Reallocations out).

This report expects two accounts Income:Project Reallocations and Expenses:Project Reallocations. Add them like you would add any account. Right click on the Income account and fill in:

Project Reallocations

Figure 4: Adding Project reallocations to Income.

Do the same for Expenses.

For example, if the project #P-2025Aug has 0 incomes and 3000 ksh expenses, it's balance would be -3000. When the #P-2025Aug program is over, we must therefore reallocate 3000 ksh from #P-general to #P-2025Aug, to make the balance 0.

3000 ksh from #P-general to #P-2025Aug.

Figure 5: 3000 ksh from #P-general to #P-2025Aug.

The Project Balance report now looks like this:

3000 ksh from #P-general to #P-2025Aug.

Figure 6: #P-2025Aug is cleared.

Budget Report Extended

Filename: budget-extended.scm

Description: Like the built-in Budget Report, but you can filter the Actual (and Difference) column by a project tag (e.g. #P-2025Aug). The Budget column is unchanged. Optionally, "Link to actual transactions" opens the Transaction Report with the same project filter pre-filled.

CC Category Charts

Filename: cc-category-barchart.scm

The income, expense, asset, and liability charts have a Filter tab:

  • Include tag prefix: keep splits containing any listed prefix, for example #T-, #P-.
  • Exclude tag prefix: remove splits containing any listed prefix, for example #I-, #T-, #P- for ordinary monthly spending.

Both fields accept comma-separated prefixes. Spaces around entries and empty entries are ignored; a single prefix still works.

Both fields default to blank (no filtering). When both are set, a split must match the inclusion and must not match the exclusion. Matching uses literal, case-sensitive substrings in the transaction description, notes, or the split's own memo, just like the transaction report's default text filter. A tag in the description or notes affects every split of that transaction; a tag in a memo affects only that split. Sibling memos are not searched.

Filters apply to the chart, displayed table, and CSV export. Asset and liability charts show cumulative balances from qualifying splits, including activity before the report's start date.

CC Yearly Summary

Filename: cc-yearly-summary.scm

Open Reports → Income & Expense → CC Yearly Summary. The report defaults to the previous calendar year and all income and expense accounts. Change the start and end dates to report on another year or a rolling 12-month period.

The report groups activity into four dimensions, with one row per full tag:

Dimension Classification
Regular No classification tag
Irregular #I-, e.g. #I-Annual or #I-Replacement
Travels #T-, e.g. #T-Malaysia26
Projects #P-, e.g. #P-Visa

Tags are case-sensitive, whitespace-separated tokens in transaction descriptions, notes, or the split's own memo. Other tag prefixes do not affect classification. Sibling memos are not searched. Each split may have only one distinct classification tag, even within the same dimension. Repeating the same tag is allowed. Clashes show transaction links, accounts, memos, and conflicting tags; totals and CSV export remain unavailable until the clashes are resolved.

Each tag, dimension subtotal, and grand total shows income, expenses, net cost (expenses minus income), and monthly averages. Monthly averages always divide the selected period's totals by 12, so select a full year for a monthly average. Refunds reduce expenses; zero and negative totals are retained. Tagged income, such as a contribution toward a trip, reduces that tag's net cost. Regular income includes salary, so a negative grand net cost indicates an overall surplus.

Bank-account counterparts, transfers between asset accounts, voided splits, and closing transactions are excluded. Amounts are converted to the report currency using the selected price source and posted dates. A nonzero amount that cannot be converted produces an error instead of incomplete totals.

Use Export → CSV in the report's export dialog to export the same rows, including subtotals and the grand total. CSV includes date/currency metadata and a row_type column (tag, subtotal, grand-total); filter by row type when summing in a spreadsheet to avoid double-counting subtotal rows.

Run ./setup.sh to register the new report, then restart GnuCash. For manual installation, link reports/cc-yearly-summary.scm into GNC_USERDATA_DIR and add (load (gnc-build-userdata-path "cc-yearly-summary.scm")) to config-user.scm.

Report Features

Disclaimer: Some of this is from the repository I forked, so it might not be up to date./Frej

Transaction Report Extended

Description: Based on the built-in transaction report, it provides these additional features:

  • a Sort by Substring option which includes a regular expression match similar to the one offered for the transaction filter. That feature is the generic version of the Transaction Report with Tags.
  • a new option on the display tab called "Use More Permissive Match for Other Account Name and Code". This option enables a more permissive match for the other account name and code in order to reduce the number of "split transaction" account names with multisplits.

(TO DO. But it basically works similar to "Transaction Report with Tags", but with capability of searching for any string.)

Transaction Report with Tags

A new tags sort key is made available in the primary and secondary key drop-down list, in the sorting options.

image

To see the transactions grouped by tags, one should select that key as well as enable the subtotal for the level selected.

More options are made available at the bottom of the sorting options.

image

Tag Prefix

  • By default, the sort engine will look for tags starting with #. However to accomodate the ability to tag multiple dimensions (meaning several tags per transaction), the user is able to change that prefix to any character (even the # could be changed). For instance you could use tags for a project dimension, for instance #P-XXX where XXX is your project reference, so #P-001 #P-002 etc. You could also use tags for different departments so #D for instance, #D-MKTING #D-FINANCE, etc. Then to run a report on the project dimension, set the tag to #P, for the department dimension set the tag to #D.
  • A checkbox allows to select the option to remove the prefix from the subtotal heading, so #D-FINANCE would simply show as FINANCE as the heading for instance (assuming #D- is entered as prefix)
  • The tag search is first applied to the split memo, then if no match the transaction notes, then if no match the transaction description. Only the first matched tag (as per the prefix) is considered.

No-Match Heading

This is the heading that will be used for the subtotal group listing transactions with no match. A checkbox allows to automatically add the prefix to it or not.

Examples

Here is an example of a report sorted with the defaults on first level. Second level is sorted by account. I am using 2 tags in this sample file: #P-Anna and #P-Bob. Untagged transactions are listed at the bottom in the No Match # section. image image

Here is an example where I change the headings with these options. image

Now my headings are a cleaner Anna, Bob and Nobody. image image

It is possible to remove the transactions with no matching tags by using the existing transaction filter (filter tab). Simply put the same tag prefix (# or whatever else you are using) in the Transaction Filter field. image

Here only Anna and Bob are listed. No-match "Nobody" is no longer there. image

Now I only want to see unmatched transactions. image

These are just transactions that are not assigned to anybody image

I could show Anna and Nobody, excluding Bob from the view (his transactions are excluded, not in nobody) image

Here is just Anna and Nobody image

Many more variations are possible, thanks to the wonderfull filter feature.

About

Custom GnuCash reports for CodeCrucible with ability to sort and sum by project

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages