Click on the invoice button in the Hot Area of the record.
Ensure that the 'final transaction' is ticked if you are sure you want to go ahead and confirm your credit.
Using this method to credit items on an invoice, the credit will automatically be allocated to the invoice, and no further action is needed with regard to the accounts.