Cost calculation and profitability analysis