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

Derek Atkins warlord@MIT.EDU
18 Apr 2002 20:41:31 -0400


linas@linas.org (Linas Vepstas) writes:

> > 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.

Ok.

> I assume that every customer gets one account.

I suppose, but that's not what I'm doing now.  Right now I have a
single A/R and A/P account, and the Transaction points to the Invoice,
which points to the Customer.  Similarly, I set the Transaction
Description to the Customer Name (I suppose I could add a KVP in the
Transactoin with the Customer's GUID, but that can be obtained easily
as mentioned above).

> 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'.)

And I suppose if you have multiple invoices at once you can pay them
all off at once and, just like selling partial lots of stock you'd
have multiple payment splits, one per lot?

> 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.   

Actually, you'd open up the Vendor and search for all unpaid
invoices..  (Invoices already have a 'paid' flag).  Actually,
Invoices are tri-state:
        Open            -- you can still add new items to the invoice
        Posted          -- you've created your actual Transaction.  No
                           more changes are allowed
        Paid            -- this invoice is paid off.

> 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.)

Sure, I can see this.  Although I think what's more intersting is
seeing a recent list of invoices and payments and a total balance.

> The API would include
> Lot * xaccSplitGetLot (Split *);
> 
> and
> typedef GList SplitList;
> SplitList * xaccLotGetSplits (Lot *);
> 
> and that's how you find all transactions that pertain to this invoice.

Yea, I think that given an Invoice, you would:

        txn = gncInvoiceGetPostedTxn (invoice);
        lot = xaccTransGetLot (txn);
        splits = xaccLotGetSplits (lot);

Another approach would be to tie the lot directly to the Invoice, but
I'm not sure if that's important enough.

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

Just the "payment" UI; in particular if a Customer pays a bill that
covers multiple Invoices, you want to apply it to all unpaid
invoices/lots, and you probably want to do it in one Transaction.
That means we need the UI sugar to make that easy.

> --linas

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available