Respuesta :

You just need to have a variable which stores the current amount spent and whenever you spend any more amount, just update that variable. I don't think you need any predefined function to do it.