We are currently updating the OP Help Center content for the release of OP 19, which is a member of the certified OP 14 family of products. OP 19’s official version is 14.19.1, which you may see in your software (such as in Help > About) and in the Help Center tabs labeled 14.19. You may also notice that the version number in content and videos may not match the version of your software, and some procedural content may not match the workflow in your software. We appreciate your patience and understanding as we make these enhancements.

SQL: Simple Payments and Adjustments, for DOS Range and Payment Range

About

This report shows payments and adjustments received during a user-defined period, for dates of service performed during another user-defined period.

A sample image of this SQL report run in the Database Viewer is shown below:

Caveats

  • Voided amounts are excluded.
  • “Payments received dates” are defined as the OP payment date, rather than the posted payment date or the daysheet date.

Code

To highlight and copy the code below to your clipboard, simply click the Copy button.

select round(sum(total_paid),2) as total_payment, round(sum(total_adjusted),2) as total_adjustment from
(
select patno, dos, cptcode, total_paid, total_adjusted from
(
select patno, date1 as dos, trnsxno, cptcode from archive_transactions at1 where 
archive_Flag = 1 and date1 between :dos_start and :dos_end and txnopaid = 0
) a
left outer join
(select txnopaid, sum(payment+copayrecd) as total_paid, sum(copayadjustment+adjustment) as total_adjusted from archive_transactions where archive_flag = 1 and date1 between :payment_start and :payment_end and txnopaid >0 group by txnopaid) b on a.trnsxno = b.txnopaid


where ( total_paid >= 0.01 or total_adjusted >= 0.01)
)