I have a running total and would like to stop it when a condition is matched. Eg: I have STOCK qty 100pcs; qty is accumulated from Purchase Order Receiving transactions as below:
No. Qty Accumulate
1. 20 20
2. 30 50
3. 10 60
4. 40 100
5. 20 120
The running total should stop at no. 4, because it has reached the STOCK qty 100.
How can this be done?