} echo "<td>{$provname}</td>\n"; } // end not billing view //this is where we print out the text of the billing that occurred on this encounter $thisauth = $auth_coding_a; if (!$thisauth && $auth_coding) { if ($result4['user'] == $_SESSION['authUser']) { $thisauth = $auth_coding; } } $coded = ""; $arid = 0; if ($thisauth && $auth_sensitivity) { $binfo = array('', '', '', '', ''); if ($subresult2 = getBillingByEncounter($pid, $result4['encounter'], "code_type, code, modifier, code_text, fee")) { // Get A/R info, if available, for this encounter. $arinvoice = array(); $arlinkbeg = ""; $arlinkend = ""; if ($billing_view && $accounting_enabled) { if ($INTEGRATED_AR) { $tmp = sqlQuery("SELECT id FROM form_encounter WHERE " . "pid = ? AND encounter = ?", array($pid, $result4['encounter'])); $arid = 0 + $tmp['id']; if ($arid) { $arinvoice = ar_get_invoice_summary($pid, $result4['encounter'], true); } } else { $arid = SLQueryValue("SELECT id FROM ar WHERE invnumber = " . "'{$pid}.{$result4['encounter']}'"); if ($arid) { $arinvoice = get_invoice_summary($arid, true);
if ($encarr != '') { foreach ($encarr as $enc) { if ($enc['formdir'] == 'newpatient') { continue; } if ($encnames) { $encnames .= '<br />'; } $encnames .= $enc['form_name']; } } // Fetch coding and compute billing status. $coded = ""; $billed_count = 0; $unbilled_count = 0; if ($billres = getBillingByEncounter($row['pid'], $row['encounter'], "code_type, code, code_text, billed")) { foreach ($billres as $billrow) { // $title = addslashes($billrow['code_text']); if ($billrow['code_type'] != 'COPAY' && $billrow['code_type'] != 'TAX') { $coded .= $billrow['code'] . ', '; if ($billrow['billed']) { ++$billed_count; } else { ++$unbilled_count; } } } $coded = substr($coded, 0, strlen($coded) - 2); } // Figure product sales into billing status. $sres = sqlStatement("SELECT billed FROM drug_sales " . "WHERE pid = '{$row['pid']}' AND encounter = '{$row['encounter']}'");
// In the case of running as an AJAX handler, we need to return this same // form with an updated checksum to properly support the invoking logic. // See review/js/fee_sheet_core.js for that logic. $current_checksum = visitChecksum($pid, $encounter, true); // Also remove form data for the newly entered lines so they are not // duplicated from the database. unset($_POST['bill']); unset($_POST['prod']); } else { formHeader("Redirecting...."); formJump(); formFooter(); exit; } } $billresult = getBillingByEncounter($pid, $encounter, "*"); ?> <html> <head> <?php html_header_show(); ?> <link rel="stylesheet" href="<?php echo $css_header; ?> " type="text/css"> <style> .billcell { font-family: sans-serif; font-size: 10pt } </style> <script language="JavaScript">
call_user_func($res[1] . "_report", $pid, $form_encounter, $N, $form_id); if ($res[1] == 'newpatient') { $bres = sqlStatement("SELECT date, code, code_text FROM billing WHERE " . "encounter = '{$form_encounter}' AND activity = 1 AND " . "(code_type = 'CPT4' OR code_type = 'OPCS') " . "ORDER BY date"); while ($brow = sqlFetchArray($bres)) { echo "<span class='bold'> Procedure: </span><span class='text'>" . $brow['code'] . " " . $brow['code_text'] . "</span><br>\n"; } } } } } } //borrowed from diagnosis.php ?> <table border="1" cellpadding=5> <?php if ($result = getBillingByEncounter($pid, $encounter, "*")) { $billing_html = array(); $total = 0.0; $copay = 0.0; //test // foreach ($result as $key => $val) { // print "<h2>$key</h2>"; // foreach($val as $key2 => $val2) { // print "<p> $key2 = $val2 </p>\n"; // } // } //end test foreach ($result as $iter) { $html = ''; if ($iter["code_type"] == "ICD9") { $html .= "<tr><td>" . $iter[code_type] . "</td><td>" . $iter[code] . "</td><td>" . $iter["code_text"] . "</td></tr>\n";
public function loadServiceItems() { $billresult = getBillingByEncounter($this->pid, $this->encounter, "*"); if ($billresult) { foreach ($billresult as $iter) { if (!$this->ALLOW_COPAYS && $iter["code_type"] == 'COPAY') { continue; } $justify = trim($iter['justify']); if ($justify) { $justify = substr(str_replace(':', ',', $justify), 0, strlen($justify) - 1); } $this->addServiceLineItem(array('id' => $iter['id'], 'codetype' => $iter['code_type'], 'code' => trim($iter['code']), 'modifier' => trim($iter["modifier"]), 'code_text' => trim($iter['code_text']), 'units' => $iter['units'], 'fee' => $iter['fee'], 'pricelevel' => $iter['pricelevel'], 'billed' => $iter['billed'], 'ndc_info' => $iter['ndc_info'], 'provider_id' => $iter['provider_id'], 'justify' => $justify, 'notecodes' => trim($iter['notecodes']))); } } // echo "<!-- \n"; // debugging // print_r($this->serviceitems); // debugging // echo "--> \n"; // debugging }
} else { echo "(" . xl('No access') . ")"; } echo "{$linkend}</td>\n"; // show encounter reason echo "<td valign='top'>{$linkbeg}" . $reason_string . "{$linkend}</td>\n"; //this is where we print out the text of the billing that occurred on this encounter $thisauth = $auth_coding_a; if (!$thisauth && $auth_coding) { if ($erow['user'] == $_SESSION['authUser']) { $thisauth = $auth_coding; } } $coded = ""; if ($thisauth && $auth_sensitivity) { if ($subresult2 = getBillingByEncounter($pid, $iter["encounter"])) { foreach ($subresult2 as $iter2) { $coded .= "<span title='" . addslashes($iter2["code_text"]) . "'>"; $coded .= $iter2["code"] . "</span>, "; } $coded = substr($coded, 0, strlen($coded) - 2); } } else { $coded = "(No access)"; } echo "<td valign='top'>{$linkbeg}" . $coded . "{$linkend}</td>\n"; // show provider echo "<td valign='top'>{$linkbeg}" . $erow['user'] . "{$linkend}</td>\n"; // Show insurance. if (!$GLOBALS['athletic_team']) { $insured = "{$raw_encounter_date}";
formFooter(); exit; } // end not running as ajax } // end save or save-and-close // Handle reopen request. In that case no other changes will be saved. // If there was a checkout this will undo it. if (!$alertmsg && $_POST['bn_reopen']) { doVoid($fs->pid, $fs->encounter, true); $current_checksum = $fs->visitChecksum(); // Remove the line items so they are refreshed from the database on redisplay. unset($_POST['bill']); unset($_POST['prod']); } $billresult = getBillingByEncounter($fs->pid, $fs->encounter, "*"); ?> <html> <head> <?php html_header_show(); ?> <link rel="stylesheet" href="<?php echo $css_header; ?> " type="text/css"> <style> .billcell { font-family: sans-serif; font-size: 10pt } </style> <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>