Changed to take payments made into account.
At the moment, it counts all transactions, minus refunds.  It should also subtract the payments made (which in our case is two so far).
This commit fixes that, hopefully without breaking anything.
Changed the variable name to make more sense.