AR - Need to use an overpayment on one invoice to pay off another, same customer

A customer overpaid and then next month ran a schedule for same amount.  Need to take the overpayment from first invoice and pay off second invoice