Attaching one Split* to multiple Account*s

Dave Peticolas dave@krondo.com
21 Nov 2001 02:00:27 -0800


--=-+ItfTI5dEoObJN+wN6He
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Mon, 2001-11-19 at 14:28, Derek Atkins wrote:
> I'm trying to figure out the best way to attach one Split to
> multiple Accounts.  What I'm really trying to do is attach
> an order Entry to both an Order and an Invoice.  What I really
> want is to have the following pointers:
>=20
> 	Entry(Split)->Order(Account)
> 	Entry(Split)->Invoice(Account)
>=20
> 	Invoice(Account)->Entry(Split)
> 	Order(Account)->Entry(Split)
>=20
> This should look familiar to some; this is what Scheduled Transactions
> do...  Unfortunately a Split only has a single Account, so I'm not
> sure how to do this.  What I'd like to be able to do is lookup an
> Invoice and get all the Entries, or look up an Order and get all the
> Entries.  But I don't want to have to duplicate the Entries -- I'd
> like to have one Entry point to both the Order and the Invoice.
>=20
> Here's the problem.  Assume a SQL backend with a caching client -- you
> don't load all the Invoices/Orders/Entries at load-time.  Assume the
> Entry(Split) is linked to the Order(Account).  Now assume a user wants
> to view the Invoice(Account) and all the Entries associated with it?
>=20
> One approach I thought of is to link the Entry to the Order and then
> list the Entries and Orders in the Invoice kvp data.  This way when a
> user goes to view the Invoice, it can then lookup all the Orders and
> then search those Orders for the particular Entries.  The cache can,
> of course, keep local pointers.  But in storage purposes it's only
> entered through the kvp.

Keep in mind that the sql backend doesn't currently support
KVP_TYPE_GLIST.


> Obviously being able to point to the Entry(Splits) directly from both
> Invoice and Order Accounts would be better, but that would require
> fundamental changes to the engine architecture.  Does anyone have any
> better ideas than what I've laid out above?

What if you pointed from the order entry to the invoice using the
entry's kvp? Or just have two entries and use the transaction kvp
to store the 'real' data, using the entries as pointers.

dave


--=-+ItfTI5dEoObJN+wN6He
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQA7+3s75effKKCmfpIRArsMAJ9hvnf5uGE8BC86eZiMsl2JAHrF1QCgjPE0
YRpWzUC2IWTgHbzy6EEOb18=
=SyWa
-----END PGP SIGNATURE-----

--=-+ItfTI5dEoObJN+wN6He--