implemented customization of billing code types
[openemr.git] / interface / patient_file / encounter / superbill_codes.php
blobf64713232a3a342046e3c724e1ce0a2666e5807f
1 <?
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;
9 $mode = $_GET['mode'];
10 if (isset($mode)) {
11 if ($mode == "add") {
12 if (strtolower($type) == "copay") {
13 addBilling($encounter, $type, sprintf("%01.2f", $code), $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", 0 - $code));
15 elseif (strtolower($type) == "other") {
16 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", $fee));
18 else {
19 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
24 <html>
25 <head>
26 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
27 </head>
28 <body <?echo $bottom_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
30 <table border=0 cellspacing=0 cellpadding=0 >
31 <tr>
32 <td valign=top>
34 <dl>
36 <dt><a href="superbill_custom_full.php" ><span class=title>Superbill</span><font class=more><?echo $tmore;?></font></a>
37 <a href="patient_encounter.php?codefrom=superbill" ><font class=more><?echo $tback;?></font></a></dt>
38 </td></tr>
39 </table>
41 <table border=0 width=100% cellpadding=0 cellspacing=1>
43 $res = sqlStatement("select * from codes where superbill = 1 order by code_type, code, code_text");
45 $codes = array();
46 echo " <tr>\n";
47 foreach ($code_types as $key => $value) {
48 $codes[$key] = array();
49 echo " <th align='left'>$key Codes</th>\n";
51 echo " </tr>\n";
53 for ($iter = 0; $row = sqlFetchArray($res); $iter++){
54 foreach ($code_types as $key => $value) {
55 if ($value['id'] == $row['code_type']) {
56 $codes[$key][] = $row;
57 break;
62 $index=0;
64 $numlines = 0;
65 foreach ($codes as $value)
66 $numlines = max($numlines, count($value));
68 while ($index < $numlines) {
69 echo " <tr>\n";
70 foreach ($codes as $key => $value) {
71 echo " <td valign='top'>\n";
72 if(!empty($value[$index])) {
73 $code = $value[$index];
74 echo " <dd><a class='text' target='Main' href='superbill_codes.php?back=1&mode=add" .
75 "&type=" . urlencode($key) .
76 "&modifier=" . urlencode($code{"modifier"}) .
77 "&units=" . urlencode($code{"units"}) .
78 "&fee=" . urlencode($code{"fee"}) .
79 "&code=" . urlencode($code{"code"}) .
80 "&text=" . urlencode($code{"code_text"}) . "'>";
81 echo "<b>" . $code['code'] . "</b>" . "&nbsp;" . $code['modifier'] . "&nbsp;" . $code['code_text'] ;
82 echo "</a></dd>\n";
84 echo " </td>\n";
86 echo " </tr>\n";
87 ++$index;
92 </table>
94 </dl>
96 </body>
97 </html>