function bucks($amount)
{
    if ($amount) {
        return oeFormatMoney($amount);
    }
    return "";
}
Example #2
0
 /**
  * @dataProvider example_american_two_decimal
  */
 public function testAmericanTwoDecimal( $amount, $formatted )
 {
   $GLOBALS['currency_decimals']       = '2';
   $GLOBALS['currency_dec_point']      = '.';
   $GLOBALS['currency_thousands_sep']  = ',';
   $this->assertEquals( $formatted, oeFormatMoney( $amount ), "'$amount' converts to '$formatted'" );
 }
function bucks($amount)
{
    if ($amount != 0) {
        return oeFormatMoney($amount);
    }
    return '';
}
Example #4
0
function writeDetailLine($bgcolor, $class, $ptname, $invnumber, $code, $date, $description, $amount, $balance)
{
    global $last_ptname, $last_invnumber, $last_code;
    if ($ptname == $last_ptname) {
        $ptname = ' ';
    } else {
        $last_ptname = $ptname;
    }
    if ($invnumber == $last_invnumber) {
        $invnumber = ' ';
    } else {
        $last_invnumber = $invnumber;
    }
    if ($code == $last_code) {
        $code = ' ';
    } else {
        $last_code = $code;
    }
    if ($amount) {
        $amount = sprintf("%.2f", $amount);
    }
    if ($balance) {
        $balance = sprintf("%.2f", $balance);
    }
    $dline = " <tr bgcolor='{$bgcolor}'>\n" . "  <td class='{$class}'>{$ptname}</td>\n" . "  <td class='{$class}'>{$invnumber}</td>\n" . "  <td class='{$class}'>{$code}</td>\n" . "  <td class='{$class}'>" . oeFormatShortDate($date) . "</td>\n" . "  <td class='{$class}'>{$description}</td>\n" . "  <td class='{$class}' align='right'>" . oeFormatMoney($amount) . "</td>\n" . "  <td class='{$class}' align='right'>" . oeFormatMoney($balance) . "</td>\n" . " </tr>\n";
    echo $dline;
}
function bucks($amount)
{
    if (empty($amount)) {
        return '';
    }
    return oeFormatMoney($amount);
}
Example #6
0
function bucks($amount)
{
    if ($amount) {
        $amount = oeFormatMoney($amount);
        return $amount;
    }
    return '';
}
Example #7
0
             echo $b['code_type'] . ":\t" . $b['code'] . "&nbsp;" . $b['modifier'] . "&nbsp;&nbsp;&nbsp;" . $b['code_text'] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
             echo "</td>\n";
             echo "<td class=text>";
             echo oeFormatMoney($b['fee']);
             echo "</td>\n";
             echo "</tr>\n";
             $total += $b['fee'];
             if ($b['code_type'] == "COPAY") {
                 $copays += $b['fee'];
             }
         }
     }
     echo "<tr><td>&nbsp;</td></tr>";
     echo "<tr><td class=bold>" . xl('Sub-Total') . "</td><td class=text>" . oeFormatMoney($total + abs($copays)) . "</td></tr>";
     echo "<tr><td class=bold>" . xl('Paid') . "</td><td class=text>" . oeFormatMoney(abs($copays)) . "</td></tr>";
     echo "<tr><td class=bold>" . xl('Total') . "</td><td class=text>" . oeFormatMoney($total) . "</td></tr>";
     echo "</table>";
     echo "<pre>";
     //print_r($billings);
     echo "</pre>";
 } else {
     printPatientBilling($pid);
 }
 echo "</div>\n";
 // end of billing DIV
 /****
 
         } elseif ($val == "allergies") {
 
             print "<span class=bold>Patient Allergies:</span><br>";
             printListData($pid, "allergy", "1");
function bucks($amt)
{
    return $amt != 0.0 ? oeFormatMoney($amt) : '';
}
Example #9
0
                    $ndcuom = $tmp[2];
                    $ndcqty = $tmp[3];
                }
                $billing_html[$iter["code_type"]] .= "<tr><td>&nbsp;</td><td class='small'>NDC:&nbsp;\n" . "<input type='hidden' name='ndc[{$ndclino}][code]' value='" . $iter[code] . "'>" . "<input type='text' name='ndc[{$ndclino}][ndcnum]' value='{$ndcnum}' " . "size='11' style='background-color:transparent'>" . " &nbsp;Qty:&nbsp;" . "<input type='text' name='ndc[{$ndclino}][ndcqty]' value='{$ndcqty}' " . "size='3' style='background-color:transparent;text-align:right'> " . "<select name='ndc[{$ndclino}][ndcuom]' style='background-color:transparent'>";
                foreach ($ndc_uom_choices as $key => $value) {
                    $billing_html[$iter["code_type"]] .= "<option value='{$key}'";
                    if ($key == $ndcuom) {
                        $billing_html[$iter["code_type"]] .= " selected";
                    }
                    $billing_html[$iter["code_type"]] .= ">{$value}</option>";
                }
                $billing_html[$iter["code_type"]] .= "</select></td></tr>\n";
            }
        }
    }
    $billing_html["CPT4"] .= "<tr><td>" . xl('total') . ":</td><td>" . oeFormatMoney($total) . "</td></tr>\n";
    foreach ($billing_html as $key => $val) {
        print "<tr><td>{$key}</td><td><table>{$val}</table><td></tr><tr><td height=\"5\"></td></tr>\n";
    }
}
?>
</tr></table>
</td>
</tr>
<input type="hidden" name="encounter_id" value="<?php 
echo $encounter;
?>
">
<input type="hidden" name="patient_id" value="<?php 
echo $pid;
?>
            echo '"' . $key . '",';
            echo '"' . oeFormatMoney($val['charges']) . '",';
            echo '"' . $val['visits'] . '",';
            echo '"' . $val['patients'] . '",';
            echo '"' . sprintf("%.1f", $val['patients'] * 100 / $patcount) . '"' . "\n";
        } else {
            ?>
 <tr>
  <td>
   <?php 
            echo $key;
            ?>
  </td>
  <td align='right'>
   <?php 
            echo oeFormatMoney($val['charges']);
            ?>
  </td>
  <td align='right'>
   <?php 
            echo $val['visits'];
            ?>
  </td>
  <td align='right'>
   <?php 
            echo $val['patients'];
            ?>
  </td>
  <td align='right'>
   <?php 
            printf("%.1f", $val['patients'] * 100 / $patcount);
Example #11
0
                 $justify .= " (<b>{$j}</b>)";
             } else {
                 $justify .= " ({$j})";
             }
             $counter++;
         }
     }
 }
 $rhtml .= "<td><span class='text'>" . ($iter['code_type'] == 'COPAY' ? oeFormatMoney($iter['code']) : $iter['code']);
 if ($iter['modifier']) {
     $rhtml .= ":" . $iter['modifier'];
 }
 $rhtml .= "</span><span style='font-size:8pt;'>{$justify}</span></td>\n";
 $rhtml .= '<td align="right"><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
 if ($iter['id'] && $iter['fee'] > 0) {
     $rhtml .= oeFormatMoney($iter['fee']);
 }
 $rhtml .= "</span></td>\n";
 $rhtml .= '<td><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
 if ($iter['id']) {
     $rhtml .= getProviderName(empty($iter['provider_id']) ? $iter['enc_provider_id'] : $iter['provider_id']);
 }
 $rhtml .= "</span></td>\n";
 $rhtml .= '<td width=100>&nbsp;&nbsp;&nbsp;<span style="font-size:8pt;">';
 if ($iter['id']) {
     $rhtml .= oeFormatSDFT(strtotime($iter["date"]));
 }
 $rhtml .= "</span></td>\n";
 if ($iter['id'] && $iter['authorized'] != 1) {
     $rhtml .= "<td><span class=alert>" . xl("Note: This code was not entered by an authorized user. Only authorized codes may be uploaded to the Open Medical Billing Network for processing. If you wish to upload these codes, please select an authorized user here.") . "</span></td>\n";
 } else {
Example #12
0
function generate_receipt($patient_id, $encounter = 0)
{
    global $sl_err, $sl_cash_acc, $css_header, $details;
    // Get details for what we guess is the primary facility.
    $frow = sqlQuery("SELECT * FROM facility " . "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1");
    $patdata = getPatientData($patient_id, 'fname,mname,lname,pubpid,street,city,state,postal_code,providerID');
    // Get the most recent invoice data or that for the specified encounter.
    //
    // Adding a provider check so that their info can be displayed on receipts
    if ($encounter) {
        $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? AND encounter = ?", array($patient_id, $encounter));
    } else {
        $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? " . "ORDER BY id DESC LIMIT 1", array($patient_id));
    }
    if (empty($ferow)) {
        die(xlt("This patient has no activity."));
    }
    $trans_id = $ferow['id'];
    $encounter = $ferow['encounter'];
    $svcdate = substr($ferow['date'], 0, 10);
    if ($GLOBALS['receipts_by_provider']) {
        if (isset($ferow['provider_id'])) {
            $encprovider = $ferow['provider_id'];
        } else {
            if (isset($patdata['providerID'])) {
                $encprovider = $patdata['providerID'];
            } else {
                $encprovider = -1;
            }
        }
    }
    if ($encprovider) {
        $providerrow = sqlQuery("SELECT fname, mname, lname, title, street, streetb, " . "city, state, zip, phone, fax FROM users WHERE id = ?", array($encprovider));
    }
    // Get invoice reference number.
    $encrow = sqlQuery("SELECT invoice_refno FROM form_encounter WHERE " . "pid = ? AND encounter = ? LIMIT 1", array($patient_id, $encounter));
    $invoice_refno = $encrow['invoice_refno'];
    ?>
<html>
<head>
<?php 
    html_header_show();
    ?>
<link rel='stylesheet' href='<?php 
    echo $css_header;
    ?>
' type='text/css'>
<title><?php 
    echo xlt('Receipt for Payment');
    ?>
</title>
<script type="text/javascript" src="<?php 
    echo $GLOBALS['assets_static_relative'];
    ?>
/jquery-min-1-2-2/index.js"></script>
<script type="text/javascript" src="../../library/dialog.js"></script>
<script language="JavaScript">

<?php 
    require $GLOBALS['srcdir'] . "/restoreSession.php";
    ?>

 $(document).ready(function() {
  var win = top.printLogSetup ? top : opener.top;
  win.printLogSetup(document.getElementById('printbutton'));
 });

 // Process click on Print button.
 function printlog_before_print() {
  var divstyle = document.getElementById('hideonprint').style;
  divstyle.display = 'none';
 }

 // Process click on Delete button.
 function deleteme() {
  dlgopen('deleter.php?billing=<?php 
    echo attr("{$patient_id}.{$encounter}");
    ?>
', '_blank', 500, 450);
  return false;
 }

 // Called by the deleteme.php window on a successful delete.
 function imdeleted() {
  window.close();
 }

</script>
</head>
<body class="body_top">
<center>
<?php 
    if ($GLOBALS['receipts_by_provider'] && !empty($providerrow)) {
        printProviderHeader($providerrow);
    } else {
        printFacilityHeader($frow);
    }
    echo xlt("Receipt Generated") . ":" . text(date(' F j, Y'));
    if ($invoice_refno) {
        echo " " . xlt("Invoice Number") . ": " . text($invoice_refno) . " " . xlt("Service Date") . ": " . text($svcdate);
    }
    ?>
<br>&nbsp;
</b></p>
</center>
<p>
<?php 
    echo text($patdata['fname']) . ' ' . text($patdata['mname']) . ' ' . text($patdata['lname']);
    ?>
<br><?php 
    echo text($patdata['street']);
    ?>
<br><?php 
    echo text($patdata['city']) . ', ' . text($patdata['state']) . ' ' . text($patdata['postal_code']);
    ?>
<br>&nbsp;
</p>
<center>
<table cellpadding='5'>
 <tr>
  <td><b><?php 
    echo xlt('Date');
    ?>
</b></td>
  <td><b><?php 
    echo xlt('Description');
    ?>
</b></td>
  <td align='right'><b><?php 
    echo $details ? xlt('Price') : '&nbsp;';
    ?>
</b></td>
  <td align='right'><b><?php 
    echo $details ? xlt('Qty') : '&nbsp;';
    ?>
</b></td>
  <td align='right'><b><?php 
    echo xlt('Total');
    ?>
</b></td>
 </tr>

<?php 
    $charges = 0.0;
    // Product sales
    $inres = sqlStatement("SELECT s.sale_id, s.sale_date, s.fee, " . "s.quantity, s.drug_id, d.name " . "FROM drug_sales AS s LEFT JOIN drugs AS d ON d.drug_id = s.drug_id " . "WHERE s.pid = ? AND s.encounter = ? " . "ORDER BY s.sale_id", array($patient_id, $encounter));
    while ($inrow = sqlFetchArray($inres)) {
        $charges += sprintf('%01.2f', $inrow['fee']);
        receiptDetailLine($inrow['sale_date'], $inrow['name'], $inrow['fee'], $inrow['quantity']);
    }
    // Service and tax items
    $inres = sqlStatement("SELECT * FROM billing WHERE " . "pid = ? AND encounter = ? AND " . "code_type != 'COPAY' AND activity = 1 " . "ORDER BY id", array($patient_id, $encounter));
    while ($inrow = sqlFetchArray($inres)) {
        $charges += sprintf('%01.2f', $inrow['fee']);
        receiptDetailLine($svcdate, $inrow['code_text'], $inrow['fee'], $inrow['units']);
    }
    // Adjustments.
    $inres = sqlStatement("SELECT " . "a.code_type, a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.adj_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter));
    while ($inrow = sqlFetchArray($inres)) {
        $charges -= sprintf('%01.2f', $inrow['adj_amount']);
        $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type'];
        receiptDetailLine($svcdate, $payer . ' ' . $inrow['memo'], 0 - $inrow['adj_amount'], 1);
    }
    ?>

 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>
 <tr>
  <td><?php 
    echo text(oeFormatShortDate($svcdispdate));
    ?>
</td>
  <td><b><?php 
    echo xlt('Total Charges');
    ?>
</b></td>
  <td align='right'>&nbsp;</td>
  <td align='right'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>

<?php 
    // Get co-pays.
    $inres = sqlStatement("SELECT fee, code_text FROM billing WHERE " . "pid = ? AND encounter = ?  AND " . "code_type = 'COPAY' AND activity = 1 AND fee != 0 " . "ORDER BY id", array($patient_id, $encounter));
    while ($inrow = sqlFetchArray($inres)) {
        $charges += sprintf('%01.2f', $inrow['fee']);
        receiptPaymentLine($svcdate, 0 - $inrow['fee'], $inrow['code_text']);
    }
    // Get other payments.
    $inres = sqlStatement("SELECT " . "a.code_type, a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.pay_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter));
    while ($inrow = sqlFetchArray($inres)) {
        $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type'];
        $charges -= sprintf('%01.2f', $inrow['pay_amount']);
        receiptPaymentLine($svcdate, $inrow['pay_amount'], $payer . ' ' . $inrow['reference']);
    }
    ?>
 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td><b><?php 
    echo xlt('Balance Due');
    ?>
</b></td>
  <td colspan='2'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
</table>
</center>
<div id='hideonprint'>
<p>
&nbsp;
<a href='#' id='printbutton'><?php 
    echo xlt('Print');
    ?>
</a>
<?php 
    if (acl_check('acct', 'disc')) {
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href='#' onclick='return deleteme();'><?php 
        echo xlt('Undo Checkout');
        ?>
</a>
<?php 
    }
    ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php 
    if ($details) {
        ?>
<a href='pos_checkout.php?details=0&ptid=<?php 
        echo attr($patient_id);
        ?>
&enc=<?php 
        echo attr($encounter);
        ?>
' onclick='top.restoreSession()'><?php 
        echo xlt('Hide Details');
        ?>
</a>
<?php 
    } else {
        ?>
<a href='pos_checkout.php?details=1&ptid=<?php 
        echo attr($patient_id);
        ?>
&enc=<?php 
        echo attr($encounter);
        ?>
' onclick='top.restoreSession()'><?php 
        echo xlt('Show Details');
        ?>
</a>
<?php 
    }
    ?>
</p>
</div>
</body>
</html>
<?php 
}
Example #13
0
function generate_receipt($patient_id, $encounter = 0)
{
    global $sl_err, $sl_cash_acc, $css_header, $details, $INTEGRATED_AR;
    // Get details for what we guess is the primary facility.
    $frow = sqlQuery("SELECT * FROM facility " . "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1");
    $patdata = getPatientData($patient_id, 'fname,mname,lname,pubpid,street,city,state,postal_code,providerID');
    // Get the most recent invoice data or that for the specified encounter.
    //
    // Adding a provider check so that their info can be displayed on receipts
    if ($INTEGRATED_AR) {
        if ($encounter) {
            $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? AND encounter = ?", array($patient_id, $encounter));
        } else {
            $ferow = sqlQuery("SELECT id, date, encounter, provider_id FROM form_encounter " . "WHERE pid = ? " . "ORDER BY id DESC LIMIT 1", array($patient_id));
        }
        if (empty($ferow)) {
            die(xlt("This patient has no activity."));
        }
        $trans_id = $ferow['id'];
        $encounter = $ferow['encounter'];
        $svcdate = substr($ferow['date'], 0, 10);
        if ($GLOBALS['receipts_by_provider']) {
            if (isset($ferow['provider_id'])) {
                $encprovider = $ferow['provider_id'];
            } else {
                if (isset($patdata['providerID'])) {
                    $encprovider = $patdata['providerID'];
                } else {
                    $encprovider = -1;
                }
            }
        }
        if ($encprovider) {
            $providerrow = sqlQuery("SELECT fname, mname, lname, title, street, streetb, " . "city, state, zip, phone, fax FROM users WHERE id = ?", array($encprovider));
        }
    } else {
        SLConnect();
        //
        $arres = SLQuery("SELECT * FROM ar WHERE " . "invnumber LIKE '{$patient_id}.%' " . "ORDER BY id DESC LIMIT 1");
        if ($sl_err) {
            die(text($sl_err));
        }
        if (!SLRowCount($arres)) {
            die(xlt("This patient has no activity."));
        }
        $arrow = SLGetRow($arres, 0);
        //
        $trans_id = $arrow['id'];
        //
        // Determine the date of service.  An 8-digit encounter number is
        // presumed to be a date of service imported during conversion or
        // associated with prescriptions only.  Otherwise look it up in the
        // form_encounter table.
        //
        $svcdate = "";
        list($trash, $encounter) = explode(".", $arrow['invnumber']);
        if (strlen($encounter) >= 8) {
            $svcdate = substr($encounter, 0, 4) . "-" . substr($encounter, 4, 2) . "-" . substr($encounter, 6, 2);
        } else {
            if ($encounter) {
                $tmp = sqlQuery("SELECT date FROM form_encounter WHERE " . "encounter = ?", array($encounter));
                $svcdate = substr($tmp['date'], 0, 10);
            }
        }
    }
    // end not $INTEGRATED_AR
    // Get invoice reference number.
    $encrow = sqlQuery("SELECT invoice_refno FROM form_encounter WHERE " . "pid = ? AND encounter = ? LIMIT 1", array($patient_id, $encounter));
    $invoice_refno = $encrow['invoice_refno'];
    ?>
<html>
<head>
<?php 
    html_header_show();
    ?>
<link rel='stylesheet' href='<?php 
    echo $css_header;
    ?>
' type='text/css'>
<title><?php 
    echo xlt('Receipt for Payment');
    ?>
</title>
<script type="text/javascript" src="../../library/dialog.js"></script>
<script language="JavaScript">

<?php 
    require $GLOBALS['srcdir'] . "/restoreSession.php";
    ?>

 // Process click on Print button.
 function printme() {
  var divstyle = document.getElementById('hideonprint').style;
  divstyle.display = 'none';
  window.print();
  return false;
 }

 // Process click on Delete button.
 function deleteme() {
  dlgopen('deleter.php?billing=<?php 
    echo attr("{$patient_id}.{$encounter}");
    ?>
', '_blank', 500, 450);
  return false;
 }

 // Called by the deleteme.php window on a successful delete.
 function imdeleted() {
  window.close();
 }

</script>
</head>
<body class="body_top">
<center>
<?php 
    if ($GLOBALS['receipts_by_provider'] && !empty($providerrow)) {
        printProviderHeader($providerrow);
    } else {
        printFacilityHeader($frow);
    }
    echo xlt("Receipt Generated") . ":" . text(date(' F j, Y'));
    if ($invoice_refno) {
        echo " " . xlt("Invoice Number") . ": " . text($invoice_refno) . " " . xlt("Service Date") . ": " . text($svcdate);
    }
    ?>
<br>&nbsp;
</b></p>
</center>
<p>
<?php 
    echo text($patdata['fname']) . ' ' . text($patdata['mname']) . ' ' . text($patdata['lname']);
    ?>
<br><?php 
    echo text($patdata['street']);
    ?>
<br><?php 
    echo text($patdata['city']) . ', ' . text($patdata['state']) . ' ' . text($patdata['postal_code']);
    ?>
<br>&nbsp;
</p>
<center>
<table cellpadding='5'>
 <tr>
  <td><b><?php 
    echo xlt('Date');
    ?>
</b></td>
  <td><b><?php 
    echo xlt('Description');
    ?>
</b></td>
  <td align='right'><b><?php 
    echo $details ? xlt('Price') : '&nbsp;';
    ?>
</b></td>
  <td align='right'><b><?php 
    echo $details ? xlt('Qty') : '&nbsp;';
    ?>
</b></td>
  <td align='right'><b><?php 
    echo xlt('Total');
    ?>
</b></td>
 </tr>

<?php 
    $charges = 0.0;
    if ($INTEGRATED_AR) {
        // Product sales
        $inres = sqlStatement("SELECT s.sale_id, s.sale_date, s.fee, " . "s.quantity, s.drug_id, d.name " . "FROM drug_sales AS s LEFT JOIN drugs AS d ON d.drug_id = s.drug_id " . "WHERE s.pid = ? AND s.encounter = ? " . "ORDER BY s.sale_id", array($patient_id, $encounter));
        while ($inrow = sqlFetchArray($inres)) {
            $charges += sprintf('%01.2f', $inrow['fee']);
            receiptDetailLine($inrow['sale_date'], $inrow['name'], $inrow['fee'], $inrow['quantity']);
        }
        // Service and tax items
        $inres = sqlStatement("SELECT * FROM billing WHERE " . "pid = ? AND encounter = ? AND " . "code_type != 'COPAY' AND activity = 1 " . "ORDER BY id", array($patient_id, $encounter));
        while ($inrow = sqlFetchArray($inres)) {
            $charges += sprintf('%01.2f', $inrow['fee']);
            receiptDetailLine($svcdate, $inrow['code_text'], $inrow['fee'], $inrow['units']);
        }
        // Adjustments.
        $inres = sqlStatement("SELECT " . "a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.adj_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter));
        while ($inrow = sqlFetchArray($inres)) {
            $charges -= sprintf('%01.2f', $inrow['adj_amount']);
            $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type'];
            receiptDetailLine($svcdate, $payer . ' ' . $inrow['memo'], 0 - $inrow['adj_amount'], 1);
        }
    } else {
        // Request all line items with money belonging to the invoice.
        $inres = SLQuery("SELECT * FROM invoice WHERE " . "trans_id = {$trans_id} AND sellprice != 0 ORDER BY id");
        if ($sl_err) {
            die($sl_err);
        }
        for ($irow = 0; $irow < SLRowCount($inres); ++$irow) {
            $row = SLGetRow($inres, $irow);
            $amount = sprintf('%01.2f', $row['sellprice'] * $row['qty']);
            $charges += $amount;
            $desc = preg_replace('/^.{1,6}:/', '', $row['description']);
            receiptDetailLine($svcdate, $desc, $amount, $row['qty']);
        }
    }
    // end not $INTEGRATED_AR
    ?>

 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>
 <tr>
  <td><?php 
    echo text(oeFormatShortDate($svcdispdate));
    ?>
</td>
  <td><b><?php 
    echo xlt('Total Charges');
    ?>
</b></td>
  <td align='right'>&nbsp;</td>
  <td align='right'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>

<?php 
    if ($INTEGRATED_AR) {
        // Get co-pays.
        $inres = sqlStatement("SELECT fee, code_text FROM billing WHERE " . "pid = ? AND encounter = ?  AND " . "code_type = 'COPAY' AND activity = 1 AND fee != 0 " . "ORDER BY id", array($patient_id, $encounter));
        while ($inrow = sqlFetchArray($inres)) {
            $charges += sprintf('%01.2f', $inrow['fee']);
            receiptPaymentLine($svcdate, 0 - $inrow['fee'], $inrow['code_text']);
        }
        // Get other payments.
        $inres = sqlStatement("SELECT " . "a.code, a.modifier, a.memo, a.payer_type, a.adj_amount, a.pay_amount, " . "s.payer_id, s.reference, s.check_date, s.deposit_date " . "FROM ar_activity AS a " . "LEFT JOIN ar_session AS s ON s.session_id = a.session_id WHERE " . "a.pid = ? AND a.encounter = ? AND " . "a.pay_amount != 0 " . "ORDER BY s.check_date, a.sequence_no", array($patient_id, $encounter));
        $payer = empty($inrow['payer_type']) ? 'Pt' : 'Ins' . $inrow['payer_type'];
        while ($inrow = sqlFetchArray($inres)) {
            $charges -= sprintf('%01.2f', $inrow['pay_amount']);
            receiptPaymentLine($svcdate, $inrow['pay_amount'], $payer . ' ' . $inrow['reference']);
        }
    } else {
        $chart_id_cash = SLQueryValue("select id from chart where accno = '{$sl_cash_acc}'");
        if ($sl_err) {
            die($sl_err);
        }
        if (!$chart_id_cash) {
            die("There is no COA entry for cash account '{$sl_cash_acc}'");
        }
        //
        // Request all cash entries belonging to the invoice.
        $atres = SLQuery("SELECT * FROM acc_trans WHERE " . "trans_id = {$trans_id} AND chart_id = {$chart_id_cash} ORDER BY transdate");
        if ($sl_err) {
            die($sl_err);
        }
        //
        for ($irow = 0; $irow < SLRowCount($atres); ++$irow) {
            $row = SLGetRow($atres, $irow);
            $amount = sprintf('%01.2f', $row['amount']);
            // negative
            $charges += $amount;
            $rowsource = $row['source'];
            if (strtolower($rowsource) == 'co-pay') {
                $rowsource = '';
            }
            receiptPaymentLine($row['transdate'], 0 - $amount, $rowsource);
        }
    }
    // end not $INTEGRATED_AR
    ?>
 <tr>
  <td colspan='5'>&nbsp;</td>
 </tr>
 <tr>
  <td>&nbsp;</td>
  <td><b><?php 
    echo xlt('Balance Due');
    ?>
</b></td>
  <td colspan='2'>&nbsp;</td>
  <td align='right'><?php 
    echo text(oeFormatMoney($charges, true));
    ?>
</td>
 </tr>
</table>
</center>
<div id='hideonprint'>
<p>
&nbsp;
<a href='#' onclick='return printme();'><?php 
    echo xlt('Print');
    ?>
</a>
<?php 
    if (acl_check('acct', 'disc')) {
        ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href='#' onclick='return deleteme();'><?php 
        echo xlt('Undo Checkout');
        ?>
</a>
<?php 
    }
    ?>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<?php 
    if ($details) {
        ?>
<a href='pos_checkout.php?details=0&ptid=<?php 
        echo attr($patient_id);
        ?>
&enc=<?php 
        echo attr($encounter);
        ?>
'><?php 
        echo xlt('Hide Details');
        ?>
</a>
<?php 
    } else {
        ?>
<a href='pos_checkout.php?details=1&ptid=<?php 
        echo attr($patient_id);
        ?>
&enc=<?php 
        echo attr($encounter);
        ?>
'><?php 
        echo xlt('Show Details');
        ?>
</a>
<?php 
    }
    ?>
</p>
</div>
</body>
</html>
<?php 
    if (!$INTEGRATED_AR) {
        SLClose();
    }
}
Example #14
0
    $forceExpandAlways = true;
} else {
    $forceExpandAlways = false;
}
expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth, $forceExpandAlways);
?>
        <br>
<?php 
//PATIENT BALANCE,INS BALANCE naina@capminds.com
$patientbalance = get_patient_balance($pid, false);
//Debit the patient balance from insurance balance
$insurancebalance = get_patient_balance($pid, true) - $patientbalance;
$totalbalance = $patientbalance + $insurancebalance;
if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
    // Show current balance and billing note, if any.
    echo "<table border='0'><tr><td>" . "<table ><tr><td><span class='bold'><font color='red'>" . xlt('Patient Balance Due') . " : " . text(oeFormatMoney($patientbalance)) . "</font></span></td></tr>" . "<tr><td><span class='bold'><font color='red'>" . xlt('Insurance Balance Due') . " : " . text(oeFormatMoney($insurancebalance)) . "</font></span></td></tr>" . "<tr><td><span class='bold'><font color='red'>" . xlt('Total Balance Due') . " : " . text(oeFormatMoney($totalbalance)) . "</font></span></td></td></tr>";
    if ($result['genericname2'] == 'Billing') {
        echo "<tr><td><span class='bold'><font color='red'>" . xlt('Billing Note') . ":" . text($result['genericval2']) . "</font></span></td></tr>";
    }
    if ($result3['provider']) {
        // Use provider in case there is an ins record w/ unassigned insco
        echo "<tr><td><span class='bold'>" . xlt('Primary Insurance') . ': ' . text($insco_name) . "</span>&nbsp;&nbsp;&nbsp;";
        if ($result3['copay'] > 0) {
            echo "<span class='bold'>" . xlt('Copay') . ': ' . text($result3['copay']) . "</span>&nbsp;&nbsp;&nbsp;";
        }
        echo "<span class='bold'>" . xlt('Effective Date') . ': ' . text(oeFormatShortDate($result3['effdate'])) . "</span></td></tr>";
    }
    echo "</table></td></tr></td></tr></table><br>";
}
?>
        </div> <!-- required for expand_collapse_widget -->
Example #15
0
    $colorend = "</span>";
}
//Display what the patient owes
$balance = get_patient_balance($patient_id);
?>

<?php 
if ($billing_note || $balance) {
    ?>

<div style='margin-top:3px'>
<table width='80%'>
<?php 
    if ($balance != "0") {
        // $formatted = sprintf((xl('$').'%01.2f'), $balance);
        $formatted = oeFormatMoney($balance);
        echo " <tr class='text billing'>\n";
        echo "  <td>" . $colorbeg . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES) . $colorend . "&nbsp;" . $colorbeg . htmlspecialchars($formatted, ENT_NOQUOTES) . $colorend . "</td>\n";
        echo " </tr>\n";
    }
    if ($billing_note) {
        echo " <tr class='text billing'>\n";
        echo "  <td>" . $colorbeg . htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES) . $colorend . "&nbsp;" . $colorbeg . htmlspecialchars($billing_note, ENT_NOQUOTES) . $colorend . "</td>\n";
        echo " </tr>\n";
    }
    ?>
</table>
</div>
<br>
<?php 
}
Example #16
0
function endInsurance($insrow)
{
    global $export_patient_count, $export_dollars, $bgcolor;
    global $grand_total_charges, $grand_total_adjustments, $grand_total_paid;
    global $grand_total_agedbal, $is_due_ins, $form_age_cols;
    global $initial_colspan, $form_cb_idays, $form_cb_err;
    if (!$insrow['pid']) {
        return;
    }
    $ins_balance = $insrow['amount'] - $insrow['paid'];
    if ($_POST['form_export'] || $_POST['form_csvexport']) {
        // No exporting of insurance summaries.
        $export_patient_count += 1;
        $export_dollars += $ins_balance;
    } else {
        echo " <tr bgcolor='{$bgcolor}'>\n";
        echo "  <td class='detail'>" . $insrow['insname'] . "</td>\n";
        echo "  <td class='detotal' align='right'>&nbsp;" . oeFormatMoney($insrow['charges']) . "&nbsp;</td>\n";
        echo "  <td class='detotal' align='right'>&nbsp;" . oeFormatMoney($insrow['adjustments']) . "&nbsp;</td>\n";
        echo "  <td class='detotal' align='right'>&nbsp;" . oeFormatMoney($insrow['paid']) . "&nbsp;</td>\n";
        if ($form_age_cols) {
            for ($c = 0; $c < $form_age_cols; ++$c) {
                echo "  <td class='detotal' align='right'>&nbsp;" . oeFormatMoney($insrow['agedbal'][$c]) . "&nbsp;</td>\n";
            }
        } else {
            echo "  <td class='detotal' align='right'>&nbsp;" . oeFormatMoney($ins_balance) . "&nbsp;</td>\n";
        }
        echo " </tr>\n";
    }
    $grand_total_charges += $insrow['charges'];
    $grand_total_adjustments += $insrow['adjustments'];
    $grand_total_paid += $insrow['paid'];
    for ($c = 0; $c < $form_age_cols; ++$c) {
        $grand_total_agedbal[$c] += $insrow['agedbal'][$c];
    }
}
function bucks($amount)
{
    if ($amount) {
        echo attr(oeFormatMoney($amount));
    }
}
Example #18
0
function PrintCreditDetail($detail, $pat, $unassigned = false)
{
    global $enc_pmt, $total_pmt, $enc_adj, $total_adj, $enc_bal, $total_bal;
    global $bgcolor, $orow, $enc_units, $enc_chg;
    foreach ($detail as $pmt) {
        if ($unassigned) {
            if ($pmt['pay_total'] - $pmt['applied'] == 0) {
                continue;
            }
        }
        $bgcolor = $bgcolor == "#FFFFDD" ? "#FFDDDD" : "#FFFFDD";
        $print = "<tr bgcolor='" . attr($bgcolor) . "'>";
        $print .= "<td class='detail'>&nbsp;</td>";
        $method = List_Look($pmt['payment_method'], 'payment_method');
        $desc = $pmt['description'];
        $ref = $pmt['reference'];
        if ($unassigned) {
            $memo = List_Look($pmt['adjustment_code'], 'payment_adjustment_code');
        } else {
            $memo = $pmt['memo'];
        }
        $description = $method;
        if ($ref) {
            if ($description) {
                $description .= ' - ';
            }
            $description .= $ref;
        }
        if ($desc) {
            if ($description) {
                $description .= ': ';
            }
            $description .= $desc;
        }
        if ($memo) {
            if ($description) {
                $description .= ' ';
            }
            $description .= '[' . $memo . ']';
        }
        $print .= "<td class='detail' colspan='2'>" . text($description) . "&nbsp;</td>";
        $payer = $pmt['name'] == '' ? xl('Patient') : $pmt['name'];
        if ($unassigned) {
            $pmt_date = substr($pmt['post_to_date'], 0, 10);
        } else {
            $pmt_date = substr($pmt['post_time'], 0, 10);
        }
        $print .= "<td class='detail'>" . text($pmt_date) . "&nbsp;/&nbsp;" . text($payer) . "</td>";
        $type = List_Look($pmt['payment_type'], 'payment_type');
        $print .= "<td class='detail'>" . text($type) . "&nbsp;</td>";
        if ($unassigned) {
            $pmt_amt = $pmt['pay_total'] - $pmt['applied'];
            $uac_bal = oeFormatMoney($pmt_amt * -1);
            $uac_appl = oeFormatMoney($pmt['applied']);
            $uac_total = oeFormatMoney($pmt['pay_total']);
            $pmt_amt = $pmt['pay_total'];
            $total_pmt = $total_pmt - $uac_bal;
        } else {
            $uac_total = '';
            $uac_bal = '';
            $uac_appl = '';
            $pmt_amt = $pmt['pay_amount'];
            $adj_amt = $pmt['adj_amount'];
            $enc_pmt = $enc_pmt + $pmt['pay_amount'];
            $total_pmt = $total_pmt + $pmt['pay_amount'];
            $enc_adj = $enc_adj + $pmt['adj_amount'];
            $total_adj = $total_adj + $pmt['adj_amount'];
        }
        $print_pmt = '';
        if ($pmt_amt != 0) {
            $print_pmt = oeFormatMoney($pmt_amt);
        }
        $print_adj = '';
        if ($adj_amt != 0) {
            $print_adj = oeFormatMoney($adj_amt);
        }
        $print .= "<td class='detail' style='text-align: right;'>" . text($uac_appl) . "&nbsp;</td>";
        $print .= "<td class='detail' style='text-align: right;'>" . text($print_pmt) . "&nbsp;</td>";
        $print .= "<td class='detail' style='text-align: right;'>" . text($print_adj) . "&nbsp;</td>";
        $print .= "<td class='detail' style='text-align: right;'>" . text($uac_bal) . "&nbsp;</td>";
        $print .= "</tr>\n";
        echo $print;
        if ($pmt['follow_up_note'] != '') {
            $bgcolor = $bgcolor == "#FFFFDD" ? "#FFDDDD" : "#FFFFDD";
            $print = "<tr bgcolor='" . attr($bgcolor) . "'>";
            $print .= "<td class='detail' colspan='2'>&nbsp;</td>";
            $print .= "<td colspan='7'>" . xlt('Follow Up Note') . ": ";
            $print .= text($pmt['follow_up_note']);
            $print .= "</td></tr>\n";
            echo $print;
        }
        if ($unassigned) {
            $total_bal = $total_bal + $uac_bal;
        } else {
            $enc_bal = $enc_bal - $pmt_amt - $adj_amt;
            $total_bal = $total_bal - $pmt_amt - $adj_amt;
        }
        $orow++;
    }
    $bgcolor = $bgcolor == "#FFFFDD" ? "#FFDDDD" : "#FFFFDD";
}
Example #19
0
    private function getIncudes($val)
    {
        global $pid;
        if ($val == "demographics") {
            ?>
	    <hr />
	    <div class='text demographics' id='DEM'>
	    <?php 
            // printRecDataOne($patient_data_array, getRecPatientData ($pid), $N);
            $result1 = getPatientData($pid);
            $result2 = getEmployerData($pid);
            ?>
	    <table>
	    <tr><td><h6><?php 
            echo htmlspecialchars(xl('Patient Data') . ":", ENT_QUOTES);
            ?>
</h6></td></tr>
	    <?php 
            display_layout_rows('DEM', $result1, $result2);
            ?>
	    </table>
	    </div>
	    <?php 
        } elseif ($val == "history") {
            ?>
	    <hr />
	    <div class='text history' id='HIS'>
		<?php 
            $result1 = getHistoryData($pid);
            ?>
		<table>
		<tr><td><h6><?php 
            echo htmlspecialchars(xl('History Data') . ":", ENT_QUOTES);
            ?>
</h6></td></tr>
		<?php 
            display_layout_rows('HIS', $result1);
            ?>
		</table>
		</div>
	<?php 
        } elseif ($val == "insurance") {
            ?>
	    <hr />
	    <div class='text insurance'>";
	    <h6><?php 
            echo htmlspecialchars(xl('Insurance Data') . ":", ENT_QUOTES);
            ?>
</h6>
	    <br><span class=bold><?php 
            echo htmlspecialchars(xl('Primary Insurance Data') . ":", ENT_QUOTES);
            ?>
</span><br>
	    <?php 
            printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "primary"), $N);
            ?>
	    <span class=bold><?php 
            echo htmlspecialchars(xl('Secondary Insurance Data') . ":", ENT_QUOTES);
            ?>
</span><br>
	    <?php 
            printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "secondary"), $N);
            ?>
	    <span class=bold><?php 
            echo htmlspecialchars(xl('Tertiary Insurance Data') . ":", ENT_QUOTES);
            ?>
</span><br>
	    <?php 
            printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "tertiary"), $N);
            ?>
	    </div>
	    <?php 
        } elseif ($val == "billing") {
            ?>
	    <hr />
	    <div class='text billing'>
	    <h6><?php 
            echo htmlspecialchars(xl('Billing Information') . ":", ENT_QUOTES);
            ?>
</h6>
	    <?php 
            if (count($ar['newpatient']) > 0) {
                $billings = array();
                ?>
		<table>
		<tr><td width='400' class='bold'><?php 
                echo htmlspecialchars(xl('Code'), ENT_QUOTES);
                ?>
</td><td class='bold'><?php 
                echo htmlspecialchars(xl('Fee'), ENT_QUOTES);
                ?>
</td></tr>
		<?php 
                $total = 0.0;
                $copays = 0.0;
                foreach ($ar['newpatient'] as $be) {
                    $ta = split(":", $be);
                    $billing = getPatientBillingEncounter($pid, $ta[1]);
                    $billings[] = $billing;
                    foreach ($billing as $b) {
                        ?>
			<tr>
			<td class=text>
			<?php 
                        echo htmlspecialchars($b['code_type'], ENT_QUOTES) . ":\t" . htmlspecialchars($b['code'], ENT_QUOTES) . "&nbsp;" . htmlspecialchars($b['modifier'], ENT_QUOTES) . "&nbsp;&nbsp;&nbsp;" . htmlspecialchars($b['code_text'], ENT_QUOTES) . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        ?>
			</td>
			<td class=text>
			<?php 
                        echo htmlspecialchars(oeFormatMoney($b['fee']), ENT_QUOTES);
                        ?>
			</td>
			</tr>
			<?php 
                        $total += $b['fee'];
                        if ($b['code_type'] == "COPAY") {
                            $copays += $b['fee'];
                        }
                    }
                }
                echo "<tr><td>&nbsp;</td></tr>";
                echo "<tr><td class=bold>" . htmlspecialchars(xl('Sub-Total'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney($total + abs($copays)), ENT_QUOTES) . "</td></tr>";
                echo "<tr><td class=bold>" . htmlspecialchars(xl('Paid'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney(abs($copays)), ENT_QUOTES) . "</td></tr>";
                echo "<tr><td class=bold>" . htmlspecialchars(xl('Total'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney($total), ENT_QUOTES) . "</td></tr>";
                echo "</table>";
                echo "<pre>";
                //print_r($billings);
                echo "</pre>";
            } else {
                printPatientBilling($pid);
            }
            echo "</div>\n";
            // end of billing DIV
        } elseif ($val == "immunizations") {
            ?>
		<hr />
		<div class='text immunizations'>
		<h6><?php 
            echo htmlspecialchars(xl('Patient Immunization') . ":", ENT_QUOTES);
            ?>
</h6>
		<?php 
            $sql = "select i1.immunization_id as immunization_id, if(i1.administered_date,concat(i1.administered_date,' - ') ,substring(i1.note,1,20) ) as immunization_data from immunizations i1 where i1.patient_id = ? order by administered_date desc";
            $result = sqlStatement($sql, array($pid));
            while ($row = sqlFetchArray($result)) {
                echo htmlspecialchars($row['immunization_data'], ENT_QUOTES);
                echo generate_display_field(array('data_type' => '1', 'list_id' => 'immunizations'), $row['immunization_id']);
                ?>
		      <br>
		    <?php 
            }
            ?>
		</div>
		<?php 
        } elseif ($val == "batchcom") {
            ?>
	    <hr />
	    <div class='text transactions'>
	    <h6><?php 
            htmlspecialchars(xl('Patient Communication sent') . ":", ENT_QUOTES);
            ?>
</h6>
	    <?php 
            $sql = "SELECT concat( 'Messsage Type: ', batchcom.msg_type, ', Message Subject: ', batchcom.msg_subject, ', Sent on:', batchcom.msg_date_sent ) AS batchcom_data, batchcom.msg_text, concat( users.fname, users.lname ) AS user_name FROM `batchcom` JOIN `users` ON users.id = batchcom.sent_by WHERE batchcom.patient_id=?";
            $result = sqlStatement($sql, array($pid));
            while ($row = sqlFetchArray($result)) {
                echo htmlspecialchars($row['batchcom_data'] . ", " . xl('By') . ": " . $row['user_name'], ENT_QUOTES);
                ?>
		<br><?php 
                echo htmlspecialchars(xl('Text'), ENT_QUOTES);
                ?>
:<br><?php 
                echo htmlspecialchars($row['msg_txt'], ENT_QUOTES);
                ?>
<br>
		<?php 
            }
            ?>
	    </div>
	    <?php 
        } elseif ($val == "notes") {
            ?>
	    <hr />
	    <div class='text notes'>
	    <h6><?php 
            echo htmlspecialchars(xl('Patient Notes') . ":", ENT_QUOTES);
            ?>
</h6>
	    <?php 
            printPatientNotes($pid);
            ?>
	    </div>
	    <?php 
        } elseif ($val == "transactions") {
            ?>
	    <hr />
	    <div class='text transactions'>
	    <h6><?php 
            echo htmlspecialchars(xl('Patient Transactions') . ":", ENT_QUOTES);
            ?>
</h6>
	    <?php 
            printPatientTransactions($pid);
            ?>
	    </div>
	    <?php 
        }
    }
Example #20
0
		$insurancebalance = get_patient_balance($pid, true) - $patientbalance;
	   $totalbalance=$patientbalance + $insurancebalance;
 if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
 // Show current balance and billing note, if any.
  echo "<table border='0'><tr><td>" .
  "<table ><tr><td><span class='bold'><font color='red'>" .
   xlt('Patient Balance Due') .
   " : " . text(oeFormatMoney($patientbalance)) .
   "</font></span></td></tr>".
     "<tr><td><span class='bold'><font color='red'>" .
   xlt('Insurance Balance Due') .
   " : " . text(oeFormatMoney($insurancebalance)) .
   "</font></span></td></tr>".
   "<tr><td><span class='bold'><font color='red'>" .
   xlt('Total Balance Due').
   " : " . text(oeFormatMoney($totalbalance)) .
   "</font></span></td></td></tr>";
  if ($result['genericname2'] == 'Billing') {
   echo "<tr><td><span class='bold'><font color='red'>" .
    xlt('Billing Note') . ":" .
    text($result['genericval2']) .
    "</font></span></td></tr>";
  } 
  if ($result3['provider']) {   // Use provider in case there is an ins record w/ unassigned insco
   echo "<tr><td><span class='bold'>" .
    xlt('Primary Insurance') . ': ' . text($insco_name) .
    "</span>&nbsp;&nbsp;&nbsp;";
   if ($result3['copay'] > 0) {
    echo "<span class='bold'>" .
    xlt('Copay') . ': ' .  text($result3['copay']) .
     "</span>&nbsp;&nbsp;&nbsp;";
Example #21
0
     $lcount += 2;
     $rcount++;
 }
 //checks whether a copay exists for the encounter and if exists displays it.
 while ($rowMoneyGot = sqlFetchArray($resMoneyGot)) {
     $rowcnt++;
     $PatientPay = $rowMoneyGot['PatientPay'];
     $date = $rowMoneyGot['date'];
     if ($PatientPay > 0) {
         if ($rhtml) {
             $rhtml2 .= "<tr bgcolor='{$bgcolor}'>\n";
         }
         $rhtml2 .= "<td width='50'>";
         $rhtml2 .= "<span class='text'>" . xlt('COPAY') . ": </span>";
         $rhtml2 .= "</td>\n";
         $rhtml2 .= "<td><span class='text'>" . text(oeFormatMoney($PatientPay)) . "</span><span style='font-size:8pt;'>&nbsp;</span></td>\n";
         $rhtml2 .= '<td align="right"><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
         $rhtml2 .= "</span></td>\n";
         $rhtml2 .= '<td><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
         $rhtml2 .= "</span></td>\n";
         $rhtml2 .= '<td><span style="font-size:8pt;">&nbsp;&nbsp;&nbsp;';
         $rhtml2 .= "</span></td>\n";
         $rhtml2 .= '<td width=100>&nbsp;&nbsp;&nbsp;<span style="font-size:8pt;">';
         $rhtml2 .= text(oeFormatSDFT(strtotime($date)));
         $rhtml2 .= "</span></td>\n";
         if ($iter['id'] && $iter['authorized'] != 1) {
             $rhtml2 .= "<td><span class=alert>" . xlt("Note: This copay was entered against billing that has not been authorized. Please review status.") . "</span></td>\n";
         } else {
             $rhtml2 .= "<td></td>\n";
         }
         if (!$iter['id'] && $rowcnt == 1) {
            $grand_total_amt_adjustment += $row['Adjustment Amt'];
            $grand_total_amt_balance += $row['Balance Amt'];
            if ($_POST['form_csvexport']) {
                echo $csv;
            } else {
                echo $print;
            }
        }
        if (!$_POST['form_csvexport']) {
            echo "<tr bgcolor='#ffffff'>\n";
            echo " <td class='detail'>" . xlt("Grand Total") . "</td>\n";
            echo " <td class='detail'>" . text($grand_total_units) . "</td>\n";
            echo " <td class='detail'>" . text(oeFormatMoney($grand_total_amt_billed)) . "</td>\n";
            echo " <td class='detail'>" . text(oeFormatMoney($grand_total_amt_paid)) . "</td>\n";
            echo " <td class='detail'>" . text(oeFormatMoney($grand_total_amt_adjustment)) . "</td>\n";
            echo " <td class='detail'>" . text(oeFormatMoney($grand_total_amt_balance)) . "</td>\n";
            echo " </tr>\n";
            ?>
                </table>    </div>
        <?php 
        }
    }
}
if (!$_POST['form_csvexport']) {
    if ($_POST['form_refresh'] && count($print) != 1) {
        echo "<span style='font-size:10pt;'>";
        echo xlt('No matches found. Try search again.');
        echo "</span>";
        echo '<script>document.getElementById("report_results").style.display="none";</script>';
        echo '<script>document.getElementById("controls").style.display="none";</script>';
    }
                echo $b['code_type'] . ":\t" . $b['code'] . "&nbsp;" . $b['modifier'] . "&nbsp;&nbsp;&nbsp;" . $b['code_text'] . "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                echo "</td>\n";
                echo "<td class='text'>";
                echo oeFormatMoney($b['fee']);
                echo "</td>\n";
                echo "</tr>\n";
                $total += $b['fee'];
                if ($b['code_type'] == "COPAY") {
                    $copays += $b['fee'];
                }
            }
            //}
            echo "<tr><td>&nbsp;</td></tr>";
            echo "<tr><td class='bold' colspan=3 style='text-align:right'>" . xl('Sub-Total') . "</td><td class='text'>" . oeFormatMoney($total + abs($copays)) . "</td></tr>";
            echo "<tr><td class='bold' colspan=3 style='text-align:right'>" . xl('Paid') . "</td><td class='text'>" . oeFormatMoney(abs($copays)) . "</td></tr>";
            echo "<tr><td class='bold' colspan=3 style='text-align:right'>" . xl('Total') . "</td><td class='text'>" . oeFormatMoney($total) . "</td></tr>";
            echo "</table>";
            echo "<pre>";
            //print_r($billings);
            echo "</pre>";
        }
        echo "</div>";
        ++$iCounter;
        print "<br/><br/>" . xl('Physician Signature') . ":  _______________________________________________";
        print "<hr class='pagebreak' />";
    }
}
?>
</div>

    </body>
Example #24
0
if (!$thisauth) {
    echo "<p>(" . htmlspecialchars(xl('Demographics not authorized'), ENT_NOQUOTES) . ")</p>\n";
    echo "</body>\n</html>\n";
    exit;
}
if ($thisauth == 'write') {
    foreach (pic_array() as $var) {
        print $var;
    }
    echo "<td><span class='title'>" . htmlspecialchars(getPatientName($pid), ENT_NOQUOTES) . "</span>&nbsp;&nbsp;</td>";
    if (acl_check('admin', 'super')) {
        echo "<td><a class='css_button iframe' href='../deleter.php?patient=" . htmlspecialchars($pid, ENT_QUOTES) . "'>" . "<span>" . htmlspecialchars(xl('Delete'), ENT_NOQUOTES) . "</span></a></td>";
    }
    if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
        // Show current balance and billing note, if any.
        echo "<td>&nbsp;&nbsp;&nbsp;<span class='bold'><font color='#ee6600'>" . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES) . ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)), ENT_NOQUOTES) . "</font><br />";
        if ($result['genericname2'] == 'Billing') {
            htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES) . ":";
            echo "<span class='bold'><font color='red'>" . htmlspecialchars($result['genericval2'], ENT_NOQUOTES) . "</font></span>";
        }
        echo "</span></td>";
    }
}
// Get the document ID of the patient ID card if access to it is wanted here.
$document_id = 0;
if ($GLOBALS['patient_id_category_name']) {
    $tmp = sqlQuery("SELECT d.id, d.date, d.url FROM " . "documents AS d, categories_to_documents AS cd, categories AS c " . "WHERE d.foreign_id = ? " . "AND cd.document_id = d.id " . "AND c.id = cd.category_id " . "AND c.name LIKE ? " . "ORDER BY d.date DESC LIMIT 1", array($pid, $GLOBALS['patient_id_category_name']));
    if ($tmp) {
        $document_id = $tmp['id'];
    }
}
Example #25
0
function echoProdLine($lino, $drug_id, $del = FALSE, $units = NULL, $fee = NULL, $sale_id = 0, $billed = FALSE)
{
    global $code_types, $ndc_applies, $pid, $usbillstyle, $hasCharges;
    $drow = sqlQuery("SELECT name FROM drugs WHERE drug_id = ?", array($drug_id));
    $code_text = $drow['name'];
    $fee = sprintf('%01.2f', $fee);
    if (empty($units)) {
        $units = 1;
    }
    $units = max(1, intval($units));
    // We put unit price on the screen, not the total line item fee.
    $price = $fee / $units;
    $strike1 = $sale_id && $del ? "<strike>" : "";
    $strike2 = $sale_id && $del ? "</strike>" : "";
    echo " <tr>\n";
    echo "  <td class='billcell'>{$strike1}" . xlt("Product") . "{$strike2}";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][sale_id]' value='" . attr($sale_id) . "'>";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][drug_id]' value='" . attr($drug_id) . "'>";
    echo "<input type='hidden' name='prod[" . attr($lino) . "][billed]' value='" . attr($billed) . "'>";
    echo "</td>\n";
    echo "  <td class='billcell'>{$strike1}" . text($drug_id) . "{$strike2}</td>\n";
    if (modifiers_are_used(true)) {
        echo "  <td class='billcell'>&nbsp;</td>\n";
    }
    if ($billed) {
        if (fees_are_used()) {
            echo "  <td class='billcell' align='right'>" . text(oeFormatMoney($price)) . "</td>\n";
            echo "  <td class='billcell' align='center'>" . text($units) . "</td>\n";
        }
        if (justifiers_are_used()) {
            echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
            // justify
        }
        echo "  <td class='billcell' align='center'>&nbsp;</td>\n";
        // provider
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // note codes
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // auth
        echo "  <td class='billcell' align='center'><input type='checkbox'" . " disabled /></td>\n";
    } else {
        if (fees_are_used()) {
            echo "  <td class='billcell' align='right'>" . "<input type='text' name='prod[" . attr($lino) . "][price]' " . "value='" . attr($price) . "' size='6'";
            if (acl_check('acct', 'disc')) {
                echo " style='text-align:right'";
            } else {
                echo " style='text-align:right;background-color:transparent' readonly";
            }
            echo "></td>\n";
            echo "  <td class='billcell' align='center'>";
            echo "<input type='text' name='prod[" . attr($lino) . "][units]' " . "value='" . attr($units) . "' size='2' style='text-align:right'>";
            echo "</td>\n";
        }
        if (justifiers_are_used()) {
            echo "  <td class='billcell'{$usbillstyle}>&nbsp;</td>\n";
            // justify
        }
        echo "  <td class='billcell' align='center'>&nbsp;</td>\n";
        // provider
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // note codes
        echo "  <td class='billcell' align='center'{$usbillstyle}>&nbsp;</td>\n";
        // auth
        echo "  <td class='billcell' align='center'><input type='checkbox' name='prod[" . attr($lino) . "][del]' " . "value='1'" . ($del ? " checked" : "") . " /></td>\n";
    }
    echo "  <td class='billcell'>{$strike1}" . text($code_text) . "{$strike2}</td>\n";
    echo " </tr>\n";
    if ($fee != 0) {
        $hasCharges = true;
    }
}
Example #26
0
    ?>
</td><td><?php 
    xl('fee', 'e');
    ?>
</td></tr>
<?php 
    $key = "ICD9";
    $val = $billing_html[$key];
    print $val;
    $key = "CPT4";
    $val = $billing_html[$key];
    print $val;
    $key = "COPAY";
    $val = $billing_html[$key];
    print $val;
    $balance = $total - $copay;
    if ($balance != 0.0) {
        print "<tr><td>" . xl('balance') . "</td><td></td><td>" . xl('Please pay this amount') . ":</td><td>" . oeFormatMoney($balance) . "</td></tr>\n";
    }
}
?>
</tr></table>
<?php 
//if ($balance != 0.00) {
//	print "<p>Note: The balance recorded above only reflects the encounter described by this statement.  It does not reflect the balance of the entire account.  A negative number in the balance field indicates a credit due to overpayment</p>";
//}
?>

</body>
</html>
Example #27
0
         // system.  Display them in red, as they should be unusual.
         if ($accounting_enabled && !empty($arinvoice)) {
             foreach ($arinvoice as $codekey => $val) {
                 if ($binfo[0]) {
                     for ($i = 0; $i < 5; ++$i) {
                         $binfo[$i] .= '<br>';
                     }
                 }
                 for ($i = 0; $i < 5; ++$i) {
                     $binfo[$i] .= "<font color='red'>";
                 }
                 $binfo[0] .= htmlspecialchars($codekey, ENT_NOQUOTES);
                 $binfo[1] .= htmlspecialchars(oeFormatMoney($val['chg'] + $val['adj']), ENT_NOQUOTES);
                 $binfo[2] .= htmlspecialchars(oeFormatMoney($val['chg'] - $val['bal']), ENT_NOQUOTES);
                 $binfo[3] .= htmlspecialchars(oeFormatMoney($val['adj']), ENT_NOQUOTES);
                 $binfo[4] .= htmlspecialchars(oeFormatMoney($val['bal']), ENT_NOQUOTES);
                 for ($i = 0; $i < 5; ++$i) {
                     $binfo[$i] .= "</font>";
                 }
             }
         }
     }
     // end if there is billing
     echo "<td class='text'>" . $binfo[0] . "</td>\n";
     for ($i = 1; $i < 5; ++$i) {
         echo "<td class='text right'>" . $binfo[$i] . "</td>\n";
     }
 } else {
     echo "<td class='text' valign='top' colspan='5' rowspan='{$encounter_rows}'>(" . htmlspecialchars(xl("No access"), ENT_NOQUOTES) . ")</td>\n";
 }
 // show insurance
Example #28
0
$linkMethod = "javascript";
$bodyClass = "notab";
$widgetAuth = false;
$fixedWidth = true;
if ($GLOBALS['force_billing_widget_open']) {
    $forceExpandAlways = true;
} else {
    $forceExpandAlways = false;
}
expand_collapse_widget($widgetTitle, $widgetLabel, $widgetButtonLabel, $widgetButtonLink, $widgetButtonClass, $linkMethod, $bodyClass, $widgetAuth, $fixedWidth, $forceExpandAlways);
?>
<br>
<?php 
if ($GLOBALS['oer_config']['ws_accounting']['enabled']) {
    // Show current balance and billing note, if any.
    echo "<div style='margin-left: 10px; margin-right: 10px'>" . "<span class='bold'><font color='#ee6600'>" . htmlspecialchars(xl('Balance Due'), ENT_NOQUOTES) . ": " . htmlspecialchars(oeFormatMoney(get_patient_balance($pid)), ENT_NOQUOTES) . "</font></span><br>";
    if ($result['genericname2'] == 'Billing') {
        echo "<span class='bold'><font color='red'>" . htmlspecialchars(xl('Billing Note'), ENT_NOQUOTES) . ":" . htmlspecialchars($result['genericval2'], ENT_NOQUOTES) . "</font></span><br>";
    }
    if ($result3['provider']) {
        // Use provider in case there is an ins record w/ unassigned insco
        echo "<span class='bold'>" . htmlspecialchars(xl('Primary Insurance'), ENT_NOQUOTES) . ': ' . htmlspecialchars($insco_name, ENT_NOQUOTES) . "</span>&nbsp;&nbsp;&nbsp;";
        if ($result3['copay'] > 0) {
            echo "<span class='bold'>" . htmlspecialchars(xl('Copay'), ENT_NOQUOTES) . ': ' . htmlspecialchars($result3['copay'], ENT_NOQUOTES) . "</span>&nbsp;&nbsp;&nbsp;";
        }
        echo "<span class='bold'>" . htmlspecialchars(xl('Effective Date'), ENT_NOQUOTES) . ': ' . htmlspecialchars(oeFormatShortDate($result3['effdate'], ENT_NOQUOTES)) . "</span>";
    }
    echo "</div><br>";
}
?>
                                </div>
function bucks($amount)
{
    if ($amount) {
        echo oeFormatMoney($amount);
    }
}
Example #30
0
         // system.  Display them in red, as they should be unusual.
         if ($accounting_enabled && !empty($arinvoice)) {
             foreach ($arinvoice as $codekey => $val) {
                 if ($binfo[0]) {
                     for ($i = 0; $i < 5; ++$i) {
                         $binfo[$i] .= '<br>';
                     }
                 }
                 for ($i = 0; $i < 5; ++$i) {
                     $binfo[$i] .= "<font color='red'>";
                 }
                 $binfo[0] .= $codekey;
                 $binfo[1] .= oeFormatMoney($val['chg'] + $val['adj']);
                 $binfo[2] .= oeFormatMoney($val['chg'] - $val['bal']);
                 $binfo[3] .= oeFormatMoney($val['adj']);
                 $binfo[4] .= oeFormatMoney($val['bal']);
                 for ($i = 0; $i < 5; ++$i) {
                     $binfo[$i] .= "</font>";
                 }
             }
         }
     }
     // end if there is billing
     echo "<td class='text'>" . $binfo[0] . "</td>\n";
     for ($i = 1; $i < 5; ++$i) {
         echo "<td class='text right'>" . $binfo[$i] . "</td>\n";
     }
 } else {
     echo "<td class='text' valign='top' colspan='5' rowspan='{$encounter_rows}'>(No access)</td>\n";
 }
 // show insurance