MU2 for items e2 and f1.
[openemr.git] / interface / reports / patient_flow_board_report.php
blobe55f869ccb713fb9730cc95ccda282878ab2e8bc
1 <?php
2 /*
3 * Patient Flow Board (Patient Tracker) (Report Based on the appointment report)
5 *
7 * This program used to select and print the information captured in the Patient Flow Board program ,
8 * allowing the user to select and print the desired information.
9 *
10 * Copyright (C) 2015 Terry Hill <terry@lillysystems.com>
12 * LICENSE: This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 3
15 * of the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
23 * @package OpenEMR
24 * @author Terry Hill <terry@lilysystems.com>
25 * @link http://www.open-emr.org
27 * Please help the overall project by sending changes you make to the author and to the OpenEMR community.
31 $fake_register_globals=false;
32 $sanitize_all_escapes=true;
34 require_once("../globals.php");
35 require_once("../../library/patient.inc");
36 require_once("$srcdir/formatting.inc.php");
37 require_once "$srcdir/options.inc.php";
38 require_once "$srcdir/formdata.inc.php";
39 require_once "$srcdir/appointments.inc.php";
40 require_once("$srcdir/patient_tracker.inc.php");
42 $patient = $_REQUEST['patient'];
44 if ($patient && ! $_POST['form_from_date']) {
45 # This sets the dates in the date select calendars
46 # If a specific patient, default to 2 years ago.
47 $tmp = date('Y') - 2;
48 $from_date = date("$tmp-m-d");
49 } else {
50 $from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
51 $to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
54 # check box information
55 $chk_show_details = false;
56 if ( $_POST['show_details'] ) {
57 $chk_show_details = true;
60 $chk_show_drug_screens = false;
61 if ( $_POST['show_drug_screens'] ) {
62 $chk_show_drug_screens = true;
65 $chk_show_completed_drug_screens = false;
66 if ( $_POST['show_completed_drug_screens'] ) {
67 $chk_show_completed_drug_screens = true;
70 # end check box information
72 $provider = $_POST['form_provider'];
73 $facility = $_POST['form_facility']; #(CHEMED) facility filter
74 $form_orderby = getComparisonOrder( $_REQUEST['form_orderby'] ) ? $_REQUEST['form_orderby'] : 'date';
75 if ($_POST["form_patient"])
76 $form_patient = isset($_POST['form_patient']) ? $_POST['form_patient'] : '';
77 $form_pid = isset($_POST['form_pid']) ? $_POST['form_pid'] : '';
78 if ($form_patient == '' ) $form_pid = '';
81 <html>
83 <head>
84 <?php html_header_show();?>
86 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
88 <title><?php echo xlt('Patient Flow Board Report'); ?></title>
90 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
91 <script type="text/javascript" src="../../library/textformat.js"></script>
92 <script type="text/javascript" src="../../library/dialog.js"></script>
93 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
95 <script type="text/javascript">
97 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
99 $(document).ready(function() {
100 var win = top.printLogSetup ? top : opener.top;
101 win.printLogSetup(document.getElementById('printbutton'));
104 function dosort(orderby) {
105 var f = document.forms[0];
106 f.form_orderby.value = orderby;
107 f.submit();
108 return false;
111 // CapMinds :: invokes find-patient popup.
112 function sel_patient() {
113 dlgopen('../main/calendar/find_patient_popup.php?pflag=0', '_blank', 500, 400);
116 // CapMinds :: callback by the find-patient popup.
117 function setpatient(pid, lname, fname, dob) {
118 var f = document.theform;
119 f.form_patient.value = lname + ', ' + fname;
120 f.form_pid.value = pid;
124 </script>
126 <style type="text/css">
127 /* specifically include & exclude from printing */
128 @media print {
129 #report_parameters {
130 visibility: hidden;
131 display: none;
133 #report_parameters_daterange {
134 visibility: visible;
135 display: inline;
137 #report_results table {
138 margin-top: 0px;
142 /* specifically exclude some from the screen */
143 @media screen {
144 #report_parameters_daterange {
145 visibility: hidden;
146 display: none;
149 </style>
150 </head>
152 <body class="body_top">
154 <!-- Required for the popup date selectors -->
155 <div id="overDiv"
156 style="position: absolute; visibility: hidden; z-index: 1000;"></div>
157 <?php if ($GLOBALS['drug_screen']) { #setting the title of the page based o if drug screening is enabled ?>
158 <span class='title'><?php echo xlt('Patient Flow Board'); ?> - <?php echo xlt('Drug Screen Report'); ?></span>
159 <?php } else { ?>
160 <span class='title'><?php echo xlt('Patient Flow Board Report'); ?></span>
161 <?php } ?>
164 <div id="report_parameters_daterange"><?php echo date("d F Y", strtotime($from_date)) ." &nbsp; to &nbsp; ". date("d F Y", strtotime($to_date)); #sets date range for calendars ?>
165 </div>
167 <form method='post' name='theform' id='theform' action='patient_flow_board_report.php' onsubmit='return top.restoreSession()'>
169 <div id="report_parameters">
171 <table>
172 <tr>
173 <td width='650px'>
174 <div style='float: left'>
176 <table class='text'>
177 <tr>
178 <td class='label'><?php echo xlt('Facility'); ?>:</td>
179 <td><?php dropdown_facility($facility, 'form_facility'); ?>
180 </td>
181 <td class='label'><?php echo xlt('Provider'); ?>:</td>
182 <td><?php
184 # Build a drop-down list of providers.
187 $query = "SELECT id, lname, fname FROM users WHERE ".
188 "authorized = 1 ORDER BY lname, fname"; #(CHEMED) facility filter
190 $ures = sqlStatement($query);
192 echo " <select name='form_provider'>\n";
193 echo " <option value=''>-- " . xlt('All') . " --\n";
195 while ($urow = sqlFetchArray($ures)) {
196 $provid = $urow['id'];
197 echo " <option value='" . attr($provid) . "'";
198 if ($provid == $_POST['form_provider']) echo " selected";
199 echo ">" . text($urow['lname']) . ", " . text($urow['fname']) . "\n";
202 echo " </select>\n";
204 ?></td>
206 </tr>
208 <tr>
209 <td class='label'><?php echo xlt('From'); ?>:</td>
210 <td><input type='text' name='form_from_date' id="form_from_date"
211 size='10' value='<?php echo attr($from_date) ?>'
212 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
213 title='yyyy-mm-dd'> <img src='../pic/show_calendar.gif'
214 align='absbottom' width='24' height='22' id='img_from_date'
215 border='0' alt='[?]' style='cursor: pointer'
216 title='<?php echo xlt('Click here to choose a date'); ?>'></td>
217 <td class='label'><?php echo xlt('To'); ?>:</td>
218 <td><input type='text' name='form_to_date' id="form_to_date"
219 size='10' value='<?php echo attr($to_date) ?>'
220 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
221 title='yyyy-mm-dd'> <img src='../pic/show_calendar.gif'
222 align='absbottom' width='24' height='22' id='img_to_date'
223 border='0' alt='[?]' style='cursor: pointer'
224 title='<?php echo xlt('Click here to choose a date'); ?>'></td>
225 </tr>
227 <tr>
228 <td class='label'><?php echo xlt('Status'); # status code drop down creation ?>:</td>
229 <td><?php generate_form_field(array('data_type'=>1,'field_id'=>'apptstatus','list_id'=>'apptstat','empty_title'=>'All'),$_POST['form_apptstatus']);?></td>
230 <td><?php echo xlt('Category') #category drop down creation ?>:</td>
231 <td>
232 <select id="form_apptcat" name="form_apptcat">
233 <?php
234 $categories=fetchAppointmentCategories();
235 echo "<option value='ALL'>".xlt("All")."</option>";
236 while($cat=sqlFetchArray($categories))
238 echo "<option value='".attr($cat['id'])."'";
239 if($cat['id']==$_POST['form_apptcat'])
241 echo " selected='true' ";
243 echo ">".text(xl_appt_category($cat['category']))."</option>";
246 </select>
247 </td>
248 </tr>
249 <tr>
250 <td>
251 &nbsp;&nbsp;<span class='text'><?php echo xlt('Patient'); ?>: </span>
252 </td>
253 <td>
254 <input type='text' size='20' name='form_patient' style='width:100%;cursor:pointer;cursor:hand' value='<?php echo attr($form_patient) ? attr($form_patient) : xla('Click To Select'); ?>' onclick='sel_patient()' title='<?php echo xla('Click to select patient'); ?>' />
255 <input type='hidden' name='form_pid' value='<?php echo attr($form_pid); ?>' />
256 </td>
258 <td colspan="2"><label><input type="checkbox" name="show_details" id="show_details" <?php if($chk_show_details) echo "checked";?>>&nbsp;<?php echo xlt('Show Details'); ?></label></td>
259 </tr>
260 <tr>
262 </tr>
263 <?php if ($GLOBALS['drug_screen']) { ?>
264 <tr>
265 <?php # these two selects will are for the drug screen entries the Show Selected for Drug Screens will show all
266 # that have a yes for selected. If you just check the Show Status of Drug Screens all drug screens will be displayed
267 # if both are selected then only completed drug screens will be displayed. ?>
268 <td colspan="2"><label><input type="checkbox" name="show_drug_screens" id="show_drug_screens" <?php if($chk_show_drug_screens) echo "checked";?>>&nbsp;<?php echo xlt('Show Selected for Drug Screens'); ?></label></td>
269 <td colspan="2"><label><input type="checkbox" name="show_completed_drug_screens" id="show_completed_drug_screens" <?php if($chk_show_completed_drug_screens) echo "checked";?>>&nbsp;<?php echo xlt('Show Status of Drug Screens'); ?></label></td>
270 </tr>
271 <?php } ?>
273 </table>
275 </div>
277 </td>
278 <td align='left' valign='middle' height="100%">
279 <table style='border-left: 1px solid; width: 100%; height: 100%'>
280 <tr>
281 <td>
282 <div style='margin-left: 15px'>
283 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
284 <span> <?php echo xlt('Submit'); ?> </span> </a>
285 <?php if ($_POST['form_refresh'] || $_POST['form_orderby'] ) { ?>
286 <a href='#' class='css_button' id='printbutton'>
287 <span> <?php echo xlt('Print'); ?> </span> </a>
288 <?php } ?>
289 </div>
290 </td>
291 </tr>
292 <tr>&nbsp;&nbsp;<?php echo xlt('Most column headers can be clicked to change sort order') ?></tr>
293 </table>
294 </td>
295 </tr>
296 </table>
298 </div>
299 <!-- end of search parameters --> <?php
300 if ($_POST['form_refresh'] || $_POST['form_orderby']) {
302 <div id="report_results">
303 <table>
305 <thead>
306 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
307 <th><a href="nojs.php" onclick="return dosort('doctor')"
308 <?php if ($form_orderby == "doctor") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Provider'); ?>
309 </a></th>
311 <th><a href="nojs.php" onclick="return dosort('date')"
312 <?php if ($form_orderby == "date") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Date'); ?></a>
313 </th>
315 <th><a href="nojs.php" onclick="return dosort('time')"
316 <?php if ($form_orderby == "time") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Time'); ?></a>
317 </th>
319 <th><a href="nojs.php" onclick="return dosort('patient')"
320 <?php if ($form_orderby == "patient") echo " style=\"color:#00cc00\"" ?>>&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
321 </th>
323 <th><a href="nojs.php" onclick="return dosort('pubpid')"
324 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
325 </th>
327 <th><a href="nojs.php" onclick="return dosort('type')"
328 <?php if ($form_orderby == "type") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Type'); ?></a>
329 </th>
331 <?php if ($chk_show_details) { ?>
332 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
333 <?php if ($form_orderby == "trackerstatus") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Status'); ?></a>
334 </th>
335 <?php } else { ?>
336 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
337 <?php if ($form_orderby == "trackerstatus") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Final Status'); ?></a>
338 </th>
339 <?php } ?>
342 <th><?php
343 if ($chk_show_details) { # not sure if Sorting by Arrive Time is useful
344 echo xlt('Start Time');
346 else
348 echo xlt('Arrive Time');
349 }?></th>
351 <th><?php
352 if ($chk_show_details) { # not sure if Sorting by Discharge Time is useful
353 echo xlt('End Time');
355 else
357 echo xlt('Discharge Time');
358 }?></th>
360 <th><?php echo xlt('Total Time'); # not adding Sorting by Total Time yet but can see that it might be useful ?></th>
362 <?php } else { # this section is for the drug screen report ?>
364 <th><a href="nojs.php" onclick="return dosort('doctor')"
365 <?php if ($form_orderby == "doctor") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Provider'); ?>
366 </a></th>
368 <th><a href="nojs.php" onclick="return dosort('date')"
369 <?php if ($form_orderby == "date") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Date'); ?></a>
370 </th>
372 <th><a href="nojs.php" onclick="return dosort('time')"
373 <?php if ($form_orderby == "time") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Time'); ?></a>
374 </th>
376 <th><a href="nojs.php" onclick="return dosort('patient')"
377 <?php if ($form_orderby == "patient") echo " style=\"color:#00cc00\"" ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
378 </th>
380 <?php if (!$chk_show_completed_drug_screens) { ?>
381 <th><a href="nojs.php" onclick="return dosort('pubpid')"
382 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
383 </th>
384 <?php } else { ?>
385 <th><a href="nojs.php" onclick="return dosort('pubpid')"
386 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
387 </th>
388 <?php } ?>
390 <th><?php echo xlt('Drug Screen'); # not sure if Sorting by Drug Screen is useful ?></th>
392 <?php if (!$chk_show_completed_drug_screens) { ?>
393 <th>&nbsp;</th>
394 <?php } else { ?>
395 <th><a href="nojs.php" onclick="return dosort('completed')"
396 <?php if ($form_orderby == "completed") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Completed'); ?></a>
397 </th>
398 <?php } ?>
400 <th></th><th></th><th></th>
402 <?php } ?>
403 </thead>
404 <tbody>
405 <!-- added for better print-ability -->
406 <?php
408 $lastdocname = "";
409 #Appointment Status Checking
410 $form_apptstatus = $_POST['form_apptstatus'];
411 $form_apptcat=null;
412 if(isset($_POST['form_apptcat']))
414 if($form_apptcat!="ALL")
416 $form_apptcat=intval($_POST['form_apptcat']);
420 #Without provider and facility data checking
421 $with_out_provider = null;
422 $with_out_facility = null;
424 # get the appointments also set the trackerboard flag to true (last entry in the fetchAppointments call so we get the tracker stuff)
425 $appointments = fetchAppointments( $from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility,$form_apptcat,true );
426 # sort the appointments by the appointment time
427 $appointments = sortAppointments( $appointments, $form_orderby );
428 # $j is used to count the number of patients that match the selected criteria.
429 $j=0;
430 //print_r2($appointments);
431 foreach ( $appointments as $appointment ) {
432 $patient_id = $appointment['pid'];
433 $tracker_id = $appointment['pt_tracker_id'];
434 $last_seq = $appointment['lastseq'];
435 $docname = $appointment['ulname'] . ', ' . $appointment['ufname'] . ' ' . $appointment['umname'];
436 # only get items with a tracker id.
437 if ($tracker_id == '' ) continue;
438 # only get the drug screens that are set to yes.
439 if ($chk_show_drug_screens ==1 ) {
440 if ($appointment['random_drug_test'] != '1') continue;
442 #if a patient id is entered just get that patient.
443 if (strlen($form_pid) !=0 ) {
444 if ($appointment['pid'] != $form_pid ) continue;
447 $errmsg = "";
448 $newarrive = '';
449 $newend = '';
450 $no_visit = 1;
451 # getting arrive time and end time from the elements file.
452 if ($tracker_id != 0) {
453 $newarrive = collect_checkin($tracker_id);
454 $newend = collect_checkout($tracker_id);
457 if ($newend != '' && $newarrive != '') {
458 $no_visit = 0;
460 $tracker_status = $appointment['status'];
461 # get the time interval for the entire visit. to display seconds add last option of true.
462 # get_Tracker_Time_Interval($newarrive, $newend, true)
463 $timecheck2 = get_Tracker_Time_Interval($newarrive, $newend);
464 # Get the tracker elements.
465 $tracker_elements = collect_Tracker_Elements($tracker_id);
466 # $j is incremented for a patient that made it for display.
467 $j=$j+1;
470 <tr bgcolor='<?php echo $bgcolor ?>'>
471 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
472 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
473 </td>
475 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
476 </td>
478 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
479 </td>
481 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
482 </td>
484 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?>
485 </td>
487 <td class="detail">&nbsp;<?php echo text(xl_appt_category($appointment['pc_catname'])) ?>
488 </td>
490 <td class="detail">
491 <?php
492 //Appointment Status
493 if($chk_show_details) {
494 if($no_visit != 1) {
495 echo xlt('Complete Visit Time');
498 else
500 if($tracker_status != ""){
501 $frow['data_type']=1;
502 $frow['list_id']='apptstat';
503 generate_print_field($frow, $tracker_status);
507 </td>
509 <td class="detail">&nbsp;<?php echo text(substr($newarrive,11)) ?>
510 </td>
512 <td class="detail">&nbsp;<?php echo text(substr($newend,11)) ?>
513 </td>
515 <?php if ($no_visit != 1) { ?>
516 <td class="detail">&nbsp;<?php echo text($timecheck2) ?></td>
517 <?php } else { ?>
518 <td class="detail">&nbsp;</td>
519 <?php } ?>
520 <?php if ($chk_show_details) { # lets show the detail lines
521 $i = '0';
522 $k = '0';
523 for ($x = 1; $x <= $last_seq; $x++) {
525 <tr valign='top' class="detail" >
526 <td colspan="6" class="detail" align='left'>
528 <?php
529 # get the verbiage for the status code
530 $track_stat = $tracker_elements[$i][status];
531 # Get Interval alert time and status color.
532 $colorevents = (collectApptStatusSettings($track_stat));
533 $alert_time = '0';
534 $alert_color = $colorevents['color'];
535 $alert_time = $colorevents['time_alert'];
536 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
538 <td class="detail"><b>
539 <?php } else { ?>
540 <td class="detail">
541 <?php
543 echo getListItemTitle("apptstat",$track_stat);
545 </b></td>
546 <?php
547 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
549 <td class="detail"><b>&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime],11)); ?></b></td>
550 <?php } else { ?>
551 <td class="detail">&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime],11)); ?></td>
552 <?php # figure out the next time of the status
554 $k = $i+1;
555 if($k < $last_seq) {
556 # get the start time of the next status to determine the total time in this status
557 $start_tracker_time = $tracker_elements[$i][start_datetime];
558 $next_tracker_time = $tracker_elements[$k][start_datetime];
560 else
562 # since this is the last status the start and end are equal
563 $start_tracker_time = $tracker_elements[$i][start_datetime];
564 $next_tracker_time = $tracker_elements[$i][start_datetime];
566 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
568 <td class="detail"><b>&nbsp;<?php echo text(substr($next_tracker_time,11)) ?></b></td>
569 <?php } else { ?>
570 <td class="detail">&nbsp;<?php echo text(substr($next_tracker_time,11)) ?></td>
571 <?php # compute the total time of the status
573 $tracker_time = get_Tracker_Time_Interval($start_tracker_time, $next_tracker_time);
574 # add code to alert if over time interval for status
575 $timecheck = round(abs( strtotime($start_tracker_time) - strtotime($next_tracker_time)) / 60,0);
576 if($timecheck > $alert_time && ($alert_time != '0')) {
577 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
579 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'><b>&nbsp;<?php echo text($tracker_time); ?></b></td>
580 <?php } else { ?>
581 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'>&nbsp;<?php echo text($tracker_time); ?></td>
582 <?php } ?>
583 <?php } else { if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block. ?>
584 <td class="detail"><b>&nbsp;<?php echo text($tracker_time); ?></b></td>
585 <?php } else { ?>
586 <td class="detail">&nbsp;<?php echo text($tracker_time); ?></td>
587 <?php
590 $i++;
594 </td>
595 </tr>
597 <?php } else { # this section is for the drug screen report ?>
599 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
600 </td>
602 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
603 </td>
605 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
606 </td>
608 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
609 </td>
611 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?></td>
613 <td class="detail" align = >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($appointment['random_drug_test'] == '1') { echo xlt('Yes'); } else { echo xlt('No'); }?></td>
615 <?php if ($chk_show_completed_drug_screens) { ?>
616 <td class="detail">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($appointment['drug_screen_completed'] == '1') { echo xlt('Yes'); } else { echo xlt('No'); }?></td>
617 <?php } else { ?>
618 <td class="detail">&nbsp; </td>
619 <?php } ?>
621 <?php # these last items are used to complete the screen ?>
622 <td class="detail">&nbsp;</td>
624 <td class="detail">&nbsp;</td>
626 <td class="detail">&nbsp;</td>
627 <?php } ?>
628 </tr>
630 <?php
631 $lastdocname = $docname;
632 } # end for
634 <tr>
635 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # is it Patient Flow Board or Drug screen ?>
636 <td colspan="10" align="left"><?php echo xlt('Total number of Patient Flow Board entries'); ?>&nbsp;<?php echo text($j);?>&nbsp;<?php echo xlt('Patients'); ?></td>
637 <?php } else { ?>
638 <td colspan="10" align="left"><?php echo xlt('Total number of Drug Screen entries'); ?>&nbsp;<?php echo text($j);?>&nbsp;<?php echo xlt('Patients'); ?></td>
639 <?php } ?>
640 </tr>
641 </tbody>
642 </table>
643 </div>
644 <!-- end of search results --> <?php } else { ?>
645 <div class='text'><?php echo xlt('Please input search criteria above, and click Submit to view results.' ); ?>
646 </div>
647 <?php } ?> <input type="hidden" name="form_orderby"
648 value="<?php echo attr($form_orderby) ?>" /> <input type="hidden"
649 name="patient" value="<?php echo attr($patient) ?>" /> <input type='hidden'
650 name='form_refresh' id='form_refresh' value='' /></form>
652 </body>
654 <!-- stuff for the popup calendar -->
655 <style type="text/css">
656 @import url(../../library/dynarch_calendar.css);
657 </style>
658 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
659 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
660 <script type="text/javascript"
661 src="../../library/dynarch_calendar_setup.js"></script>
662 <script type="text/javascript">
663 Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"});
664 Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"});
665 </script>
667 </html>