workaround for ie formatting bug
[openemr.git] / interface / main / authorizations / authorizations.php
blob6ee30af9a3123d6e905eede4ac2eeae553eb1b31
1 <?
2 include_once("../../globals.php");
3 include_once("$srcdir/log.inc");
4 include_once("$srcdir/billing.inc");
5 include_once("$srcdir/forms.inc");
6 include_once("$srcdir/pnotes.inc");
7 include_once("$srcdir/transactions.inc");
8 include_once("$srcdir/lists.inc");
9 include_once("$srcdir/patient.inc");
11 //the number of authorizations to display in the quick view:
12 // MAR 20041008 the full authorizations screen sucks... no links to the patient charts
13 // increase to a high number to make the mini frame more useful.
14 $N = 50;
16 if (isset($_GET["mode"]) && $_GET["mode"] == "authorize") {
17 $retVal = getProviderId($_SESSION['authUser']);
18 newEvent("view",$_SESSION["authUser"],$_SESSION["authProvider"],$_GET["pid"]);
19 sqlStatement("update billing set authorized=1, provider_id = '".mysql_real_escape_string($retVal[0]['id']).
20 "' where pid='".$_GET["pid"]."'");
21 sqlStatement("update forms set authorized=1 where pid='".$_GET["pid"]."'");
22 sqlStatement("update pnotes set authorized=1 where pid='".$_GET["pid"]."'");
23 sqlStatement("update transactions set authorized=1 where pid='".$_GET["pid"]."'");
27 <html>
28 <head>
31 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
33 </head>
34 <body <?echo $bottom_bg_line;?> topmargin='0' rightmargin='0' leftmargin='2' bottommargin='0'
35 marginwidth='2' marginheight='0'>
37 <a href="authorizations_full.php" target=Main><font class=title>Authorizations</font><font class=more><?echo $tmore;?>(<a class="more" style="font-size:8pt;" href="../calendar/find_patient.php?no_nav=1&mode=reset" name="Find Patients">Find Patient</a>)</font></a>
40 // provider
41 // billing
42 // forms
43 // pnotes
44 // transactions
47 //fetch billing information:
48 if ($res = sqlStatement("select *, concat(u.fname,' ', u.lname) as user from billing LEFT JOIN users as u on billing.user = u.id where billing.authorized = 0 and billing.activity = 1 and groupname='$groupname'")) {
49 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
50 $result[$iter] = $row;
52 if ($result) {
53 foreach ($result as $iter) {
55 $authorize{$iter{"pid"}}{"billing"} .= "<span class=text>" . $iter{"code_text"} . " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
58 //$authorize[$iter{"pid"}]{"billing"} = substr($authorize[$iter{"pid"}]{"billing"},0,strlen($authorize[$iter{"pid"}]{"billing"}));
63 //fetch transaction information:
64 if ($res = sqlStatement("select * from transactions where authorized=0 and groupname='$groupname'")) {
65 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
66 $result2[$iter] = $row;
68 if ($result2) {
69 foreach ($result2 as $iter) {
71 $authorize{$iter{"pid"}}{"transaction"} .= "<span class=text>" . $iter{"title"} . ": " . stripslashes(strterm($iter{"body"},25)) . " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
75 //$authorize[$iter{"pid"}]{"transaction"} = substr($authorize[$iter{"pid"}]{"transaction"},0,strlen($authorize[$iter{"pid"}]{"transaction"}));
80 //fetch pnotes information:
81 if ($res = sqlStatement("select * from pnotes where authorized=0 and groupname='$groupname'")) {
82 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
83 $result3[$iter] = $row;
85 if ($result3) {
86 foreach ($result3 as $iter) {
88 $authorize{$iter{"pid"}}{"pnotes"} .= "<span class=text>" . stripslashes(strterm($iter{"body"},25)) . " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
92 //$authorize[$iter{"pid"}]{"pnotes"} = substr($authorize[$iter{"pid"}]{"pnotes"},0,strlen($authorize[$iter{"pid"}]{"pnotes"}));
97 //fetch forms information:
98 if ($res = sqlStatement("select * from forms where authorized=0 and groupname='$groupname'")) {
99 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
100 $result4[$iter] = $row;
102 if ($result4) {
103 foreach ($result4 as $iter) {
105 $authorize{$iter{"pid"}}{"forms"} .= "<span class=text>" . $iter{"form_name"} . " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
109 //$authorize[$iter{"pid"}]{"forms"} = substr($authorize[$iter{"pid"}]{"forms"},0,strlen($authorize[$iter{"pid"}]{"forms"}));
115 <table border=0 cellpadding=0 cellspacing=2 width=100%>
116 <tr>
117 <td valign=top>
120 if ($authorize) {
122 $count = 0;
124 while(list($ppid,$patient) = each($authorize)){
125 if ($count >= $N) {
126 print "<tr><td colspan=5 align=center><a target=Main href='authorizations_full.php?active=1' class=alert>Some authorizations were not displayed. Click here to view all</a></td></tr>\n";
127 break;
129 $name = getPatientData($ppid);
131 echo "<tr><td valign=top>
132 <a href='$rootdir/patient_file/patient_file.php?set_pid=$ppid' target=_top><span class=bold>". $name{"fname"} . " " . $name{"lname"} ."</span></a><br><a class=link_submit href='authorizations.php?mode=authorize&pid=$ppid'>Authorize</a></td>\n";
133 //Michael A Rowley MD 20041012.
134 // added below 4 lines to add provider to authorizations for ez reference.
135 $providerID=sqlFetchArray(sqlStatement("select providerID from patient_data where pid=$ppid"));
136 $userID=$providerID{"providerID"};
137 $providerName=sqlFetchArray(sqlStatement("select lname from users where id=$userID"));
138 echo "<td valign=top><span class=bold>Provider:</span><span class=text><br>" . $providerName{"lname"} . "</td>\n";
139 // ha ha, see if that works....mar.
140 echo "<td valign=top><span class=bold>Billing:</span><span class=text><br>" . $patient{"billing"} . "</td>\n";
142 echo "<td valign=top><span class=bold>Transactions:</span><span class=text><br>" . $patient{"transaction"} . "</td>\n";
144 echo "<td valign=top><span class=bold>Patient Notes:</span><span class=text><br>" . $patient{"pnotes"} . "</td>\n";
146 echo "<td valign=top><span class=bold>Encounter Forms:</span><span class=text><br>" . $patient{"forms"} . "</td>\n";
147 echo "</tr>\n";
148 $count++;
153 </td>
155 </tr>
156 </table>
158 </body>
159 </html>