How to calculate a total amount to pay based on field input or selection?