From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Michael Glaesemann <grzm(at)seespotcode(dot)net> |
Cc: | a(dot)maclean(at)cas(dot)edu(dot)au, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: [NOVICE] Recursive relationship - preventing cross-index entries. |
Date: | 2007-06-20 07:49:18 |
Message-ID: | 4678DBFE.2030403@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice |
Michael Glaesemann wrote:
> INSERT INTO accounts_receivable_receipts (accounts_receivable_id,
> receipt_id)
> VALUES (2, 1), (4, 3), (6, 1), (5, 3);
>
> I have not done much accounting-style design, and I don't think this is
> really the best way to set these up (for example, I think it's a bit odd
> to map these amounts against each other without indicating how much of
> the amount is matched), but without more information about your business
> logic, I don't really know what else to suggest.
In most I've seen, you have an "allocations" table linking payments
received against individual invoices. So, you might have payment 1234
with £100 against inv #10001 and £150 against inv #10002.
The allocations table tends to have an "amount unallocated" column too,
imposing an order to the allocations. Not strictly necessary from a
database point of view, but I suspect left over from manual methods of
working.
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Magnus Hagander | 2007-06-20 07:49:30 | Re: PostgreSQL Installer for Windows x64 |
Previous Message | EBIHARA, Yuichiro | 2007-06-20 07:31:40 | Re: PostgreSQL Installer for Windows x64 |
From | Date | Subject | |
---|---|---|---|
Next Message | Sean Davis | 2007-06-20 10:49:41 | Re: [NOVICE] Recursive relationship - preventing cross-index entries. |
Previous Message | Michael Glaesemann | 2007-06-20 04:40:30 | Re: [NOVICE] Recursive relationship - preventing cross-index entries. |