Book clsoing [was: Re: Addition of HBCI support, Maturity of 1.7-branch, next stable release time frame?

Linas Vepstas
Thu, 18 Apr 2002 18:48:12 -0500

On Wed, Apr 17, 2002 at 09:36:10PM -0400, Derek Atkins was heard to remark:
> (Linas Vepstas) writes:
> > Derek,
> > 
> > Can you think about & tell me about how things like payment terms for 
> > billing is handled? i.e things like 30/60/90 day due dates, etc?
> Currently Transactions can have a "Due Date", which is stored as a kvp
> entry.  Currently only A/R and A/P type accounts actually provide a
> view into that kvp data.  It is also set from the "Post Invoice"
> process: when you post the invoice you can set the due date.

OK, so it will make complete sense to move this to a kvp on a 'lot'.

> Question: For A/R, would you have one lot per customer or one lot per
> posted invoice?

one lot per posted invoice.  It doesn't make sense otherwise.
Right?  What makes 'lots' intersting is that they have only a few
transactions in them, and that they become "boring" when their balance
goes to zero.

I assume that every customer gets one account.

> > In other words:  should we (you, I someone) implemnent 'minimal lots'
> > in the engine, ASAP?
> I think this would be very useful.  It would certainly help in terms
> of partial payments etc.  But we'd still need to figure out how it
> will work.

How what will work?  Partial payments?

Every new invoice starts a lot, and every payment to pay it off 
goes into that lot.   Once the balanbce hits zero again, the 
lot is 'closed', (either defacto because its balance is zero,
or we may want to put in a redundant flag that means 'paid-in-full'
aka 'closed'.)

To find all unpaid invoices to a vendor, you open the account associated
with that vendor, and scan all splits.  For each split, you find the
lot, and then look to see if the lot is 'closed' or 'open'. If the lot
is 'open', then its an unpaid/partially paid bill.   

You can display the unpaid bill, and all of its partial payments,
by simply showing all splits in the lot.  (you show paid-in-full bills 
the same way.)

The API would include
Lot * xaccSplitGetLot (Split *);

typedef GList SplitList;
SplitList * xaccLotGetSplits (Lot *);

and that's how you find all transactions that pertain to this invoice.

Is there more to it? If so, I haven;t thought about it enough ...


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