Note that there are some explanatory texts on larger screens.

plurals
  1. POPoint of Sale and Inventory database schema
    primarykey
    data
    text
    <p>I’m trying to create a <em>basic</em> Point of Sale and Inventory management system.</p> <p>Some things to take into account:</p> <ul> <li>The products are always the same (same ID) through the whole system, but inventory (available units for sale per product) is unique per location. Location Y and Z may both have for sale units of product X, but if, for example, two units are sold from location Y, location Z’s inventory should not be affected. <strong>Its</strong> stocked units are still intact.</li> <li>Selling one (1) unit of product X from location Y, means inventory of location Y should subtract one unit from its inventory.</li> </ul> <p>From that, I thought of these tables:</p> <ul> <li><p>locations</p> <ul> <li>id</li> <li>name</li> </ul></li> <li><p>products</p> <ul> <li>id</li> <li>name</li> </ul></li> <li><p>transactions</p> <ul> <li>id</li> <li>description</li> </ul></li> <li><p>inventories_header</p> <ul> <li>id</li> <li>location_id</li> <li>product_id</li> </ul></li> <li><p>inventories_detail</p> <ul> <li>inventories_id</li> <li>transaction_id</li> <li>unit_cost</li> <li>unit_price</li> <li>quantity</li> </ul></li> <li><p>orders_header</p> <ul> <li>id</li> <li>date</li> <li>total (calculated from orders_detail quantity * price; just for future data validation)</li> </ul></li> <li><p>orders_detail</p> <ul> <li>order_id</li> <li>transaction_id</li> <li>product_id</li> <li>quantity</li> <li>price</li> </ul></li> </ul> <p>Okay, so, are there any questions? Of course.</p> <ol> <li>How do I keep track of changes in units cost? If some day I start paying more for a certain product, I would need to keep track of the marginal utility (<code>(cost*quantity) - (price*quantity) = marginal utility</code>) some way. I thought of inventories_detail mostly for this. I wouldn’t have cared otherwise.</li> <li>Are relationships well stablished? I still have a hard time thinking if the locations have inventories, or if inventories have several locations. It’s maddening.</li> <li>How would you keep/know your current stock levels? Since I had to separate the inventory table to keep up with cost updates, I guess I would just have to add up all the quantities stated in inventories_detail.</li> <li>Any suggestions do you want to share?</li> </ol> <p>I’m sure I still have some questions, but these are mostly the ones I need addressing. Also, since I’m using Ruby on Rails for the first time, actually, as a learning experience, it’s a shame to be stopped at design, not letting me punch through implementation quicker, but I guess that’s the way it should be.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload