Just by glancing at your XLS file i would assume that we have to precalculate buckets "OUT" for all buckets "IN"
I would do following steps:
- Load all IN transactions
- Join all OUT transactions (out transactions joined to first line of IN transaction)
- Calculate IN - OUT and using Pick function i would calculate cumulative OUT buckets until difference is < 0
- For all IN Transactions you would have Price IN - Multiply your difference by this price so you would get Value OUT
This should be all done in script in order to allocate values properly.
Thank for your reply,
FIFO Concept should be followed. First in comes item unit price should be calculated to first out item unit price.
Consider the following example,
Date ItemCode InQty OutQty unitprice Value
1/11/2016 12GH 5 10 50
2/11/2016 12GH 2 8 16
3/11/2016 12GH 6 10&8 58
From above example totaly i have 5 qty for 10rs as unit price 2 qty 8rs as unnit price. i need to calculate out unit price. 6 qty is out so i need to split the 6qty: 5 * 10 then 1 * 8 so my result is 58.