totalCost in controller