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 $atemp = sqlQuery("SELECT see_auth FROM users WHERE username = '" .
17 $_SESSION['authUser'] . "'");
18 $see_auth = $atemp['see_auth'];
20 $imauthorized = $_SESSION['userauthorized'] ||
$see_auth > 2;
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'> (".xl('Just Mine').") " : $lnkvar="'authorizations.php?show_all=yes' name='See All'>(".xl('See All').")";
46 <font
class='title'><?
xl('Patient Notes','e')?
> </font
>
47 <a
class='more' style
='font-size:8pt;' href
=<?php
echo $lnkvar; ?
></a
> </font
>
52 <font
class='title'><?
xl('and ','e')?
>
53 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
54 <a href
='authorizations_full.php'>
56 <a href
='authorizations_full.php' target
='Main'>
58 <?
xl('Authorizations','e')?
><font
class='more'><?
echo (xl($tmore));?
></font
></a
>
64 <?php
if (!$GLOBALS['concurrent_layout']) { ?
>
65 <font
class='more'>  
;
66 <a
class='more' style
='font-size:8pt;' href
='../calendar/find_patient.php?no_nav=1&mode=reset' name
='Find Patients'>(<?
xl('Find Patient','e')?
>)</a
>
71 // Retrieve all active notes addressed to me (or to anybody)
72 $_GET['show_all']=='yes' ?
$usrvar='' : $usrvar=$_SESSION['authUser'] ;
73 if ($result=getPnotesByDate("", 1, "id,date,body,pid,user,title,assigned_to",
74 '%', "all", 0, $usrvar))
76 echo "<table border='0'>\n";
78 echo " <td class='bold' nowrap>".xl('Patient')." </td>\n";
79 echo " <td class='bold' nowrap>".xl('Note Type')." </td>\n";
80 echo " <td class='bold' nowrap>".xl('Timestamp and Text')."</td>\n";
83 foreach ($result as $iter) {
84 $body = $iter['body'];
85 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
88 $body = date('Y-m-d H:i', strtotime($iter['date'])) .
89 ' (' . $iter['user'] . ') ' . nl2br($body);
93 echo " <td valign='top' class='text'>\n";
94 echo getPatientName($iter['pid']) . "\n";
96 echo " <td valign='top'>\n";
98 if ($GLOBALS['concurrent_layout']) {
99 echo " <a href='../../patient_file/summary/pnotes_full.php" .
100 "?set_pid=" . $iter['pid'] . "¬eid=" . $iter['id'] .
101 "&active=1' class='link_submit'>" . $iter['title'] . "</a>\n";
103 echo " <a href='../../patient_file/patient_file.php" .
104 "?set_pid=" . $iter['pid'] . "¬eid=" . $iter['id'] .
105 "' target='_top' class='link_submit'>" . $iter['title'] . "</a>\n";
109 echo " <td valign='top' class='text'>\n";
120 if ($imauthorized && $see_auth > 1) {
128 //fetch billing information:
129 if ($res = sqlStatement("select *, concat(u.fname,' ', u.lname) as user " .
130 "from billing LEFT JOIN users as u on billing.user = u.id where " .
131 "billing.authorized = 0 and billing.activity = 1 and " .
132 "groupname = '$groupname'"))
134 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
135 $result1[$iter] = $row;
137 foreach ($result1 as $iter) {
138 $authorize{$iter{"pid"}}{"billing"} .= "<span class=text>" .
139 $iter{"code_text"} . " " . date("n/j/Y",strtotime($iter{"date"})) .
142 //$authorize[$iter{"pid"}]{"billing"} = substr($authorize[$iter{"pid"}]{"billing"},0,strlen($authorize[$iter{"pid"}]{"billing"}));
146 //fetch transaction information:
147 if ($res = sqlStatement("select * from transactions where " .
148 "authorized = 0 and groupname = '$groupname'"))
150 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
151 $result2[$iter] = $row;
153 foreach ($result2 as $iter) {
154 $authorize{$iter{"pid"}}{"transaction"} .= "<span class=text>" .
155 $iter{"title"} . ": " . stripslashes(strterm($iter{"body"},25)) .
156 " " . date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
158 //$authorize[$iter{"pid"}]{"transaction"} = substr($authorize[$iter{"pid"}]{"transaction"},0,strlen($authorize[$iter{"pid"}]{"transaction"}));
162 //fetch pnotes information:
163 if ($res = sqlStatement("select * from pnotes where authorized = 0 and " .
164 "groupname = '$groupname'"))
166 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
167 $result3[$iter] = $row;
169 foreach ($result3 as $iter) {
170 $authorize{$iter{"pid"}}{"pnotes"} .= "<span class=text>" .
171 stripslashes(strterm($iter{"body"},25)) . " " .
172 date("n/j/Y",strtotime($iter{"date"})) . "</span><br>\n";
174 //$authorize[$iter{"pid"}]{"pnotes"} = substr($authorize[$iter{"pid"}]{"pnotes"},0,strlen($authorize[$iter{"pid"}]{"pnotes"}));
178 //fetch forms information:
179 if ($res = sqlStatement("select * from forms where authorized = 0 and " .
180 "groupname = '$groupname'"))
182 for ($iter = 0;$row = sqlFetchArray($res);$iter++
)
183 $result4[$iter] = $row;
185 foreach ($result4 as $iter) {
186 $authorize{$iter{"pid"}}{"forms"} .= "<span class=text>" .
187 $iter{"form_name"} . " " . date("n/j/Y",strtotime($iter{"date"})) .
190 //$authorize[$iter{"pid"}]{"forms"} = substr($authorize[$iter{"pid"}]{"forms"},0,strlen($authorize[$iter{"pid"}]{"forms"}));
195 <table border
='0' cellpadding
='0' cellspacing
='2' width
='100%'>
203 while (list($ppid,$patient) = each($authorize)) {
204 $name = getPatientData($ppid);
206 // If I want to see mine only and this patient is not mine, skip it.
207 if ($see_auth == 2 && $_SESSION['authUserID'] != $name['id'])
211 print "<tr><td colspan='5' align='center'><a" .
212 ($GLOBALS['concurrent_layout'] ?
"" : " target='Main'") .
213 " href='authorizations_full.php?active=1' class='alert'>" .
214 xl('Some authorizations were not displayed. Click here to view all') .
219 echo "<tr><td valign='top'>";
220 if ($GLOBALS['concurrent_layout']) {
221 // Clicking the patient name will load both frames for that patient,
222 // as demographics.php takes care of loading the bottom frame.
223 echo "<a href='$rootdir/patient_file/summary/demographics.php?set_pid=$ppid' " .
226 echo "<a href='$rootdir/patient_file/patient_file.php?set_pid=$ppid' " .
229 echo "<span class='bold'>" . $name{"fname"} . " " .
230 $name{"lname"} . "</span></a><br>" .
231 "<a class=link_submit href='authorizations.php?mode=authorize" .
232 "&pid=$ppid'>" . xl('Authorize') . "</a></td>\n";
235 //Michael A Rowley MD 20041012.
236 // added below 4 lines to add provider to authorizations for ez reference.
237 $providerID = sqlFetchArray(sqlStatement(
238 "select providerID from patient_data where pid=$ppid"));
239 $userID=$providerID{"providerID"};
240 $providerName = sqlFetchArray(sqlStatement(
241 "select lname from users where id=$userID"));
243 // Don't use sqlQuery because there might be no match.
244 $providerName = sqlFetchArray(sqlStatement(
245 "select lname from users where id = " . $name['providerID']));
248 echo "<td valign=top><span class=bold>".xl('Provider').":</span><span class=text><br>" .
249 $providerName{"lname"} . "</td>\n";
250 // ha ha, see if that works....mar.
251 echo "<td valign=top><span class=bold>".xl('Billing').":</span><span class=text><br>" .
252 $patient{"billing"} . "</td>\n";
253 echo "<td valign=top><span class=bold>".xl('Transactions').":</span><span class=text><br>" .
254 $patient{"transaction"} . "</td>\n";
255 echo "<td valign=top><span class=bold>".xl('Patient Notes').":</span><span class=text><br>" .
256 $patient{"pnotes"} . "</td>\n";
257 echo "<td valign=top><span class=bold>".xl('Encounter Forms').":</span><span class=text><br>" .
258 $patient{"forms"} . "</td>\n";