Hello Velo by Wix from the Philippines, I'm trying to create an inventory management system using Wix, where I have the Beginning history of the product, Deployment History, and Item Return History.
Questions:
1. What will be the best approach of database design to handle those data comes from the Beginning history when the product is added and will set a new "Job Order Number" when this product is deployed and returned, so I can display it in a table for their history.
2. What example functions I need to subtract and add the value from the database, For example, I have 100 Quantity items for Product A, and will subtract when I deploy 20 items and will add back when Item is returned, I'm new to Wix code with very minimal code experience, I will highly appreciate if anyone explained this with code sample, Thank you so much!
Here is my sample database structure
![](https://static.wixstatic.com/media/a27d24_6763d852206b45a3a53b7857beb179b4~mv2.png/v1/fill/w_980,h_482,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_6763d852206b45a3a53b7857beb179b4~mv2.png)
If you have an order database you can use Hooks,
First you will add another field of current inventory to this table you sent.
And when an approved new order is added to the orders database, you download how many orders have been ordered so far and deduct from the total and update in the balance field.
https://www.wix.com/velo/reference/wix-data/hooks