Cost analysis and profit determination