How to Calculate Cost of Goods Sold: A Comprehensive Approach