Yes that is what i need, We wil work our cost price on stock on hand for that day, it might be that no stck has gone out for 3 days, but the stock level has to be in the day it was received as prices changed daily.
+------------+-----+----+-----+-------+
id| Date | ID | In | Out | Level |new level
+------------+-----+----+-----+-------+
a| 2020-10-01 | 9 | 15 | 10 | 5 | 0 |
b| 2020-10-02 | 9 | 10 | 7 |8 | 0 | b stock out 7-a-level5 leaves a-level with 0 and a remainders of b-stock out with -2. then b-stockin was 10 so 10-2 = 8
c| 2020-10-03 | 9 | 23 | 25 |6 | 0 | now c-stock out - 25. b-stock level = 8(c-stockout 25 - b-stock level 8 = 17. so bstocklevel now becomoes 0, but c-stock in was 23 so it would be 23 -17 = 6. c-le
https://forums.phpfreaks.com/profile/3105-barand/
good day - mysql wit 5 field, date - stock id - stock in stock out - stock level
2020-10-01 | 9 | 15 | 10 | 5
2020-10-02| 9 | 10 | 7 |
2020-10-03| 9 | 23 | 25 |
2020-10-04| 9 | 30 | 16 |
on 2020-10-01 stok level is correct as it is the first day 15-10 = 5 so 5 stock left
2020-10-01 stock out is 7. so 7 needs to be subtructed from oldest stock level that os > 0 in this case 7-5 leaving 2020-10-1 with 0 and now before wa add stock in with 2020-10-02with stock of -2. then add stick in of 10 wich leaves 2020-1
Good morning. I need to subtract stock levels from oldest stock first then to the next date.
It is allowed to move into negative values.
example
01-10 stock in 10 stock out 5 - stock count 5
02-10 stock in 10 stock out 7 stock count ... here we need to subtract the 7 from previous days 5 til it reches 0 then stock in subtraction
01-10 stock =0
02-10 stock = 8 --- as 7 -5 gives me -2 in incoming stock is 10 leaving me with stock count of 8.
03-10 stock in 8 stock out 21
02-10 stck level must be 0
03-10 stock lever now is 8-14 = -6 and so on
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.