Click here to Skip to main content
13,804,094 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
Posted
Updated 8-Dec-18 0:30am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Quote:
I have tried it but it giving me errors

To get help on this, show code and error messages with position, or describes errors.
Quote:
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?

It is your design choice. Both options are possible, it is just your design choice, we can't do it for you.
The fist option is something known as "FIFO".
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.181218.1 | Last Updated 8 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100