2 /* Copyright (C) 2005-2007 Rod Roark <rod@sunsetsystems.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
12 * This popup is called when adding/editing a calendar event
16 //SANITIZE ALL ESCAPES
17 $sanitize_all_escapes=true;
20 //STOP FAKE REGISTER GLOBALS
21 $fake_register_globals=false;
24 include_once('../../globals.php');
25 include_once("$srcdir/patient.inc");
26 include_once("$srcdir/formdata.inc.php");
30 // If we are searching, search.
32 if ($_REQUEST['searchby'] && $_REQUEST['searchparm']) {
33 $searchby = $_REQUEST['searchby'];
34 $searchparm = trim($_REQUEST['searchparm']);
36 if ($searchby == "Last") {
37 $result = getPatientLnames("$searchparm","*");
38 } elseif ($searchby == "Phone") { //(CHEMED) Search by phone number
39 $result = getPatientPhone("$searchparm","*");
40 } elseif ($searchby == "ID") {
41 $result = getPatientId("$searchparm","*");
42 } elseif ($searchby == "DOB") {
43 $result = getPatientDOB("$searchparm","*");
44 } elseif ($searchby == "SSN") {
45 $result = getPatientSSN("$searchparm","*");
52 <?php
html_header_show();?
>
53 <title
><?php
echo htmlspecialchars( xl('Patient Finder'), ENT_NOQUOTES
); ?
></title
>
54 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
65 background
-color
: #ddddff;
69 #searchResultsHeader {
71 background
-color
: lightgrey
;
73 #searchResultsHeader table {
74 width
: 96%
; /* not 100% because the 'searchResults' table has a scrollbar */
75 border
-collapse
: collapse
;
77 #searchResultsHeader th {
86 /* search results column widths */
87 .srName
{ width
: 30%
; }
88 .srPhone
{ width
: 21%
; }
90 .srDOB
{ width
: 17%
; }
93 #searchResults table {
95 border
-collapse
: collapse
;
96 background
-color
: white
;
104 border
-bottom
: 1px solid
#eee;
107 .billing
{ color
: red
; font
-weight
: bold
; }
109 /* for search results or 'searching' notification */
113 padding
: 1px
1px
10px
1px
;
118 .noResults
{ background
-color
: #ccc; }
119 .tooManyResults
{ background
-color
: #fc0; }
120 .howManyResults
{ background
-color
: #9f6; }
126 /* highlight for the mouse-over */
128 background
-color
: #336699;
133 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script
>
134 <!-- ViSolve
: Verify the noresult parameter
-->
136 if(isset($_GET["res"])){
138 <script language="Javascript">
139 // Pass the variable to parent hidden type and submit
140 opener.document.theform.resname.value = "noresult";
141 opener.document.theform.submit();
147 <!-- ViSolve
: Verify the noresult parameter
-->
149 <script language
="JavaScript">
151 function selpid(pid
, lname
, fname
, dob
) {
152 if (opener
.closed ||
! opener
.setpatient
)
153 alert("<?php echo htmlspecialchars( xl('The destination form was closed; I cannot act on your selection.'), ENT_QUOTES); ?>");
155 opener
.setpatient(pid
, lname
, fname
, dob
);
164 <body
class="body_top">
166 <div id
="searchCriteria">
167 <form method
='post' name
='theform' id
="theform" action
='find_patient_popup.php?<?php if(isset($_GET['pflag
'])) echo "pflag=0"; ?>'>
168 <?php
echo htmlspecialchars( xl('Search by:'), ENT_NOQUOTES
); ?
>
169 <select name
='searchby'>
170 <option value
="Last"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></option
>
171 <!-- (CHEMED
) Search by phone number
-->
172 <option value
="Phone"<?php
if ($searchby == 'Phone') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></option
>
173 <option value
="ID"<?php
if ($searchby == 'ID') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></option
>
174 <option value
="SSN"<?php
if ($searchby == 'SSN') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('SSN'), ENT_NOQUOTES
); ?
></option
>
175 <option value
="DOB"<?php
if ($searchby == 'DOB') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></option
>
177 <?php
echo htmlspecialchars( xl('for:'), ENT_NOQUOTES
); ?
>
178 <input type
='text' id
='searchparm' name
='searchparm' size
='12' value
='<?php echo htmlspecialchars( $_REQUEST['searchparm
'], ENT_QUOTES); ?>'
179 title
='<?php echo htmlspecialchars( xl('If name
, any part of lastname
or lastname
,firstname
'), ENT_QUOTES); ?>'>
181 <input type
='submit' id
="submitbtn" value
='<?php echo htmlspecialchars( xl('Search
'), ENT_QUOTES); ?>'>
182 <!--  
; <input type
='button' value
='<?php echo htmlspecialchars( xl('Close
'), ENT_QUOTES); ?>' onclick
='window.close()' /> -->
183 <div id
="searchspinner"><img src
="<?php echo $GLOBALS['webroot'] ?>/interface/pic/ajax-loader.gif"></div
>
188 <?php
if (! isset($_REQUEST['searchparm'])): ?
>
189 <div id
="searchstatus"><?php
echo htmlspecialchars( xl('Enter your search criteria above'), ENT_NOQUOTES
); ?
></div
>
190 <?php
elseif (count($result) == 0): ?
>
191 <div id
="searchstatus" class="noResults"><?php
echo htmlspecialchars( xl('No records found. Please expand your search criteria.'), ENT_NOQUOTES
); ?
>
193 <!--VicarePlus
:: If pflag is set the
new patient create link will not be displayed
--!>
194 <a
class="noresult" href
='find_patient_popup.php?res=noresult' <?php
if(isset($_GET['pflag'])) { ?
> style
="display:none;" <?php
} ?
> ><?php
echo htmlspecialchars( xl('Click Here to add a new patient.'), ENT_NOQUOTES
); ?
></a
>
196 <?php
elseif (count($result)>=100): ?
>
197 <div id
="searchstatus" class="tooManyResults"><?php
echo htmlspecialchars( xl('More than 100 records found. Please narrow your search criteria.'), ENT_NOQUOTES
); ?
></div
>
198 <?php
elseif (count($result)<100): ?
>
199 <div id
="searchstatus" class="howManyResults"><?php
echo htmlspecialchars( count($result), ENT_NOQUOTES
); ?
> <?php
echo htmlspecialchars( xl('records found.'), ENT_NOQUOTES
); ?
></div
>
202 <?php
if (isset($result)): ?
>
204 <div id
="searchResultsHeader">
207 <th
class="srName"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></th
>
208 <th
class="srPhone"><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></th
> <!-- (CHEMED
) Search by phone number
-->
209 <th
class="srSS"><?php
echo htmlspecialchars( xl('SS'), ENT_NOQUOTES
); ?
></th
>
210 <th
class="srDOB"><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></th
>
211 <th
class="srID"><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></th
>
216 <div id
="searchResults">
219 foreach ($result as $iter) {
220 $iterpid = $iter['pid'];
221 $iterlname = $iter['lname'];
222 $iterfname = $iter['fname'];
223 $itermname = $iter['mname'];
224 $iterdob = $iter['DOB'];
226 // If billing note exists, then it gets special coloring and an extra line of output
227 // in the 'name' column.
228 $trClass = "oneresult";
229 if (!empty($iter['billing_note'])) { $trClass .= " billing"; }
231 echo " <tr class='".$trClass."' id='" .
232 htmlspecialchars( $iterpid."~".$iterlname."~".$iterfname."~".$iterdob, ENT_QUOTES
) . "'>";
233 echo " <td class='srName'>" . htmlspecialchars( $iterlname.", ".$iterfname." ".$itermname, ENT_NOQUOTES
);
234 if (!empty($iter['billing_note'])) { echo "<br>" . htmlspecialchars( $iter['billing_note'], ENT_NOQUOTES
); }
236 echo " <td class='srPhone'>" . htmlspecialchars( $iter['phone_home'], ENT_NOQUOTES
) . "</td>\n"; //(CHEMED) Search by phone number
237 echo " <td class='srSS'>" . htmlspecialchars( $iter['ss'], ENT_NOQUOTES
) . "</td>\n";
238 echo " <td class='srDOB'>" . htmlspecialchars( $iter['DOB'], ENT_NOQUOTES
) . "</td>\n";
239 echo " <td class='srID'>" . htmlspecialchars( $iter['pubpid'], ENT_NOQUOTES
) . "</td>\n";
247 <script language
="javascript">
249 // jQuery stuff to make the page a little easier to use
251 $
(document
).ready(function(){
252 $
("#searchparm").focus();
253 $
(".oneresult").mouseover(function() { $
(this
).toggleClass("highlight"); });
254 $
(".oneresult").mouseout(function() { $
(this
).toggleClass("highlight"); });
255 $
(".oneresult").click(function() { SelectPatient(this
); });
257 $
(".noresult").click(function () { SubmitForm(this
);});
259 //$(".event").dblclick(function() { EditEvent(this); });
260 $
("#theform").submit(function() { SubmitForm(this
); });
264 // show the 'searching...' status and submit the form
265 var SubmitForm
= function(eObj
) {
266 $
("#submitbtn").css("disabled", "true");
267 $
("#searchspinner").css("visibility", "visible");
272 // another way to select a patient from the list of results
273 // parts[] ==> 0=PID, 1=LName, 2=FName, 3=DOB
274 var SelectPatient
= function (eObj
) {
276 var parts
= objID
.split("~");
277 return selpid(parts
[0], parts
[1], parts
[2], parts
[3]);