Apply Prepayments to an invoice

SOLVED

How do I apply a customer's pre-payment against an invoice? It shows both the invoice and the cash receipt as open transactions.