Question

designing a database for a shop and i faced a little problem. Let's say there is a product x in our shop which has a purchase price and benefit to get retail price . But there is another supply to the shop of the same product bu wih difference price . 1- According to the shop owener he needs one price for the product. 2-should i seperate product info from the shippment say i put table of productid - name -reference and other table ofr SuplierInvoice - Producyid- Quantity - PurchasePrice

again should i put seeling price in the first table of product or the other one and what about actual quantity where should be put?

Please i need ideas ....

Was it helpful?

Solution

Having built a few systems that are for ordering / costing I can confirm that there are many ways of doing this.

The way that I'd usually start with is to have the concept of

  • Product
  • Supplier
  • SupplierProducts

The Product identifies the product that you are using; the Supplier are your Suppliers and the SupplierProduct is used to provide specific pricing information for a product; as a product must come from a supplier.

Simple Supplier Product model

Depending on the requirements; you'd either have orders / invoices that relate to the SupplierProduct - or if you are selling directly from the stock - then you would place SupplierProducts into stock with their Sale Price and Cost Price set appropriately based on the stock purchase

You then sell items from the stock table; Because the item has come from stock the pricing information in the stock table reflects the actual price paid when the item was put into stock. You'd have multiple entries in the stock table for the same product / supplier containing the details as each product was purchased, and maintain the current stock level (although this can lead to update problems and usually I'd have a stock table and a stock movements table, and use these together to decide stock holding)

With Orders

OTHER TIPS

I would say that products table should keep something like average price for a product, so we could easily tell how much we need to spend if we need to order more of that product.

However, since product price is inherently volatile, exact price is not property of the product itself, but is agreed upon every buy or sale transaction that your shop makes. In other words, exact product price and quantity sold or bought should belong to invoices table as part of every transaction you make.

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