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.
11 * This popup is called when adding/editing a calendar event
15 //SANITIZE ALL ESCAPES
16 $sanitize_all_escapes=true;
19 //STOP FAKE REGISTER GLOBALS
20 $fake_register_globals=false;
23 include_once("../../globals.php");
24 include_once("$srcdir/patient.inc");
25 include_once("$srcdir/formdata.inc.php");
29 // If we are searching, search.
31 if ($_REQUEST['searchby'] && $_REQUEST['searchparm']) {
32 $searchby = $_REQUEST['searchby'];
33 $searchparm = trim($_REQUEST['searchparm']);
35 if ($searchby == "Last") {
36 $result = getPatientLnames("$searchparm","*");
37 } elseif ($searchby == "Phone") { //(CHEMED) Search by phone number
38 $result = getPatientPhone("$searchparm","*");
39 } elseif ($searchby == "ID") {
40 $result = getPatientId("$searchparm","*");
41 } elseif ($searchby == "DOB") {
42 $result = getPatientDOB("$searchparm","*");
43 } elseif ($searchby == "SSN") {
44 $result = getPatientSSN("$searchparm","*");
51 <?php
html_header_show();?
>
52 <title
><?php
echo htmlspecialchars( xl('Patient Finder'), ENT_NOQUOTES
); ?
></title
>
53 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
64 background
-color
: #ddddff;
68 #searchResultsHeader {
70 background
-color
: lightgrey
;
72 #searchResultsHeader table {
73 width
: 96%
; /* not 100% because the 'searchResults' table has a scrollbar */
74 border
-collapse
: collapse
;
76 #searchResultsHeader th {
85 /* search results column widths */
86 .srName
{ width
: 30%
; }
87 .srPhone
{ width
: 21%
; }
89 .srDOB
{ width
: 17%
; }
92 #searchResults table {
94 border
-collapse
: collapse
;
95 background
-color
: white
;
103 border
-bottom
: 1px solid
#eee;
106 .billing
{ color
: red
; font
-weight
: bold
; }
108 /* for search results or 'searching' notification */
112 padding
: 1px
1px
10px
1px
;
117 .noResults
{ background
-color
: #ccc; }
118 .tooManyResults
{ background
-color
: #fc0; }
119 .howManyResults
{ background
-color
: #9f6; }
125 /* highlight for the mouse-over */
127 background
-color
: #336699;
132 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-1.2.2.min.js"></script
>
133 <!-- ViSolve
: Verify the noresult parameter
-->
135 if(isset($_GET["res"])){
137 <script language="Javascript">
138 // Pass the variable to parent hidden type and submit
139 opener.document.theform.resname.value = "noresult";
140 opener.document.theform.submit();
146 <!-- ViSolve
: Verify the noresult parameter
-->
148 <script language
="JavaScript">
150 function selpid(pid
, lname
, fname
, dob
) {
151 if (opener
.closed ||
! opener
.setpatient
)
152 alert("<?php echo htmlspecialchars( xl('The destination form was closed; I cannot act on your selection.'), ENT_QUOTES); ?>");
154 opener
.setpatient(pid
, lname
, fname
, dob
);
163 <body
class="body_top">
165 <div id
="searchCriteria">
166 <form method
='post' name
='theform' id
="theform" action
='find_patient_popup.php?<?php if(isset($_GET['pflag
'])) echo "pflag=0"; ?>'>
167 <?php
echo htmlspecialchars( xl('Search by:'), ENT_NOQUOTES
); ?
>
168 <select name
='searchby'>
169 <option value
="Last"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></option
>
170 <!-- (CHEMED
) Search by phone number
-->
171 <option value
="Phone"<?php
if ($searchby == 'Phone') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></option
>
172 <option value
="ID"<?php
if ($searchby == 'ID') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></option
>
173 <option value
="SSN"<?php
if ($searchby == 'SSN') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('SSN'), ENT_NOQUOTES
); ?
></option
>
174 <option value
="DOB"<?php
if ($searchby == 'DOB') echo ' selected' ?
>><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></option
>
176 <?php
echo htmlspecialchars( xl('for:'), ENT_NOQUOTES
); ?
>
177 <input type
='text' id
='searchparm' name
='searchparm' size
='12' value
='<?php echo htmlspecialchars( $_REQUEST['searchparm
'], ENT_QUOTES); ?>'
178 title
='<?php echo htmlspecialchars( xl('If name
, any part of lastname
or lastname
,firstname
'), ENT_QUOTES); ?>'>
180 <input type
='submit' id
="submitbtn" value
='<?php echo htmlspecialchars( xl('Search
'), ENT_QUOTES); ?>'>
181 <!--  
; <input type
='button' value
='<?php echo htmlspecialchars( xl('Close
'), ENT_QUOTES); ?>' onclick
='window.close()' /> -->
182 <div id
="searchspinner"><img src
="<?php echo $GLOBALS['webroot'] ?>/interface/pic/ajax-loader.gif"></div
>
187 <?php
if (! isset($_REQUEST['searchparm'])): ?
>
188 <div id
="searchstatus"><?php
echo htmlspecialchars( xl('Enter your search criteria above'), ENT_NOQUOTES
); ?
></div
>
189 <?php
elseif (count($result) == 0): ?
>
190 <div id
="searchstatus" class="noResults"><?php
echo htmlspecialchars( xl('No records found. Please expand your search criteria.'), ENT_NOQUOTES
); ?
>
192 <!--VicarePlus
:: If pflag is set the
new patient create link will not be displayed
--!>
193 <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
>
195 <?php
elseif (count($result)>=100): ?
>
196 <div id
="searchstatus" class="tooManyResults"><?php
echo htmlspecialchars( xl('More than 100 records found. Please narrow your search criteria.'), ENT_NOQUOTES
); ?
></div
>
197 <?php
elseif (count($result)<100): ?
>
198 <div id
="searchstatus" class="howManyResults"><?php
echo htmlspecialchars( count($result), ENT_NOQUOTES
); ?
> <?php
echo htmlspecialchars( xl('records found.'), ENT_NOQUOTES
); ?
></div
>
201 <?php
if (isset($result)): ?
>
203 <div id
="searchResultsHeader">
206 <th
class="srName"><?php
echo htmlspecialchars( xl('Name'), ENT_NOQUOTES
); ?
></th
>
207 <th
class="srPhone"><?php
echo htmlspecialchars( xl('Phone'), ENT_NOQUOTES
); ?
></th
> <!-- (CHEMED
) Search by phone number
-->
208 <th
class="srSS"><?php
echo htmlspecialchars( xl('SS'), ENT_NOQUOTES
); ?
></th
>
209 <th
class="srDOB"><?php
echo htmlspecialchars( xl('DOB'), ENT_NOQUOTES
); ?
></th
>
210 <th
class="srID"><?php
echo htmlspecialchars( xl('ID'), ENT_NOQUOTES
); ?
></th
>
215 <div id
="searchResults">
218 foreach ($result as $iter) {
219 $iterpid = $iter['pid'];
220 $iterlname = $iter['lname'];
221 $iterfname = $iter['fname'];
222 $itermname = $iter['mname'];
223 $iterdob = $iter['DOB'];
225 // the special genericname2 of 'Billing' means something, but I'm not sure
226 // what, regardless it gets special coloring and an extra line of output
227 // in the 'name' column -- JRM
228 $trClass = "oneresult";
229 if ($iter['genericname2'] == 'Billing') { $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 ($iter['genericname2'] == 'Billing') { echo "<br>" . htmlspecialchars( $iter['genericval2'], 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]);