Calculation of discounts and total cost