Report Writing Tips

Linas Vepstas linas at
Fri Jul 9 22:20:50 EDT 2004

On Mon, Jun 28, 2004 at 08:09:45PM -0400, Peter Long was heard to remark:
> >>two. For example I would like a report the shows how the Unrealised 
> >>Gains/Losses item are calculated. 
> >
> I use two different currencies in my accounts and I have noticed that my 
> balance sheets never seem to balance. It turns out that the Unrealized 
> Gains(Losses) line item in the Liabilities section of the balance sheet 
> was wrong from the time I first used a currency other than USD. I see 
> that someone has already opened a bug report on this issue but I did not 
> want to just sit around waiting for a fix. I thought I might as well get 
> my hands dirty and try figure out why it was wrong. So generating a 
> report that shows the "workings" for that line item is my first step 
> toward fixing it. Actually my first step was just to generate ANY report. :)

I'm not surpirsed that the existing cap gains report is broken, the
problem is harder than that.  

Here's the story so far, and I'm sorry I didn't write sooner:

-- There's code in CVS head that automatically computes
   realized/unrealized gains for everything.  It does this by
   assigning transactions to 'lots' and comparing buy & sell values
   in the lot. It then adds a balancing entry showing the gains.

   Lots are built using a FIFO policy.  In theory, its "easy" to
   add other policies.

   Its fully automatic in the sense that if you edit anything 
   anywhere, all the other gains are auto-recomputed, etc. 

   I think it all works but it hasn't been ultra-super-duper tested.

-- There's a 'lot editor' GUI in one of the menus, it allows you 
   to look at the contents of a lot and tweak it. Its simplistic but
   should work.

-- There are no reports that display this info; the current cap-gains
   report displays I have no clue what ... It would be great
   if you wrote that report.  Please work with CVS HEAD, since 
   all other mechanisms of computing cap gains will be deprecated ... 

Let me know how its going.  I can elaborate on the above at much
greater detail ... just ask; athough my answers are sometimes slow.


pub  1024D/01045933 2001-02-01 Linas Vepstas (Labas!) <linas at>
PGP Key fingerprint = 8305 2521 6000 0B5E 8984  3F54 64A9 9A82 0104 5933

More information about the gnucash-devel mailing list