2 include_once("../../globals.php");
3 include_once("$srcdir/billing.inc");
4 include_once("$srcdir/sql.inc");
5 include_once("$srcdir/acl.inc");
7 if ($payment_method == "insurance") {
8 $payment_method = "insurance: ".$insurance_company;
12 if (strtolower($type) == "copay") {
13 addBilling($encounter, $type, sprintf("%01.2f", $code), $payment_method, $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));
19 addBilling($encounter, $type, $code, $text, $pid, $userauthorized,$_SESSION['authUserID'],$modifier,$units,$fee);
22 elseif ($mode == "justify") {
23 $diags = $_POST['code']['diag'];
24 $procs = $_POST['code']['proc'];
26 if (!empty($procs) && !empty($diags)) {
28 foreach ($procs as $proc) {
30 foreach ($diags as $diag) {
31 $justify_string .= $diag . ":";
33 $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) . "'";
38 foreach ($sql as $q) {
48 <link rel
=stylesheet href
="<?echo $css_header;?>" type
="text/css">
51 <body
<?
echo $bottom_bg_line;?
> topmargin
=0 rightmargin
=0 leftmargin
=4 bottommargin
=0 marginheight
=0>
54 $thisauth = acl_check('encounters', 'coding_a');
56 $erow = sqlQuery("SELECT user FROM forms WHERE " .
57 "encounter = '$encounter' AND formdir = 'newpatient' LIMIT 1");
58 if ($erow['user'] == $_SESSION['authUser'])
59 $thisauth = acl_check('encounters', 'coding');
62 $tmp = getPatientData($pid, "squad");
63 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
67 echo "<p>(".xl('Coding not authorized').")</p>\n";
68 echo "</body>\n</html>\n";
73 <form name
="diagnosis" method
="post" action
="diagnosis.php?mode=justify">
75 <table border
=0 cellspacing
=0 cellpadding
=0 height
=100%
>
79 <td background
="<?echo $linepic;?>" width
=7 height
=100%
>
87 <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
>
89 if( !empty( $_GET["back"] ) ||
!empty( $_POST["back"] ) ){
90 print " <a href=\"superbill_codes.php\" target=\"Main\"><font class=more>$tback</font></a>";
91 print "<input type=\"hidden\" name=\"back\" value=\"1\">";
94 <?php
if (!$GLOBALS['weight_loss_clinic']) { ?
>
95  
; 
; 
; 
; 
; 
; 
; 
; 
; 
;<input type
="submit" name
="justify" value
="Justify">
100 <a href
="cash_receipt.php?" class='link_submit' target
='new'>
101 [<?
xl('Receipt','e'); ?
>]
105 if ($result = getBillingByEncounter($pid,$encounter,"*") ) {
106 $billing_html = array();
108 foreach ($result as $iter) {
109 if ($iter["code_type"] == "ICD9") {
112 $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";
113 $billing_html[$iter["code_type"]] .= $html;
116 elseif ($iter["code_type"] == "COPAY") {
117 $billing_html[$iter["code_type"]]
118 .= "<tr><td></td><td><a target=Main class=small href='diagnosis_full.php'><b>"
119 .$iter{"code"}."</b> "
120 .ucwords(strtolower($iter{"code_text"}))
121 .' payment entered on '
122 .$iter{"date"}."</a></td></tr>\n";
125 $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"})) . ' ' . $iter['fee'] . "</a><span class=\"small\">";
126 $total +
= $iter['fee'];
127 $js = split(":",$iter['justify']);
129 foreach ($js as $j) {
132 $billing_html[$iter["code_type"]] .= " (<b>$j</b>)";
135 $billing_html[$iter["code_type"]] .= " ($j)";
142 $billing_html[$iter["code_type"]] .= "</span></td></tr>\n";
147 $billing_html["CPT4"] .= "<tr><td>total:</td><td>" . sprintf("%01.2f",$total) . "</td></tr>\n";
148 foreach ($billing_html as $key => $val) {
149 print "<tr><td>$key</td><td><table>$val</table><td></tr><tr><td height=\"5\"></td></tr>\n";
156 <input type
="hidden" name
="encounter_id" value
="<?=$encounter?>">
157 <input type
="hidden" name
="patient_id" value
="<?=$pid?>">