Untraceable advance payment from customer credit account

Hi, I’ve got an ‘Advance payment for sales invoice #119 allocated from customer credit account’ which must have happened by mistake.
I know it is a mistake because I have two Payment Gateway accounts and I make them pay off one Sales Invoice (for my e-commerce website) at the close of each month.

Because it is allocated to a sales invoice, it’s not showing up on the ‘Customer Credits’, but I can’t see how to get rid of that advance payment.

I’ve tried to delete the sales invoice, but it says: ‘This record cannot be deleted because it is already referenced by another object’

Anybody got a solution, thanks.

Your situation is not completely clear. Was sales invoice #119 a mistake? Or was the entry of advance payment a mistake?

If the mistake was the sales invoice, you are correct. You will not be able to delete it until you find and delete (or properly allocate) the payment against it. But you cannot directly delete an automatic allocation from Customer credits, which you have probably discovered. But if you click the Customer credits balance (or dash if it is now zero) in the Summary, you will see a list of the transactions. You should be able to see where the allocation occurred. Then go to that transaction to make the correction.

Depending on what happened, the automatic credit allocation statement may show an opening balance. You need to figure out where that came from, probably a bank account receipt, but possibly a journal entry. So you would need to correct that entry.

Once the customer credit allocation is cleared up, you should be able to delete the sales invoice.

If the advance payment entry was the mistake, you need to go back to your bank account receipts and figure out which one was improperly allocated to that particular customer. Then allocate it to the proper customer. A customer statement with all transactions may help in that process.

I hope some of this helps.

Thanks Tut for your very detailed reply.
That has given me the info to sort it - I was unaware that I could dig deeper by clicking on the dash which took me straight to that rogue payment.
Thanks again.