Formatting code for ActivePatientBalancesSortedByPrimaryProvider
======Active Patient Balances Sorted by Primary Provider======
Back to [[QueryDirectory Query Directory]]
//Our practice has 40+ therapists and we would like to be able to give them a simple monthly report showing account balances due by patients. //
%%(sql)
SELECT
prv.provcode AS "primary provider", pt.lastname, pt.firstname, pt.id, bal.ptbalance
FROM
patients pt
JOIN providers prv ON pt.providernum = prv.providernum
JOIN PT_NONINSBALANCE bal ON pt.ptnum = bal.ptnum
WHERE
pt.flag = 0
AND pt.dischargedate IS NULL
AND pt.licnum = 101
ORDER BY "primary provider"%%
----
CategoryQueries
Back to [[QueryDirectory Query Directory]]
//Our practice has 40+ therapists and we would like to be able to give them a simple monthly report showing account balances due by patients. //
%%(sql)
SELECT
prv.provcode AS "primary provider", pt.lastname, pt.firstname, pt.id, bal.ptbalance
FROM
patients pt
JOIN providers prv ON pt.providernum = prv.providernum
JOIN PT_NONINSBALANCE bal ON pt.ptnum = bal.ptnum
WHERE
pt.flag = 0
AND pt.dischargedate IS NULL
AND pt.licnum = 101
ORDER BY "primary provider"%%
----
CategoryQueries