AR Invoice Balance did not update

Greetings,

Not sure if I can explain this clearly but our finance team is having a problem with receiving a payment and the transaction not updating correctly throughout Sage.

If I look up the invoice in Sage, I can see the invoice has a balance of $100.

If I look up the invoice in SQL, I can also see the invoice has a balance of $100 (AR_OpenInvoice)

When we try to apply the payment to the invoice, Sage throws an error that the invoice has a zero balance.

If I look up the invoice # in SQL with the table AR_TransactionPaymentHistory, I can see that there is 1 entry with a TransactionType of I.  For many other invoices I see another entry with a transaction type of P.

What's the best way to resolve our issue?