There is something wrong with the calculation logic.
You will have to do a rework on the code I guess.
What I would suggest is for everytime the user enters data in first screen just append it to a new table. Then you can use a similar logic like below for calculating in code and displaying it in table control.
Loop at ITAB.
if sy-tabix <> 1.
itab-total = lv_balance.
modify itab transporting total.
endif.
lv_balance = itab-total - itab-qtytobeprocessed
Endloop.
and you can have a variable or something that keeps track of the qty left out. It is too hard to explain in detail. we can just provide you some useful information with which you will have to improvise and achieve the requirement.
Thanks,
Naveen