Credit notes work in a very similar way to an invoice. The point of doing a credit is to reduce the balance on a debtors account or invoice so it is important that you indicate which invoice is affected by the credit note by entering Allocate to Invoice.