When a customer over pays an invoice you should be able to record this as an over payment and then apply this to the next invoice that is generated for that client.