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 > Database Design help for stores

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-08, 09:49
leTus leTus is offline
Registered User
 
Join Date: Feb 2008
Posts: 1
Database Design help for stores

Hello guys, I need some help hope you all can help me with this.
So i have 12 little (I don't know what to call them but let's say) stores which are selling the same products (at this time 12). Like hot dogs, cola, gum and other stuff. Every day I am get a slip of paper from each store containing information what and how many products they sold, also how many they got supplied. I attached an image of how it looks. So I have 12 of those every day. So every store is like a little stock too, and besides that I have a big one which delivers to them what they need. I want to make a database which would keep track of:
1. How much of each product was sold, every day and for each store.
2. How much of each product was supplied to them, every day.
3. And of course the revenues and all that.

I was thinking of making some tables like this:
Products
- id
- name
- price
--------------
Stores
- id
--------------
Transactions
- id
- product_id
- store_id
- quantity
- date
but I not sure this is the best way, this doesn't cover the products they receive and what should I do about the totals of sales, calculate or store the somewhere?
Any help would be greatly appreciated.
If something is not clear I can explain in more detail.
Thanks.
Reply With Quote
  #2 (permalink)  
Old 02-07-08, 10:08
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
You need another table like Transactions for Goods Received (unless you find it useful to combine these into a single table with an IN/OUT column).

You also probably wany a table to record the level of stock for each Product at each Store e.g.

stock
- store_id
- product_id
- quantity
- reorder_level (maybe)

This will get updated for every insert of Transaction or Goods Received row.

The best way to calculate total sales is to simply sum up the Transactions when required. In a data warehouse you would store these totals for speedy retrieval, but with only 12 stores x 12 products this shouldn't be necessary.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 02-07-08, 15:02
loquin loquin is offline
Super Moderator
 
Join Date: Jun 2004
Location: Arizona, USA
Posts: 1,797
Right. Have an inventory table, showing the quantity and location of the items at a given point in time.

Then, sum the inventory table with the sum of all transactions (after the time snapshot) which reference that item/location

Whenever you sell or otherwise move an item out of inventory you add a transaction record, containing the timestamp, item number, the location, and a negative quantity. When receiving an item into inventory, the transaction record contains a positive quantity and timestamp. To move an item from one store to another, you would need two transactions: one removing the item from the first store's inventory, and a second, adding the item to the second store's inventory.

Whenever you perform a physical count of inventory, you would add an inventory adjustment transaction (so as to make the database inventory match the actual count,) then reset the inventory record with the current timestamp.
__________________
Lou
使大吃一惊
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Last edited by loquin; 02-07-08 at 15:06.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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