'Calculating the selling profit of different incoming goods
I'm making a retail distribution system for a store, where this store is the main distribution store that will distribute goods to other stores.
I have a problem, that is, let's say on January 10th an item in quantity of 10 comes in at a price of $ 5 / pcs. Then on January 13 came another 20 items at a price of $ 6 / pcs. Now, I have 30 pcs of items in the warehouse.
Date | Quantity | Price
10 Jan | 10 | $5
13 Jan | 20 | $6
Then there was a request for an order with a total of 25 pcs. Under the FIFO principle, I take 10 items that come in on the 10th, then take 15 items that come in on the 13th.
What is the best way to calculate profit margin? Where each item entered will have its own selling price depending on the purchase price.
I need help and advice for database structure and logic in this system.
Thank You
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
