Important Content Update Message
We are currently updating the OP Help Center content for the release of OP 20. OP 20 (official version 20.0.x) is the certified, 2015 Edition, version of the Office Practicum software. This is displayed in your software (Help tab > About) and in the Help Center tab labeled Version 20.0. We appreciate your patience as we continue to update all of our content.

SQL: One Account Drill Down

About

This report shows the entire charge and payment activity on a particular chart/account for a specified date range.

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

Caveats

  • Voids are excluded.
  • The date range refers to the date of service. Payments may have come in any time after the date of service, including time periods after the end date

Code

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

select at1.date1, at1.cptcode, at1.ins_carrier_code, at1.charge, at1.units, at1.trnsxno, at2.ins_paid, at2.pt_paid from
(select date1, cptcode, ins_carrier_code, charge, trnsxno, units from archive_transactions where archive_flag = 1 and date1 between :Start_date and :enddate and patno = :chart_number and cptcode not in ('1','2','3','4')) at1
left outer join
(select sum(payment) as ins_paid, sum(copayrecd) as pt_paid, txnopaid from
(select copayrecd, payment, txnopaid from archive_transactions where archive_flag = 1 and (copayrecd >= 0.01 or payment >= 0.01))
group by txnopaid) at2
on at2.txnopaid = at1.trnsxno