Hello,
I have an application where i want to update the stock.
Data is as follows:
Design No.: Shade No.: Quantity:
56459 250 35.00
56459 250 35.00
56459 250 35.00
Now i want to dispatch 35.00 meters and it should update the record as follows:
Data is not supposed to be deleted
Design No.: Shade No.: Quantity:
56459 250 35.00
56459 250 35.00
56459 250 0.00
Code as follows:
- if(Outward_Type == "Fabric")
- {
- for each rec_Fab in Fabric
- {
- Fabric_Obj = Fabric_Stock_Master[Shade_No == input.Fabric.Shade_No];
- for each rec_Fab_Obj in Fabric_Obj
- {
- if(rec_Fab.Design_No == rec_Fab_Obj.Design_No)
- {
- if(rec_Fab.Quantity > rec_Fab_Obj.Balance_Quantity)
- {
- rec_Fab.Quantity=rec_Fab.Quantity - rec_Fab_Obj.Balance_Quantity;
- rec_Fab_Obj.Balance_Quantity=0;
- }
- else if(rec_Fab.Quantity == rec_Fab_Obj.Balance_Quantity)
- {
- rec_Fab_Obj.Balance_Quantity=rec_Fab_Obj.Balance_Quantity - rec_Fab.Quantity;
- }
-
- }
- }
- }
- }
But the data is updated as follows:
Design No.: Shade No.: Quantity:
56459 250 0.00
56459 250 0.00
56459 250 0.00
I have tried giving range while fetching but it wont work for me as i wont be deleting the data.
Thank you