If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Table Design Help Needed

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-20-09, 21:04
Escherrer Escherrer is offline
Registered User
 
Join Date: Jun 2003
Posts: 4
Table Design Help Needed

Hi,

I could use some help/advice in implementing one of my business requirements. The application is for order processing.

The requirement is as follows: "Any item in the order may be tax exempt, or the entire order itself may be tax exempt. In either case when this occurs a tax exempt ID must be captured."

Here are the tables that seem to be relevant for this requirement:

Order -----> OrderDetail -----> OderDetailTax

An order can have one or many details (items), and each detail have can zero or many taxes. If you need I can get more detailed with these entities but it may not be necessary.
I have a solution to implement this requirement but I am not happy with it. I was thinking of adding two fields to the Order and OrderDetail tables: IsTaxExempt and TaxExemptID. What I do not like about this solution is that without triggers it is not possible to enforce this rule in the database so it is inevitable that eventually there will be a record with IsTaxExempt = true but still there will be records in the OrderDetailTax table. From my experience if it can happen in the DB it eventually will.

Any other approaches on how to implement this requirement is appreciated, I've been thinking it over a few days now and can't come up with anything else.

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-20-09, 22:11
MarkATrombley MarkATrombley is offline
Registered User
 
Join Date: Jul 2009
Location: Michigan
Posts: 125
I would add a TaxExemptID column to Order and a IsTaxExempt column to OrderDetail. I see no reason for another table. Here in the USA the TaxExemptID is really an attribute of the customer, it doesn't change from order to order or item to item. Some items are tax exempt (usually those that are being purchased for resale) and some are not (office supplies).

So unless you have a real need to store a unique tax exempt ID per item I see no reason for a special table. Is that a requirement?
Reply With Quote
  #3 (permalink)  
Old 12-21-09, 01:28
Escherrer Escherrer is offline
Registered User
 
Join Date: Jun 2003
Posts: 4
Thanks, you solved my problem. I wasn't thinking that it was an attribute of customer which was my mistake. Each order can have multiple customers, it's a restaurant POS ordering system. However each order can also have multiple invoices, but invoices can only have one customer. So I will make it an attribute of Customer and all those customers invoices will inherit tax exemption.

The only problem is it's going to be alot of work for the application to maintain, and there's no way other than triggers to keep it honest. There are a lot of events that could happen which will require going in and recalcualting taxes, i.e. change invoice customer, transfer item to different invoice, etc.

Last edited by Escherrer; 12-21-09 at 11:26.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On