In our industry several batches are purchase in different prices. Upon creating process order we have to maintain budget control over receipe. We need to incorporate summarize total of all selected batch to determine whether we are within budgeted price or not.
For e.g.
Receipe
Component Qty Purchase Price total Price Batch No
Component A 12 KG 105 Per KG 12*105 = 1260 1245450
Component B 5 KG 90 Per KG 90*5 = 450 15124
Total 17 KG 1710
AVG Price Per KG = 1710 / 17 = 100.58
We have a control that receipe should not be exceed to total 100 Per KG.
Can some help me in this regard that how can I get these details at the time of creation of process order.
Note : if receipe not in range we will change batch to get it under control.