fixes for prior commit - moved Documents menu item to Procedures->Lab documents
[openemr.git] / interface / patient_file / encounter / superbill_codes.php
blob49d2be562c050a22dae22ed5fc34601963e2a523
1 <?php
2 include_once("../../globals.php");
3 include_once("../../../custom/code_types.inc.php");
4 include_once("$srcdir/billing.inc");
5 include_once("$srcdir/sql.inc");
6 require_once("$srcdir/formdata.inc.php");
8 //the number of rows to display before resetting and starting a new column:
9 $N=10;
11 $mode = $_GET['mode'];
12 $type = $_GET['type'];
13 $modifier = $_GET['modifier'];
14 $units = $_GET['units'];
15 $fee = $_GET['fee'];
16 $code = $_GET['code'];
17 $text = $_GET['text'];
19 if (isset($mode)) {
20 if ($mode == "add") {
21 if (strtolower($type) == "copay") {
22 addBilling($encounter, $type, sprintf("%01.2f", $code), strip_escape_custom($text), $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", 0 - $code));
24 elseif (strtolower($type) == "other") {
25 addBilling($encounter, $type, $code, strip_escape_custom($text), $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", $fee));
27 else {
28 addBilling($encounter, $type, $code, strip_escape_custom($text), $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
33 <html>
34 <head>
35 <?php html_header_show();?>
36 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
37 </head>
38 <body class="body_bottom">
40 <table border=0 cellspacing=0 cellpadding=0 >
41 <tr>
42 <td valign=top>
44 <dl>
46 <dt>
48 <a href="superbill_custom_full.php" onclick="top.restoreSession()">
49 <span class=title><?php xl('Superbill','e'); ?></span>
50 <font class=more><?php echo $tmore;?></font></a>
52 <?php if ($GLOBALS['concurrent_layout']) { ?>
53 <a href="encounter_bottom.php" onclick="top.restoreSession()">
54 <?php } else { ?>
55 <a href="patient_encounter.php?codefrom=superbill" onclick="top.restoreSession()">
56 <?php } ?>
58 <font class=more><?php echo $tback;?></font></a>
60 </dt>
61 </td></tr>
62 </table>
64 <table border=0 width=100% cellpadding=0 cellspacing=1>
65 <?php
66 $res = sqlStatement("select * from codes where superbill = 1 order by code_type, code, code_text");
68 $codes = array();
69 echo " <tr>\n";
70 foreach ($code_types as $key => $value) {
71 $codes[$key] = array();
72 echo " <th align='left'>$key Codes</th>\n";
74 echo " </tr>\n";
76 for ($iter = 0; $row = sqlFetchArray($res); $iter++){
77 foreach ($code_types as $key => $value) {
78 if ($value['id'] == $row['code_type']) {
79 $codes[$key][] = $row;
80 break;
85 $index=0;
87 $numlines = 0;
88 foreach ($codes as $value)
89 $numlines = max($numlines, count($value));
91 while ($index < $numlines) {
92 echo " <tr>\n";
93 foreach ($codes as $key => $value) {
94 echo " <td valign='top'>\n";
95 if(!empty($value[$index])) {
96 $code = $value[$index];
97 echo " <dd><a class='text' ";
98 if (!$GLOBALS['concurrent_layout']) echo "target='Main' ";
99 echo "href='superbill_codes.php?back=1&mode=add" .
100 "&type=" . urlencode($key) .
101 "&modifier=" . urlencode($code{"modifier"}) .
102 "&units=" . urlencode($code{"units"}) .
103 "&fee=" . urlencode($code{"fee"}) .
104 "&code=" . urlencode($code{"code"}) .
105 "&text=" . urlencode($code{"code_text"}) .
106 "' onclick='top.restoreSession()'>";
107 echo "<b>" . $code['code'] . "</b>" . "&nbsp;" . $code['modifier'] . "&nbsp;" . $code['code_text'] ;
108 echo "</a></dd>\n";
110 echo " </td>\n";
112 echo " </tr>\n";
113 ++$index;
118 </table>
120 </dl>
122 </body>
123 </html>