I am developing a inventory management system.
My system comprises of the following tables (attributes):-
(i) Product (ProductID, Product_description)
(ii) Location (Location)
(iii) Transaction (DateTime, ProductID, Qty_change, Location)
(iv) Available locations (ProductID, Location, Available_qty)
The system has a Transaction_form, which allows users to fill in how many pieces of inventory he wishes to move in or move out, and to which location he will be moving. After filling up this form, the system will create a row in the โTransactionโ table. However, i want the system to update also the โAvailable locationsโ table too!
Therefore, if the user inputs that 10pcs of product โAโ is taken away from location โ1L1Aโ. The system should search in the table โAvailable locationโ if there is a row containing โ1L1Aโ in location and product โAโ in product ID. If there is, the โAvailable qtyโ of that row should minus 10pcs. Alternatively, the system should create a new row in the table โAvailable locationโ recording that available qty of product โAโ in location โ1L1Aโ is โ-10โ.
Creating the table โAvailable locationโ is essential because I want to create a virtual column (related available locations) in โproductโ table. Such that when i click the product_detail page, the user can see the available location where he can find that particular product.
I would be so grateful if anyone could advise me how to solve this problem. Many thxxx
User | Count |
---|---|
15 | |
14 | |
8 | |
7 | |
4 |