Calculate total and update it on select