Hi Alby,
Upon checking your code, its actually working fine when I limited my customers through the parameters, however, when i tried executing all the customers, it gave me an error saying field is too small for calculating the total. You might want to change the field type referring to the total, also you might want to identify if a value for a field is negative or not so when it totals, it will not totally add everything.
Best Regards,
Charlie