Sharing modified "Transaction Report" transaction.scm

Amm ammdispose-gnucash at yahoo.com
Thu Apr 3 13:06:12 EDT 2014


Hello all,

I would like to share a modified "Transaction Report". i.e. file 
transaction.scm (diff patch also included)

Link: https://gist.github.com/anonymous/9958309

Basic purpose of my modification was for better readability and better 
looking reports when printing them out.

Here are the changes and additions that I have made.
-----------------------------------------------------

(Note: Account below means account by sort key NOT necessarily business 
account. It can be month name, if sorting is by date/month. Or Account 
name if sorting is by Account name)


1) Account (heading) now easy to identify.

Existing "Transaction Report" does not use any style for "Account" 
heading. So heading would look just like a normal row and 
indistinguishable and not easy to find.

In my modification uses "Account heading" uses same style as "Total for 
the account". And makes it much easy to find.

It also makes it easy to distinguish the sections faster.


2) Better Table "heading row".

Existing "Transaction Report" prints heading row (Date, Num, Description 
etc.) only on first page on very top which makes it difficult to read 
your report when it runs several pages.

My modification puts "Heading row" after each account/sub-account name 
heading. So that its easy to read plus looks nice too.


3) Use of <thead> for automatic heading on each page.

With little bit of Javascript code and "placeholder" rows. I managed 
insert <thead> around "Accounts" / "Sections".

So when printouts of an account runs in several pages, it automatically 
adds "Acccount heading" and "Table column headers" on top of every page.

So you always know you are looking at transaction for which "Account"


4) Pagebreaks before each "Account".

Sometimes when printing reports you may want reports for separate 
"Accounts" to be printed on separate page.

I have added option for inserting Pagebreaks before each "Account"/"Table".

It can be found in "Report options" under "General" tab


5) Proper calculation of num-columns-required.

Existing "Transaction Report" does not properly calculate number of 
columns required (mostly for colspan). It is very liberal and increases 
the counter for cells merged with other cells, as well. Hence "Total 
For" row make page wider than required. So it waste lots of space on 
paper when printing.

Properly calculating num-columns-required saves 2-3 pages for every 
12-15 pages. (compared to existing "Transaction Report")


6) Fix(?!) "Credit" and "Debit" row headings

If I am not wrong, in existing "Transaction Report", I felt that 
"Credit" / "Debit" row headings were wrong (reversed). So I reversed 
them again!


7) Adds 20px margin between accounts. (see point 8 below too)

Existing "Transaction Report" was simply dumping one "Account" after 
other. So on screen / printout, all sections were sticking to each other.

I have added 20px margin between each "Account" so they look separate.


8) Customizable Style sheet

Allows to change page margins, table width OR add any other custom style 
element to be applied to HTML document.

TIP: If you want to change margin of 20px (as in point 7 above) as in 
then add following line:
.subac{margin-bottom:10px;}


9) One table for all accounts = Mimic (somewhat) older "Transaction Report"

If you do not want different tables for different accounts but you want 
the existing behavior of one table for all accounts, then simply check 
"Use Single Table for Accounts" in "General" tab of "Report Options"

NOTE: Most of the new additions above will not function if you check 
this option.



TIP: (for maximum use of these features)

Instead of printing directly from GnuCash OR instead of using export to 
PDF option, First "Export" report in HTML format and then open HTML 
report in web browser and then print it.

Once again, link is: https://gist.github.com/anonymous/9958309


Hope this helps others!

Amm.


More information about the gnucash-user mailing list