I want to update records based on a variable $aux = 110
, for example. In the image the first row has an amount of 80. Therefore it must be zero and move to the next record with what about 110-80 = 30
. Then, the next record should be 100-30 = 70
and so on until there is $aux=0
.
Final result: