Here is my problem:
For example, there are 10 quantity in hand of ProductId = 1
InventoryId | ProductId | QuantityInHand
1 | 1 | 10
Whenever a new inventory comes in, a new entry is made in PRODUCT_INVENTORY table. For example, another 15 quantity has come in, so the table would look like as follows:
InventoryId | ProductId | QuantityInHand
1 | 1 | 10
2 | 1 | 15
Now, there are 10 + 15 = 25 quantity in stock. Let's assume customer has ordered for 20 items of ProductId = 1. Since we have more quantity in stock than ordered quantity, items can be sold.
Now the question is how we should adjust the Sold Items from the table.
Option 1 - Should we deduct 10 from the first record and 10 from the second record?
OR
Option 2 - Should we deduct 15 from the second record and 5 from the first record?
Please someone should help me solve this problem in asp.net mvc
What I have tried:
I have tried it but it giving me errors