CCR/CCD reporting module: added option to see the raw xml
[openemr.git] / interface / patient_file / encounter / superbill_codes.php
blob430ac5e2a7fc459afbcc3f35b07ff52f58ce1cf5
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");
7 //the number of rows to display before resetting and starting a new column:
8 $N=10;
10 $mode = $_GET['mode'];
11 $type = $_GET['type'];
12 $modifier = $_GET['modifier'];
13 $units = $_GET['units'];
14 $fee = $_GET['fee'];
15 $code = $_GET['code'];
16 $text = $_GET['text'];
18 if (!get_magic_quotes_gpc()) $text = addslashes($text);
20 if (isset($mode)) {
21 if ($mode == "add") {
22 if (strtolower($type) == "copay") {
23 addBilling($encounter, $type, sprintf("%01.2f", $code), $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", 0 - $code));
25 elseif (strtolower($type) == "other") {
26 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", $fee));
28 else {
29 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
34 <html>
35 <head>
36 <?php html_header_show();?>
37 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
38 </head>
39 <body class="body_bottom">
41 <table border=0 cellspacing=0 cellpadding=0 >
42 <tr>
43 <td valign=top>
45 <dl>
47 <dt>
49 <a href="superbill_custom_full.php" onclick="top.restoreSession()">
50 <span class=title><?php xl('Superbill','e'); ?></span>
51 <font class=more><?php echo $tmore;?></font></a>
53 <?php if ($GLOBALS['concurrent_layout']) { ?>
54 <a href="encounter_bottom.php" onclick="top.restoreSession()">
55 <?php } else { ?>
56 <a href="patient_encounter.php?codefrom=superbill" onclick="top.restoreSession()">
57 <?php } ?>
59 <font class=more><?php echo $tback;?></font></a>
61 </dt>
62 </td></tr>
63 </table>
65 <table border=0 width=100% cellpadding=0 cellspacing=1>
66 <?php
67 $res = sqlStatement("select * from codes where superbill = 1 order by code_type, code, code_text");
69 $codes = array();
70 echo " <tr>\n";
71 foreach ($code_types as $key => $value) {
72 $codes[$key] = array();
73 echo " <th align='left'>$key Codes</th>\n";
75 echo " </tr>\n";
77 for ($iter = 0; $row = sqlFetchArray($res); $iter++){
78 foreach ($code_types as $key => $value) {
79 if ($value['id'] == $row['code_type']) {
80 $codes[$key][] = $row;
81 break;
86 $index=0;
88 $numlines = 0;
89 foreach ($codes as $value)
90 $numlines = max($numlines, count($value));
92 while ($index < $numlines) {
93 echo " <tr>\n";
94 foreach ($codes as $key => $value) {
95 echo " <td valign='top'>\n";
96 if(!empty($value[$index])) {
97 $code = $value[$index];
98 echo " <dd><a class='text' ";
99 if (!$GLOBALS['concurrent_layout']) echo "target='Main' ";
100 echo "href='superbill_codes.php?back=1&mode=add" .
101 "&type=" . urlencode($key) .
102 "&modifier=" . urlencode($code{"modifier"}) .
103 "&units=" . urlencode($code{"units"}) .
104 "&fee=" . urlencode($code{"fee"}) .
105 "&code=" . urlencode($code{"code"}) .
106 "&text=" . urlencode($code{"code_text"}) .
107 "' onclick='top.restoreSession()'>";
108 echo "<b>" . $code['code'] . "</b>" . "&nbsp;" . $code['modifier'] . "&nbsp;" . $code['code_text'] ;
109 echo "</a></dd>\n";
111 echo " </td>\n";
113 echo " </tr>\n";
114 ++$index;
119 </table>
121 </dl>
123 </body>
124 </html>