juggernautsei wrote on Monday, December 03, 2012:
I have been working on this off and on for a while now. I just thought I would start a new thread and see if there was any help with the thinking on this section.
function get_patient_balance($pid) {
if ($GLOBALS === 2) {
$brow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " .
“pid = ? AND billed = 1 AND activity = 1 AND `modifier` NOT LIKE ‘TC’”, array($pid) );
$srow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " .
“pid = ?”, array($pid) );
$drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " .
"SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
“pid = ?”, array($pid) );
return sprintf(’%01.2f’, $brow + $srow
- $drow - $drow);
}
This code snipet is from the > Library > patient.inc.php file. I have been trying to figure how to exclude fees that have nothing billed against in from the AR_activity table. The only thing I noticed was that in the Modifier table there was an entry for the modifier. I saw TC next to amounts that had not been received any payments or adjustments. Well that did not work out so well be cause there are several modifiers and they really don’t have anything to do with if any amounts have been applied to the fees.
I have been unable to find unique identifiers that would allow me to filter out fees that have not yet and any payments applied to them.
Any thoughts on a better way to tackle this problem?
Sherwin
openmedpractice.com