2 include_once("../../globals.php");
3 include_once("$srcdir/billing.inc");
4 include_once("$srcdir/sql.inc");
5 include_once("$srcdir/acl.inc");
9 if (strtolower($type) == "copay") {
10 addBilling($encounter, $type, sprintf("%01.2f", $code), $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", 0 - $code));
12 elseif (strtolower($type) == "other") {
13 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,sprintf("%01.2f", $fee));
16 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
19 elseif ($mode == "justify") {
20 $diags = $_POST['code']['diag'];
21 $procs = $_POST['code']['proc'];
23 if (!empty($procs) && !empty($diags)) {
25 foreach ($procs as $proc) {
27 foreach ($diags as $diag) {
28 $justify_string .= $diag . ":";
30 $sql[] = "UPDATE billing set justify = concat(justify,'" . mysql_real_escape_string($justify_string) ."') where encounter = '" . mysql_real_escape_string($_POST['encounter_id']) . "' and pid = '" . mysql_real_escape_string($_POST['patient_id']) . "' and code = '" . mysql_real_escape_string($proc) . "'";
35 foreach ($sql as $q) {
45 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
48 <body
<?
echo $bottom_bg_line;?
> topmargin
=0 rightmargin
=0 leftmargin
=4 bottommargin
=0 marginheight
=0>
51 $thisauth = acl_check('encounters', 'coding_a');
53 $erow = sqlQuery("SELECT user FROM forms WHERE " .
54 "encounter = '$encounter' AND formdir = 'newpatient' LIMIT 1");
55 if ($erow['user'] == $_SESSION['authUser'])
56 $thisauth = acl_check('encounters', 'coding');
59 echo "<p>(Coding not authorized)</p>\n";
60 echo "</body>\n</html>\n";
65 <form name
="diagnosis" method
="post" action
="diagnosis.php?mode=justify">
67 <table border
=0 cellspacing
=0 cellpadding
=0 height
=100%
>
69 <td background
="<?echo $linepic;?>" width
=7 height
=100%
>
75 <dt
><a href
="diagnosis_full.php" target
="Main"><span
class=title
><?
echo ($GLOBALS['phone_country_code'] == '1') ?
'Billing' : 'Coding' ?
></span
><font
class=more
><?
echo $tmore;?
></font
></a
>
77 if( !empty( $_GET["back"] ) ||
!empty( $_POST["back"] ) ){
78 print " <a href=\"superbill_codes.php\" target=\"Main\"><font class=more>$tback</font></a>";
79 print "<input type=\"hidden\" name=\"back\" value=\"1\">";
82  
; 
; 
; 
; 
; 
; 
; 
; 
; 
;<input type
="submit" name
="justify" value
="Justify"></dt
>
87 if ($result = getBillingByEncounter($pid,$encounter,"*") ) {
88 $billing_html = array();
89 foreach ($result as $iter) {
90 if ($iter["code_type"] == "ICD9") {
93 $html .= "<td valign=\"middle\">" . '<input style="width: 11px;height: 11px;" name="code[diag]['. $iter["code"]. ']" type="checkbox" value="' .$iter[code
] . '">' . "</td><td><div><a target=Main class=small href='diagnosis_full.php'><b>".$iter{"code"}."</b> " . ucwords(strtolower($iter{"code_text"})) . "</a></div></td></tr>\n";
94 $billing_html[$iter["code_type"]] .= $html;
97 elseif ($iter["code_type"] == "COPAY") {
98 $billing_html[$iter["code_type"]] .= "<tr><td></td><td><a target=Main class=small href='diagnosis_full.php'><b>".$iter{"code"}."</b> " . ucwords(strtolower($iter{"code_text"})) . "</a></td></tr>\n";
101 $billing_html[$iter["code_type"]] .= "<tr><td>" . '<input style="width: 11px;height: 11px;" name="code[proc]['. $iter["code"]. ']" type="checkbox" value="'. $iter[code
] .'">' . "</td><td><a target=Main class=small href='diagnosis_full.php'><b>".$iter{"code"}. ' ' . $iter['modifier'] . "</b> " . ucwords(strtolower($iter{"code_text"})) . "</a><span class=\"small\">";
102 $js = split(":",$iter['justify']);
104 foreach ($js as $j) {
107 $billing_html[$iter["code_type"]] .= " (<b>$j</b>)";
110 $billing_html[$iter["code_type"]] .= " ($j)";
117 $billing_html[$iter["code_type"]] .= "</span></td></tr>\n";
122 foreach ($billing_html as $key => $val) {
123 print "<tr><td>$key</td><td><table>$val</table><td></tr><tr><td height=\"5\"></td></tr>\n";
136 <input type
="hidden" name
="encounter_id" value
="<?=$encounter?>">
137 <input type
="hidden" name
="patient_id" value
="<?=$pid?>">