Understanding the Business objects

Derek Atkins warlord at MIT.EDU
Wed Dec 1 17:54:11 EST 2004


Hi,

Rich Johnson <rjohnson at dogstar-interactive.com> writes:

> For better or worse, the following is a summary of how I currently
> understand the business objects.  Hopefully I'm on the right track.
> Please correct any misunderstandings I might have:
>
> gncOwner is a weak reference to an _external_ entity.

Not sure what you mean by "weak reference"....

> gncCustomer
> gncVendor
> gncEmployee  describe _external_ entities and the billing and payment
> policies which apply.

Yes.  Basically..  These are the first-class entities.

> gncJob is an alias for either a gncCustomer or a gncVendor.  There is
> a 1->n relationship between these two objects.  A 'customer job' is
> represented by a gncJob with a gncCustomer owner and be used in lieu
> of a gncCustomer.  A 'vendor job' is represented by a gncJob with a
> gncVendor owner and may be used in lieu of a gncVendor.  A gncJob
> referencing a gncEmployee is nonsensical.

Sort of.  The usage is correct, but a better way of looking at a job
is, well, a job.  In the service industry you could have multiple jobs
for the same customer and need to bill items to each specific job.
You could also think of these as "projects".  But they aren't really
an alias, per se.

> gncAddress
> gncBillTerm
> gncTaxTable are used to describe _external_ entities and the billing
> and payment policies.

Sort of.  GncAddress is not a first-class entity; it's an abstraction
used by the customer, vendor, and employee objects who all need to
maintain the same kind of information.  Instead of replicating the
code in each object, I made one abstraction to contain it.

The billterms and taxtables are first class objects, and yes, they
hold the billing and payment policies.

> gncInvoice is either an invoice, bill or expense report, depending on
> the gncOwner and accounts involved.  An 'invoice' has either a
> gncCustomer or 'customer job' as an 'owner' and posts to Accounts
> Receivable.  A 'bill' has either a gncVendor or 'vendor job' as its
> 'owner' and posts to Accounts Payable.  An 'expense report' has a
> gncEmployee as it's 'owner' and posts to Accounts Payable.

Yes.

> gncEntry represents a line item on an invoice.  There is an n->1
> relationship between gncEntry and gncInvoice.  There is a 1->1
> relationship between a gncEntry and an income or expense account(
> depending on context ).   Furthermore, entries on a 'bill' or 'expense
> report' may be 'owned' by a gncCustomer or 'customer job'.  I assume
> such expenses will show up on a subsequent invoice.

Mostly.  The accounts do not necessarily need to be income or expense.
They could be an asset or liability, but that's generally not the case.

The entry ownership is for bill-back, so your assumption is correct.
Look at the UI and you'll see.

> There appears to be no separate 'payment' object explicitly applying
> payments against open invoices.  Payments received will be split
> across open invoices in an indeterminate manner--to me it looks like
> this happens to be FIFO order as it is in the reverse order they're
> encountered when the DB is scanned (engine/Account.c#1983) while the
> invoices are inserted in LIFO order (engine/Account.c#816)

Right, you don't need one.  When you post the invoice is creates a
transaction in your CoA.  The Process Payment process creates a
counter-balance transaction to actually instantiate a payment.

The payment processing is FIFO, but looking at how lots are inserted
into the account is a red herring.  See gncInvoice.c for the actual
payment logic.

-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 at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list