Payment received from client

Invoices applied back in 2022 but credit card was compromised and employee didn't reverse the invoices to be outstanding on customer account, when received cheque for the outstanding invoice in 2022-2023 i had to put amount as a deposit on account. How do I get rid of this amount received on customer account.