It might be possible that the advance payment is recorded from the customer ledger and it has not yet been settled against a pending sales document.
We suggest you to please settle pending invoice with advance payment.
Step 1: Click on bills >> Under transaction click on required payment
Step 2: “Click on Record Payment”
Step 3 : Click on “use advance payment to settle”>> Select payment and record
Step 4: Step 3: View the Ledger.