Greetings.
I am making some Point of Sales system but I have a little problem with the database design.
You see, there is this list of products that will be added to a cart. What I need is when these items are added in the cart and then sold, it will generate some sort of receipt or purchase number with a given purchased date and at the same time, it will contain the items purchased (item name, quantity, price).
So lets say I have..
Item A, B and C in my Inventory and they have a price of 5,10 and 15 respectively.
Item A,B and C of are purchased by a customer. Clerk clicked sell and...
A Purchase Number 1 is generated which contains the three items A,B and C with there prices and quantity.
This are my ideas of doing it..
Lets say these are my entities
[B]ITEM[/B]
item_id | item_name | price | quantity
1 A 5 5
2 B 10 5
3 C 15 5
[B]ORDER[/B]
item_id | quantity_purchased
1 2
2 3
[B]PURCHASE[/B]
purchase_no | pur_date | items_purchased_for_this_purchase_no
00001 12/30/09 1-2
Would this be a good design?
OR this..
[B]ITEM[/B]
item_id | item_name | price | quantity
1 A 5 5
2 B 10 5
3 C 15 5
[B]ORDER[/B]
order_id | item_id | quantity_purchased | purchase_no
1 1 3 0001
2 2 2 0001
3 3 3 0002
[B]PURCHASE[/B]
purchase_no | purchase_date |
0001 12/30/09
0002 12/31/09
Or could anyone help me with a better design?
Thanks in advance.