More session fixes
[openemr.git] / interface / main / authorizations / authorizations_full.php
blobf80e25a4526100caa570431b3015d24b55eedba5
1 <?php
2 /**
3 * Authorizations full script.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Brady Miller <brady@sparmy.com>
18 * @link http://www.open-emr.org
21 //SANITIZE ALL ESCAPES
22 $sanitize_all_escapes=true;
25 //STOP FAKE REGISTER GLOBALS
26 $fake_register_globals=false;
29 include_once("../../globals.php");
30 include_once("$srcdir/patient.inc");
32 if (isset($_GET["mode"]) && $_GET["mode"] == "authorize") {
33 newEvent("authorize",$_SESSION["authUser"],$_SESSION["authProvider"],1,$_GET["pid"]);
34 sqlStatement("update billing set authorized=1 where pid=?", array($_GET["pid"]) );
35 sqlStatement("update forms set authorized=1 where pid=?", array($_GET["pid"]) );
36 sqlStatement("update pnotes set authorized=1 where pid=?", array($_GET["pid"]) );
37 sqlStatement("update transactions set authorized=1 where pid=?", array($_GET["pid"]) );
41 <html>
42 <head>
43 <?php html_header_show();?>
44 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
45 </head>
46 <body class="body_top">
48 <?php if ($GLOBALS['concurrent_layout']) { ?>
49 <a href="authorizations.php" onclick='top.restoreSession()'>
50 <?php } else { ?>
51 <a href="../main.php" target=Main>
52 <?php } ?>
53 <font class=title><?php echo htmlspecialchars(xl('Authorizations'),ENT_NOQUOTES); ?></font>
54 <font class=more><?php echo htmlspecialchars($tback,ENT_NOQUOTES); ?></font></a>
56 <?php
57 // billing
58 // forms
59 // pnotes
60 // transactions
62 //fetch billing information:
63 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 groupname=?", array ($groupname) )) {
64 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
65 $result[$iter] = $row;
67 if ($result) {
68 foreach ($result as $iter) {
70 $authorize{$iter{"pid"}}{"billing"} .= "<span class=small>" .
71 htmlspecialchars($iter{"user"},ENT_NOQUOTES) . ": </span><span class=text>" .
72 htmlspecialchars($iter{"code_text"} . " " . date("n/j/Y",strtotime($iter{"date"})),ENT_NOQUOTES) .
73 "</span><br>\n";
80 //fetch transaction information:
81 if ($res = sqlStatement("select * from transactions where authorized=0 and groupname=?", array($groupname) )) {
82 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
83 $result2[$iter] = $row;
85 if ($result2) {
86 foreach ($result2 as $iter) {
88 $authorize{$iter{"pid"}}{"transaction"} .= "<span class=small>" .
89 htmlspecialchars($iter{"user"},ENT_NOQUOTES) . ": </span><span class=text>" .
90 htmlspecialchars($iter{"title"} . ": " . strterm($iter{"body"},25) . " " . date("n/j/Y",strtotime($iter{"date"})),ENT_NOQUOTES) .
91 "</span><br>\n";
98 if (empty($GLOBALS['ignore_pnotes_authorization'])) {
99 //fetch pnotes information, exclude ALL deleted notes
100 if ($res = sqlStatement("select * from pnotes where authorized=0 and deleted!=1 and groupname=?", array($groupname) )) {
101 for ($iter = 0;$row = sqlFetchArray($res);$iter++) $result3[$iter] = $row;
102 if ($result3) {
103 foreach ($result3 as $iter) {
104 $authorize{$iter{"pid"}}{"pnotes"} .= "<span class=small>" .
105 htmlspecialchars($iter{"user"},ENT_NOQUOTES) . ": </span><span class=text>" .
106 htmlspecialchars(strterm($iter{"body"},25) . " " . date("n/j/Y",strtotime($iter{"date"})),ENT_NOQUOTES) .
107 "</span><br>\n";
113 //fetch forms information:
114 if ($res = sqlStatement("select * from forms where authorized=0 and groupname=?", array($groupname) )) {
115 for ($iter = 0;$row = sqlFetchArray($res);$iter++)
116 $result4[$iter] = $row;
118 if ($result4) {
119 foreach ($result4 as $iter) {
121 $authorize{$iter{"pid"}}{"forms"} .= "<span class=small>" .
122 htmlspecialchars($iter{"user"},ENT_NOQUOTES) . ": </span><span class=text>" .
123 htmlspecialchars($iter{"form_name"} . " " . date("n/j/Y",strtotime($iter{"date"})),ENT_NOQUOTES) .
124 "</span><br>\n";
132 <table border=0 cellpadding=0 cellspacing=2 width=100%>
133 <tr>
134 <td valign=top>
136 <?php
137 if ($authorize) {
139 while(list($ppid,$patient) = each($authorize)){
141 $name = getPatientData($ppid);
143 echo "<tr><td valign=top><span class=bold>". htmlspecialchars($name{"fname"} . " " . $name{"lname"},ENT_NOQUOTES) .
144 "</span><br><a class=link_submit href='authorizations_full.php?mode=authorize&pid=" .
145 htmlspecialchars($ppid,ENT_QUOTES) . "' onclick='top.restoreSession()'>" . htmlspecialchars(xl('Authorize'),ENT_NOQUOTES) . "</a></td>\n";
146 echo "<td valign=top><span class=bold>".htmlspecialchars(xl('Billing'),ENT_NOQUOTES).
147 ":</span><span class=text><br>" . $patient{"billing"} . "</td>\n";
148 echo "<td valign=top><span class=bold>".htmlspecialchars(xl('Transactions'),ENT_NOQUOTES).
149 ":</span><span class=text><br>" . $patient{"transaction"} . "</td>\n";
150 echo "<td valign=top><span class=bold>".htmlspecialchars(xl('Patient Notes'),ENT_NOQUOTES).
151 ":</span><span class=text><br>" . $patient{"pnotes"} . "</td>\n";
152 echo "<td valign=top><span class=bold>".htmlspecialchars(xl('Encounter Forms'),ENT_NOQUOTES).
153 ":</span><span class=text><br>" . $patient{"forms"} . "</td>\n";
154 echo "</tr>\n";
155 $count++;
160 </td>
162 </tr>
163 </table>
165 </body>
166 </html>