Question

I have the following accounting tables:

http://sqlfiddle.com/#!3/b93f3/2

My transaction details table has the following fields:

[transdetailid] [int] IDENTITY(1,1) NOT NULL,
    [transid] [int] NOT NULL,
    [debitaccount] [varchar](10) NOT NULL,
    [creditaccount] [varchar](10) NOT NULL,
    [amount] [money] NOT NULL,
    [isdebit] [bit] NOT NULL,
    [isactive] [bit] NOT NULL,

I think the table is ok but my question is about accounting transactions...

Example: the electric contractor charged me $1,000 for elevator service, then I record that information like this:

transdetailid   transid debitaccount    creditaccount   amount  isdebit isactive
    1              1    REPAIRS INCOME   ACC PAYABLE    1300.00    1        1

then I will have to pay that bill so I enter the next transaction:

transdetailid   transid debitaccount    creditaccount   amount  isdebit isactive
    2              2    ACC PAYABLE     BANK ACCT       1300.00    0        1

Here I can see that "Acc Payable" Balance is 0 but what about Repairs Income...? If i make a query it will say that Repairs Income still in 1,300 and I guess i have to add another field or something so I know that the payment transaction also kills the repairs income.

Any clue? Hope i was clear with explaining this..

Was it helpful?

Solution

What you have stumbled upon is the difference between transactions and reporting.

Your database design has a flaw, because you have not connected the bill to the payment. By the way, this can be quite challenging. Often, it is done by using, for lack of better word, a vendor. The bill comes from a vendor the payment goes to the vendor.

You may be tempted to inlcude the billing transaction in the payment record. That is a bad idea, because it means that each payment must exactly match one bill. What happens to partial payments? What about payments for multiple bills at the same time? What about late fees?

You need to modify your structure to include information about who is doing the charging and who is being paid.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top