Skip to main content

Does anyone know how to query for Payments with a non-zero Available Balance — curyUnappliedBal

Unfortunately this field isn’t available in the DB, and the code references other fields that also don’t exist in the DB. 
Someone on my Accounting team asked for a GI/SQL to isolate these Payments. 

 

 

 

Hello,It seems like you need ARPayment.CuryDocBal, shown in your code above.

ARPayment.CuryDocBal is the unapplied balance of the payment.

Laura


Thanks for the reply @Laura02, but i’m seeing examples where that Balance field is $0 but the “Available Balance” is not zero, when viewing the document directly. 
So this is what we’re trying to query for, using available fields in the DB, but it doesn’t seem possible, or is confusing. 


Not to doubt the validity of that, but if you think it through, the formula being used to calculate CuryUnappliedBal is subtracting amounts from CuryDocBal. I’m not sure how you’d ever end up with a number greater than CuryDocBal.


Okay gotcha, yeah I think I was mixing up SOAdjust.CuryDocBal (which showed $0) and ARPayment.CuryDocBal (which was non zero). 

All that to say, ARPayment.CuryDocBal doesn’t appear to return what I’m looking for though. There are many Payments I’m seeing where this value just matched the Document Total, but the “Available Balance” (curyUnappliedBal) correctly shows $0. 


Are those Payments that have Invoices associated but haven’t been released? After adjustment was released is when the CuryDocBal would accurately reflect the amount remaining.


They aren’t applied to any Invoices or Sales Orders, and they are in the Open status (and released). So they are essentially ‘orphaned’ payments that we want more visibility into. 

Okay it seems like for documents of the “Payment” type (not “Prepayments”) in the Open status, the CuryDocBal shows what I’d expect. But for Prepayments, this is not the case. 

I think I can just use that in the logic to capture what I need. Thanks for scheming on this with me!


After digging a bit more, I’m still not really happy with how confusing and difficult it is to query this information...classic Acumatica. I’m unable to isolate “Prepayments” that have an available balance. Oh well. 


Reply