Clear a receipt or payment but locked

For example, If a payment was created on May 18th, and was marked pending, when May’s month-end closing finished and the manager lock the data before May 31st, and then the payment was cleared on Jun 20th.
In this scenario, our cashier can’t mark the payment clear due to the data lock, she has to ask the manager unlock the data, while the action will be May’s data in risks.
Can some setting to be made to adviod such problems?

Well I like to explain the scenarios happened when we mail the cheques to our suppliers or sometimes the suppliers just keep the cheque a little long period before they send it to their bank.

You need to modify your procedure for when you set the lock date or give your cashier permission to remove and reset it.