4 $sanitize_all_escapes=true;
7 //STOP FAKE REGISTER GLOBALS
8 $fake_register_globals=false;
11 include_once("../../globals.php");
12 include_once("$srcdir/calendar.inc");
13 include_once("$srcdir/patient.inc");
15 //the maximum number of patient records to display:
18 if (isset($_POST["mode"]) && ($_POST["mode"] == "editappt")) {
20 $body_code = ' onload="javascript:parent.Calendar.location.href=parent.Calendar.location.href;" ';
21 $year = $_POST["year"];
22 $month = $_POST["month"];
24 $hour = $_POST["hour"];
25 $minute = $_POST["minute"];
26 if ($_POST["ampm"] == "pm") {
29 $timesave = "$year-$month-$day $hour:$minute";
31 $providerres = sqlQuery("select name from groups where user=? limit 1", array($_POST["provider"]) );
33 saveCalendarUpdate($_POST["calid"],$_POST["pid"],$timesave,$_POST["reason"],$_POST["provider"],$providerres{"name"});
35 elseif (isset($_POST["mode"]) && ($_POST["mode"] == "deleteappt")) {
36 $body_code = ' onload="javascript:parent.Calendar.location.href=parent.Calendar.location.href;" ';
38 deleteCalendarItem($_POST["calid"],$_POST["pid"]);
40 elseif (isset($_POST["mode"]) && ($_POST["mode"] == "saveappt")) {
41 $body_code = ' onload="javascript:parent.Calendar.location.href=parent.Calendar.location.href;" ';
42 $year = $_POST["year"];
43 $month = $_POST["month"];
45 $hour = $_POST["hour"];
46 $minute = $_POST["minute"];
47 if ($_POST["ampm"] == "pm") {
50 $timesave = "$year-$month-$day $hour:$minute";
51 $providerres = sqlQuery("select name from groups where user=? limit 1", array($_POST["provider"]) );
52 newCalendarItem($_POST["pid"],$timesave,$_POST["reason"],$_POST["provider"],$providerres{"name"});
55 $category = $_GET["event_category"];
58 $category = $_POST['category'];
62 if (isset($_GET["mode"]) && ($_GET["mode"] == "reset")) {
63 $_SESSION["lastname"] = "";
64 $_SESSION["firstname"] = "";
65 //$_SESSION["category"] = $_POST["category"];
66 $category = $_POST["category"];
69 if (isset($_POST["mode"]) && ($_POST["mode"] == "findpatient")) {
70 $_SESSION["findby"] = $_POST["findBy"];
71 $_SESSION["lastname"] = $_POST["lastname"];
72 $_SESSION["firstname"] = $_POST["firstname"];
73 $category = $_POST["category"];
76 $findby = $_SESSION["findby"];
77 $lastname = $_SESSION["lastname"];
78 $firstname = $_SESSION["firstname"];
80 // do the search, if we have some good criteria
81 if (isset($lastname) && $lastname != "") {
82 if ($findby == "Last") {
83 $result = getPatientLnames("$lastname","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
84 } elseif ($findby == "ID") {
85 $result = getPatientId("$lastname","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
86 } elseif ($findby == "DOB") {
87 $result = getPatientDOB("$lastname","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
88 } elseif ($findby == "SSN") {
89 $result = getPatientSSN("$lastname","*, DATE_FORMAT(DOB,'%m/%d/%Y') as DOB_TS");
90 } elseif ($searchby == "Phone") { //(CHEMED) Search by phone number
91 $result = getPatientPhone("$searchparm","*");
98 <?php
html_header_show();?
>
100 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
110 background
-color
: #ddddff;
116 #searchCriteria form {
117 /* this is to fix some odd thing with Firefox,
118 or is it something odd with IE ?! crazy */
119 background
-color
: #ddddff;
121 #searchResultsHeader {
123 background
-color
: lightgrey
;
125 #searchResultsHeader table {
126 width
: 96%
; /* not 100% because the 'searchResults' table has a scrollbar */
127 border
-collapse
: collapse
;
129 #searchResultsHeader th {
137 .srName
{ width
: 30%
; }
138 .srPhone
{ width
: 21%
; }
139 .srSS
{ width
: 17%
; }
140 .srDOB
{ width
: 17%
; }
141 .srID
{ width
: 15%
; }
143 #searchResults table {
145 border
-collapse
: collapse
;
146 background
-color
: white
;
154 border
-bottom
: 1px solid
#eee;
157 .billing
{ color
: red
; font
-weight
: bold
; }
158 /* for search results or 'searching' notification */
162 padding
: 1px
1px
10px
1px
;
167 .noResults
{ background
-color
: #ccc; }
168 .tooManyResults
{ background
-color
: #fc0; }
169 .howManyResults
{ background
-color
: #9f6; }
176 background
-color
: #336699;
181 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
182 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script
>
184 <script language
='JavaScript'>
186 // This is called from the event editor popup to refresh the display.
187 function refreshme() {
188 var cf
= parent
.frames
[0].frames
[0]; // calendar frame
189 if (cf
&& cf
.refreshme
) cf
.refreshme();
192 // Cloned from interface/main/calendar/.../views/day/default.html:
193 function newEvt(startampm
, starttimeh
, starttimem
, eventdate
, providerid
, patientid
) {
194 dlgopen('add_edit_event.php?startampm=' + startampm +
195 '&starttimeh=' + starttimeh +
'&starttimem=' + starttimem +
196 //'&date=' + eventdate + '&userid=' + providerid +
197 '&date=' + eventdate +
198 '&patientid=' + patientid
,
205 <body
class="body_bottom" <?php
$body_code;?
>>
207 <span
class='bold'><?php
echo htmlspecialchars( xl('Patient Appointment'), ENT_NOQUOTES
); ?
></span
>
208 <?php
if ($userauthorized == 1) { ?
>
209 <a
class="more" style
="font-size:8pt;"
210 href
="../authorizations/authorizations.php"
211 name
="Authorizations"><?php
echo htmlspecialchars( xl('(Notes and Authorizations)'), ENT_NOQUOTES
); ?
></a
>
213 <a
class="more" style
="font-size:8pt;"
214 href
="../authorizations/authorizations.php"
215 name
="Authorizations"><?php
echo htmlspecialchars( xl('(Patient Notes)'), ENT_NOQUOTES
); ?
></a
>
218 <div id
="searchCriteria">
219 <form method
='post' id
="theform" name
='findpatientform' action
='find_patient.php?no_nav=1'>
220 <input type
='hidden' name
='mode' value
="findpatient">
221 <?php
echo htmlspecialchars( xl('Search by:'), ENT_NOQUOTES
); ?
>
222 <select name
='findBy'>
223 <option value
="Last"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></option
>
224 <!-- (CHEMED
) Search by phone number
-->
225 <option value
="Phone"<?php
if ($searchby == 'Phone') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></option
>
226 <option value
="ID"<?php
if ($searchby == 'ID') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></option
>
227 <option value
="SSN"<?php
if ($searchby == 'SSN') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('SSN'), ENT_NOQUOTES
); ?
></option
>
228 <option value
="DOB"<?php
if ($searchby == 'DOB') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></option
>
230 <?php
echo htmlspecialchars( xl('for:'), ENT_NOQUOTES
); ?
>
231 <input type
='text' id
='lastname' name
='lastname' size
='12' value
='<?php echo htmlspecialchars( $_REQUEST['lastname
'], ENT_QUOTES); ?>' title
='<?php echo htmlspecialchars( xl('If name
, any part of lastname
or lastname
,firstname
'), ENT_QUOTES); ?>'>
233 <input type
='submit' id
="submitbtn" value
='<?php echo htmlspecialchars( xl('Search
'), ENT_QUOTES); ?>'>
234 <div id
="searchspinner"><img src
="<?php echo $GLOBALS['webroot'] ?>/interface/pic/ajax-loader.gif"></div
>
236 <?php
if (! isset($_REQUEST['lastname'])): ?
>
237 <div id
="searchstatus"><?php
echo htmlspecialchars( xl('Enter your search criteria above'), ENT_NOQUOTES
); ?
></div
>
238 <?php
elseif (count($result) == 0): ?
>
239 <div id
="searchstatus" class="noResults"><?php
echo htmlspecialchars( xl('No records found. Please expand your search criteria.'), ENT_NOQUOTES
); ?
></div
>
240 <?php
elseif (count($result)>=100): ?
>
241 <div id
="searchstatus" class="tooManyResults"><?php
echo htmlspecialchars( xl('More than 100 records found. Please narrow your search criteria.'), ENT_NOQUOTES
); ?
></div
>
242 <?php
elseif (count($result)<100): ?
>
243 <div id
="searchstatus" class="howManyResults"><?php
echo htmlspecialchars( count($result)." ".xl('records found'), ENT_NOQUOTES
); ?
>.</div
>
246 <a
class='text' href
="../../new/new_patient.php" target
="_top"><?php
echo htmlspecialchars( xl('(New Patient)'), ENT_NOQUOTES
); ?
></a
>
252 <?php
if (isset($result)): ?
> <!-- we have results
-->
254 <div id
="searchResultsHeader">
257 <th
class="srName"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></th
>
258 <th
class="srPhone"><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></th
> <!-- (CHEMED
) Search by phone number
-->
259 <th
class="srSS"><?php
echo htmlspecialchars( xl('SS'), ENT_NOQUOTES
); ?
></th
>
260 <th
class="srDOB"><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></th
>
261 <th
class="srID"><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></th
>
266 <div id
="searchResults">
269 //set ampm default for find patient results links event_startampm
271 if (date("H") >= 12) { $ampm = 2; }
273 foreach ($result as $iter) {
274 if ($total > 100) { break; }
276 $iterpid = $iter['pid'];
277 $iterproviderid = $iter['providerID'];
278 $iterlname = $iter['lname'];
279 $iterfname = $iter['fname'];
280 $itermname = $iter['mname'];
281 $iterdob = $iter['DOB'];
283 // the special genericname2 of 'Billing' means something, but I'm not sure
284 // what, regardless it gets special coloring and an extra line of output
285 // in the 'name' column -- JRM
286 $trClass = "oneresult";
287 if ($iter['genericname2'] == 'Billing') { $trClass .= " billing"; }
289 $trTitle = xl("Make new appointment for") . " " . $iterfname . " " . $iterlname;
291 echo " <tr class='".$trClass."' id='".htmlspecialchars( $iterpid."~".$iterproviderid, ENT_QUOTES
)."' title='".htmlspecialchars( $trTitle, ENT_QUOTES
)."'>";
292 echo " <td class='srName'>".htmlspecialchars( $iterlname.", ".$iterfname." ".$itermname, ENT_NOQUOTES
);
293 if ($iter['genericname2'] == 'Billing') { echo "<br>".htmlspecialchars( $iter['genericval2'], ENT_NOQUOTES
); }
295 echo " <td class='srPhone'>" . htmlspecialchars( $iter['phone_home'], ENT_NOQUOTES
) . "</td>\n"; //(CHEMED) Search by phone number
296 echo " <td class='srSS'>" . htmlspecialchars( $iter['ss'], ENT_NOQUOTES
) . "</td>\n";
297 echo " <td class='srDOB'>" . htmlspecialchars( $iter['DOB'], ENT_NOQUOTES
) . "</td>\n";
298 echo " <td class='srID'>" . htmlspecialchars( $iter['pubpid'], ENT_NOQUOTES
) . "</td>\n";
304 <?php
endif; ?
> <!-- end of results
-->
306 </div
> <!-- end search results DIV
-->
310 <script language
="javascript">
312 // jQuery stuff to make the page a little easier to use
314 $
(document
).ready(function(){
315 $
("#lastname").focus();
316 $
(".oneresult").mouseover(function() { $
(this
).toggleClass("highlight"); });
317 $
(".oneresult").mouseout(function() { $
(this
).toggleClass("highlight"); });
318 $
(".oneresult").click(function() { SelectPatient(this
); });
319 $
("#theform").submit(function() { SubmitForm(this
); });
322 // show the 'searching...' status and submit the form
323 var SubmitForm
= function(eObj
) {
324 $
("#submitbtn").css("disabled", "true");
325 $
("#searchspinner").css("visibility", "visible");
329 // another way to select a patient from the list of results
330 // parts[] ==> 0=PID, 1=ProviderID
331 var SelectPatient
= function (eObj
) {
333 var parts
= objID
.split("~");
334 ampm
= '<?php echo $ampm ?>';
335 starth
= '<?php date("H") ?>';
336 startdate
= '<?php date("Ymd") ?>';
337 return newEvt(ampm
, starth
, 0, startdate
, parts
[1], parts
[0]);
340 var Showme
= function (eObj
) { alert("showme"); };