If Invoice type 2 Credit or 5 Cash Credit has been selected you will see the field called Debit inv. no instead of the Credited by field. In this field you then select the debit invoice number that should be credited. Read more about this in the section Managing Credit Invoices.