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.
16 $imauthorized = $_SESSION['userauthorized'];
18 $atemp = sqlQuery("SELECT see_auth FROM users WHERE username = '" .
19 $_SESSION['authUser'] . "'");
20 $see_auth = $atemp['see_auth'];
22 // This authorizes everything for the specified patient.
23 if (isset($_GET["mode"]) && $_GET["mode"] == "authorize" && $imauthorized) {
24 $retVal = getProviderId($_SESSION['authUser']);
25 newEvent("view", $_SESSION["authUser"], $_SESSION["authProvider"], $_GET["pid"]);
26 sqlStatement("update billing set authorized=1, provider_id = '" .
27 mysql_real_escape_string($retVal[0]['id']) .
28 "' where pid='" . $_GET["pid"] . "'");
29 sqlStatement("update forms set authorized=1 where pid='" . $_GET["pid"] . "'");
30 sqlStatement("update pnotes set authorized=1 where pid='" . $_GET["pid"] . "'");
31 sqlStatement("update transactions set authorized=1 where pid='" . $_GET["pid"] . "'");
36 <link rel
='stylesheet' href
="<?echo $css_header;?>" type
="text/css">
39 <body
<?
echo $bottom_bg_line;?
> topmargin
='0' rightmargin
='0' leftmargin
='2' bottommargin
='0'
40 marginwidth
='2' marginheight
='0'>
43 $_GET['show_all']=='yes' ?
$lnkvar="'authorizations.php?show_all=no' name='Just Mine'>(Just Mine)" : $lnkvar="'authorizations.php?show_all=yes' name='See All'>(See All)";
46 <font
class='title'>Patient Notes
</font
>
47 <a
class='more' style
='font-size:8pt;' href
=<?php
echo $lnkvar; ?
></a
> </font
>
52 <font
class='title'>and
53 <a href
='authorizations_full.php' target
='Main'>Authorizations
<font
class='more'><?
echo $tmore;?
></font
></a
>
58 <font
class='more'>  
;
59 <a
class='more' style
='font-size:8pt;' href
='../calendar/find_patient.php?no_nav=1&mode=reset' name
='Find Patients'>(Find Patient
)</a
>
63 // Retrieve all active notes addressed to me (or to anybody)
64 $_GET['show_all']=='yes' ?
$usrvar='' : $usrvar=$_SESSION['authUser'] ;
65 if ($result=getPnotesByDate("", 1, "id,date,body,pid,user,title,assigned_to",
66 '%', "all", 0, $usrvar))
68 echo "<table border='0'>\n";
70 echo " <td class='bold' nowrap>Patient </td>\n";
71 echo " <td class='bold' nowrap>Note Type </td>\n";
72 echo " <td class='bold' nowrap>Timestamp and Text</td>\n";
75 foreach ($result as $iter) {
76 $body = $iter['body'];
77 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
80 $body = date('Y-m-d H:i', strtotime($iter['date'])) .
81 ' (' . $iter['user'] . ') ' . nl2br($body);
85 echo " <td valign='top' class='text'>\n";
86 echo getPatientName($iter['pid']) . "\n";
88 echo " <td valign='top'>\n";
89 echo " <a href='../../patient_file/patient_file.php" .
90 "?set_pid=" . $iter['pid'] .
91 "¬eid=" . $iter['id'] .
92 "' target='_top' class='link_submit'>" .
93 $iter['title'] . "</a>\n";
95 echo " <td valign='top' class='text'>\n";
106 if ($imauthorized && $see_auth > 1) {
114 //fetch billing information:
115 if ($res = sqlStatement("select *, concat(u.fname,' ', u.lname) as user " .
116 "from billing LEFT JOIN users as u on billing.user = u.id where " .
117 "billing.authorized = 0 and billing.activity = 1 and " .
118 "groupname = '$groupname'"))
120 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
121 $result[$iter] = $row;
123 foreach ($result as $iter) {
124 $authorize{$iter{"pid"}}{"billing"} .= "<span class=text>" .
125 $iter{"code_text"} . " " . date("n/j/Y",strtotime($iter{"date"})) .
128 //$authorize[$iter{"pid"}]{"billing"} = substr($authorize[$iter{"pid"}]{"billing"},0,strlen($authorize[$iter{"pid"}]{"billing"}));
132 //fetch transaction information:
133 if ($res = sqlStatement("select * from transactions where " .
134 "authorized = 0 and groupname = '$groupname'"))
136 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
137 $result2[$iter] = $row;
139 foreach ($result2 as $iter) {
140 $authorize{$iter{"pid"}}{"transaction"} .= "<span class=text>" .
141 $iter{"title"} . ": " . stripslashes(strterm($iter{"body"},25)) .
142 " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
144 //$authorize[$iter{"pid"}]{"transaction"} = substr($authorize[$iter{"pid"}]{"transaction"},0,strlen($authorize[$iter{"pid"}]{"transaction"}));
148 //fetch pnotes information:
149 if ($res = sqlStatement("select * from pnotes where authorized = 0 and " .
150 "groupname = '$groupname'"))
152 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
153 $result3[$iter] = $row;
155 foreach ($result3 as $iter) {
156 $authorize{$iter{"pid"}}{"pnotes"} .= "<span class=text>" .
157 stripslashes(strterm($iter{"body"},25)) . " " .
158 date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
160 //$authorize[$iter{"pid"}]{"pnotes"} = substr($authorize[$iter{"pid"}]{"pnotes"},0,strlen($authorize[$iter{"pid"}]{"pnotes"}));
164 //fetch forms information:
165 if ($res = sqlStatement("select * from forms where authorized = 0 and " .
166 "groupname = '$groupname'"))
168 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
169 $result4[$iter] = $row;
171 foreach ($result4 as $iter) {
172 $authorize{$iter{"pid"}}{"forms"} .= "<span class=text>" .
173 $iter{"form_name"} . " " . date("n/j/Y",strtotime($iter{"date"})) .
176 //$authorize[$iter{"pid"}]{"forms"} = substr($authorize[$iter{"pid"}]{"forms"},0,strlen($authorize[$iter{"pid"}]{"forms"}));
181 <table border
='0' cellpadding
='0' cellspacing
='2' width
='100%'>
189 while (list($ppid,$patient) = each($authorize)) {
190 $name = getPatientData($ppid);
192 // If I want to see mine only and this patient is not mine, skip it.
193 if ($see_auth == 2 && $_SESSION['authUserID'] != $name['id'])
197 print "<tr><td colspan='5' align='center'><a target='Main' " .
198 "href='authorizations_full.php?active=1' class='alert'>" .
199 "Some authorizations were not displayed. Click here to view all" .
204 echo "<tr><td valign='top'>" .
205 "<a href='$rootdir/patient_file/patient_file.php?set_pid=$ppid' " .
206 "target='_top'><span class='bold'>" . $name{"fname"} . " " .
207 $name{"lname"} . "</span></a><br>" .
208 "<a class=link_submit href='authorizations.php?mode=authorize" .
209 "&pid=$ppid'>Authorize</a></td>\n";
212 //Michael A Rowley MD 20041012.
213 // added below 4 lines to add provider to authorizations for ez reference.
214 $providerID = sqlFetchArray(sqlStatement(
215 "select providerID from patient_data where pid=$ppid"));
216 $userID=$providerID{"providerID"};
217 $providerName = sqlFetchArray(sqlStatement(
218 "select lname from users where id=$userID"));
220 // Don't use sqlQuery because there might be no match.
221 $providerName = sqlFetchArray(sqlStatement(
222 "select lname from users where id = " . $name['providerID']));
225 echo "<td valign=top><span class=bold>Provider:</span><span class=text><br>" .
226 $providerName{"lname"} . "</td>\n";
227 // ha ha, see if that works....mar.
228 echo "<td valign=top><span class=bold>Billing:</span><span class=text><br>" .
229 $patient{"billing"} . "</td>\n";
230 echo "<td valign=top><span class=bold>Transactions:</span><span class=text><br>" .
231 $patient{"transaction"} . "</td>\n";
232 echo "<td valign=top><span class=bold>Patient Notes:</span><span class=text><br>" .
233 $patient{"pnotes"} . "</td>\n";
234 echo "<td valign=top><span class=bold>Encounter Forms:</span><span class=text><br>" .
235 $patient{"forms"} . "</td>\n";