New enhancement to balance-sheet report

Andrew Sackville-West andrew at swclan.homelinux.org
Fri Mar 28 02:43:08 EDT 2008


On Thu, Mar 27, 2008 at 09:34:49PM -0700, Yogesh Agrawal wrote:
> On Thu, Mar 27, 2008 at 4:20 PM, Andrew Sackville-West <
> andrew at swclan.homelinux.org> wrote:
> 
> > On Thu, Mar 27, 2008 at 02:00:47PM -0700, Yogesh Agrawal wrote:
> >
> > > Perfect,  Yes I have looked into the advance portfolio, and saw the code
> > for
> > > basis calculation.
> >
> > > 1) Where should I start on that code?
> >
> > I would say that the whole basis calculation should be carved out into
> > a couple of functions that return the basis at a particular time using
> > the different methods (FIFO, FILO etc).
> 
> 
> I don't know how helpful it will be to have a separate method for this, can
> we start with
> the existing basis-builder method and slowly break it to different methods.
> 
> >
> >
> > > 2) How do you want me to put the basis calculations into a separate
> >  library?
> >
> > just like any of the other libraries in src/report/utility-reports/
> > look at that various html-*.scm files therein and follow that model.
> 
> 
> Hi Andrew,
> 
> I have gone through the advanced-portfolio report, and these are things that
> I think I have to do:
> 
> 1) Take off the method basis-builder from it and move it to
*-utilities.scm,

yup. but you can't just pull the function off. The function is very
simple and only takes the value, number of shares and basis
calculation method as arguments. Instead what you need is to wrap that
basis-builder in some other functions that will take as an argument a
particular stock account and date and calculation method and then
iterate through the splits building up the basis at the particular
date using the appropriate method.


> 
> I think it can be moved to commodities-utilities.scm as basis calculation is
> mostly for the
> commodities ( Correct me if I am wrong here)

yup.

> 
> 2) When we move this method the signature of the method will change to
> gnc:basis-builder
> and have to make changes to advance portfolio to call this method.

yup. It's no small task, frankly, but very doable for a first time
report hacker. You just have to realize that a lot of the basis
calculation work is built in to other parts of the advanced portfolio
report. For example, the part where the report iterates through the
splits and determines whether the split is a basis-affecting split or
not happens outside the basis-builder function.

If I wasn't in the middle of rebuilding my machine, I could be more
specific. But look at the code that calls basis-builder and then trace
it back to see what it does to set up for the call into
basis-builder. 

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20080327/c6aa0b03/attachment.bin 


More information about the gnucash-devel mailing list