Inventory logic

Explanation on how the inventory logic works.

All products are stored in table products based on the value in products.businessID is defied who is the owner of the product. 

Available products.ProductType 
0=Unknown,
1=Physical,
2=Consumable,
3=Service,
4=Membership

Packages / Ingredients
Products can be consists of unlimited sub products linked in table products_packages and products_packages_product. When product with product package is sold, it's stored to table orders_products with orders_products.packageIDproducts_packages.packageID and orders_products.package_order_productIDorders_products.productID (Parent product)

All Physical & Consumable products must first be purchased from supplier to manage cost, quantity in stock and profit from sells. Purchases are stored in tables, purchase_products

When order is created if product types are Physical & Consumable it will be taken from purchase_products.QtyInStock other types are copied directly from Products table and stored in table orders_products linked using orders_products.InventoryID = products.productID and orders_products.purchase_productID=purchase_products.productID

 

Add comment