## Documentation Index Access the complete documentation index at: https://www.zoho.com/en-fr/books/kb/llms.txt Use this file to discover all available documentation pages before proceeding. [Back](./) # How is the cost of goods sold calculated for inventory-tracked items? Zoho Books tracks your inventory based on the **FIFO (First In First Out)** system. This essentially means the stock that comes in first to the organization through any means, like the opening stock, and other purchase transactions, gets sold out in the same order. Read more about [FIFO Cost Lot tracking](https://www.zoho.com/in/books/help/reports/inventory.html#fifo-cost-lot-tracking). When the sale of an inventory-tracked item happens (_Invoices_), the corresponding **Purchase Account** (_Cost of Good Sold_) of the item also gets affected. This is to calculate the Profit / Loss over that sale by comparing the amount for which the item was bought and sold. The COGS value will be calculated based on the actual purchase (_Bills_) you make and not necessarily from the purchase price mentioned for the item in the **Items** module. Let’s take an example: **Purchase Rate of item**: $100 **Actual item rate on the Bill**: $120 **Quantity on the Invoice**: 5 **COGS** = $600 (_Quantity on Invoice \* Actual item rate on the Bill_) In case you have opening stock for the item, the COGS calculation will be taken from the opening stock rate per unit until the stock is emptied. After the opening stock is sold out completely, item rates will be fetched from the concurrent bills in FIFO basis. Let’s consider an example for the above case: **Opening Stock**: 10 **Opening Stock rate per unit**: $100 **Item rate on Bill**: $150 **Quantity on Invoice**: 14 **COGS** = (10\*100) + (4\*150) = $1600 * * *