Mystery pending cash receipt

I have a problem that looks similar Need to Remove Pending Cash Receipt to the user, but appears to have a different cause in the db. Here’s what I know about what happened:

  • A customer placed an order for X amount, where X includes a misc charge for shipping.
  • The customer was charged X. I see record in CashHead with TranAmt = X, AppliedAmt = X, GLPosted = 0.
  • Although the CashHead says GLPosted = 0, I see a corresponding GL entry with Posted = 1.
  • The customer later canceled the order. We have a $50 cancellation charge, so we created a Credit Memo for X - 50. Due to human error, this CM erroneously debited the wrong account.
  • I see two journal entries referring to the CM, one credit to AR, and one debit to the wrong account, both for X - 50.
  • Accounting is trying to create an adjustment that debits AR and credits the wrong account, in effect reversing the erroneous CM. This is where they get the error about the pending cash receipt.
  • Weird and possibly related: The erroneous CM’s InvcHead.UnpostedBal contains some seemingly random amount Y.
  • The only CashHead for abs(Y) is an old one for a different customer. There is no CashHead for abs(X - Y).