Subject | RE: [firebird-support] Best table structure for Debit/Credit |
---|---|
Author | Kevin Stanton |
Post date | 2006-06-19T23:59:12Z |
I have a financial app that has a table called "general_ledger". The table
only has one amount field and no specifier.
When I print my g/l report, I have two calculated fields: DRAmt and CRAmt
(Delphi dataset). If the glamt field is < 0 then it's a credit, etc.
This makes summaries/queries a breeze.
Just my 2 cents.
Cheers,
Kevin
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Milan Babuskov
Sent: Monday, June 19, 2006 9:49 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Best table structure for Debit/Credit
Alan.Davies@ <mailto:Alan.Davies%40aldis-systems.co.uk> aldis-systems.co.uk
wrote:
(McDonald). Your approach needs complicated selects. Having a field to
identify the type of transaction doesn't give any benefit and indexing
it would be useless. OTOH index on value > 0 and value < 0 should be
quite fast.
Having two separate columns is also good when you need to SUM() as it is
very simple, while in your case it would get even more complicated as
you have to multiply all the "credit" records by -1.
--
Milan Babuskov
http://swoes. <http://swoes.blogspot.com/> blogspot.com/
http://www.flamerob <http://www.flamerobin.org> in.org
[Non-text portions of this message have been removed]
only has one amount field and no specifier.
When I print my g/l report, I have two calculated fields: DRAmt and CRAmt
(Delphi dataset). If the glamt field is < 0 then it's a credit, etc.
This makes summaries/queries a breeze.
Just my 2 cents.
Cheers,
Kevin
_____
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of Milan Babuskov
Sent: Monday, June 19, 2006 9:49 AM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] Best table structure for Debit/Credit
Alan.Davies@ <mailto:Alan.Davies%40aldis-systems.co.uk> aldis-systems.co.uk
wrote:
> Generally one field for the amount and another to identify the type ofI have to say that I disagree with you and agree with other Alan
> transaction is best.
(McDonald). Your approach needs complicated selects. Having a field to
identify the type of transaction doesn't give any benefit and indexing
it would be useless. OTOH index on value > 0 and value < 0 should be
quite fast.
Having two separate columns is also good when you need to SUM() as it is
very simple, while in your case it would get even more complicated as
you have to multiply all the "credit" records by -1.
--
Milan Babuskov
http://swoes. <http://swoes.blogspot.com/> blogspot.com/
http://www.flamerob <http://www.flamerobin.org> in.org
[Non-text portions of this message have been removed]