Let's start from a beginning point. Here is a basic chart to help as we go along:
What a debit does:
Increases an asset
Decreases a liability
What a credit does:
Decreases an asset
Increases a liability
If we start from there we will always be speaking the same language.
Cost of goods sold is a formula and cannot be simply mix and match. The formula is:
Opening inventory (what I started with)
+ Purchases (what I bought during the cycle)
= What was available to sell
- Ending inventory (what was left at the end)
= Cost of goods sold.
Therefore, my first entry is to debit petty cash for the amount I have put into the business to begin with and credit equity since I won this.
My second entry is to credit petty cash for the funds expensed to buy merchandise and debit purchases for the same amount.
My third entry is to credit sales for the proceeds and debit petty cash.
So far, we have kept this simple. Now comes the part where you are having difficulties.
At year end, we debit the opening inventory account (in the cost of goods section) and credit inventory in the asset section. This transfers all beginning of period inventory to the cost of goods sold section of the P&L since it was available for sale. If the number is ***** no entry need be made.
We also debit inventory in the asset section and credit ending inventory in the cost of goods sold for the amount of inventory still on hand at period end. Then we just do a quick bit of adding and subtracting and we have a properly determined cost of goods sold in accordance with the formula.
You may have been reading the chart of accounts incorrectly. Read it as asset-inventory, rather than simply inventory and it will be easier. Once you are totally at home with this it does get simpler.