Highway to PSR2
[openemr.git] / interface / reports / patient_flow_board_report.php
blobb4f3b1e5d43da58251444b5181c3038d5cbbb2f1
1 <?php
2 /*
3 * Patient Flow Board (Patient Tracker) (Report Based on the appointment report)
5 * This program used to select and print the information captured in the Patient Flow Board program ,
6 * allowing the user to select and print the desired information.
8 * Copyright (C) 2015 Terry Hill <terry@lillysystems.com>
9 * Copyright (C) 2017 Brady Miller <brady.g.miller@gmail.com>
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
22 * @package OpenEMR
23 * @author Terry Hill <terry@lilysystems.com>
24 * @author Brady Miller <brady.g.miller@gmail.com>
25 * @link http://www.open-emr.org
30 use OpenEMR\Core\Header;
32 require_once("../globals.php");
33 require_once("../../library/patient.inc");
34 require_once "$srcdir/options.inc.php";
35 require_once "$srcdir/appointments.inc.php";
36 require_once("$srcdir/patient_tracker.inc.php");
38 $patient = $_REQUEST['patient'];
40 if ($patient && ! $_POST['form_from_date']) {
41 # This sets the dates in the date select calendars
42 # If a specific patient, default to 2 years ago.
43 $tmp = date('Y') - 2;
44 $from_date = date("$tmp-m-d");
45 } else {
46 $from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
47 $to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
50 # check box information
51 $chk_show_details = false;
52 if ($_POST['show_details']) {
53 $chk_show_details = true;
56 $chk_show_drug_screens = false;
57 if ($_POST['show_drug_screens']) {
58 $chk_show_drug_screens = true;
61 $chk_show_completed_drug_screens = false;
62 if ($_POST['show_completed_drug_screens']) {
63 $chk_show_completed_drug_screens = true;
66 # end check box information
68 $provider = $_POST['form_provider'];
69 $facility = $_POST['form_facility']; #(CHEMED) facility filter
70 $form_orderby = getComparisonOrder($_REQUEST['form_orderby']) ? $_REQUEST['form_orderby'] : 'date';
71 if ($_POST["form_patient"]) {
72 $form_patient = isset($_POST['form_patient']) ? $_POST['form_patient'] : '';
75 $form_pid = isset($_POST['form_pid']) ? $_POST['form_pid'] : '';
76 if ($form_patient == '') {
77 $form_pid = '';
81 <html>
83 <head>
85 <title><?php echo xlt('Patient Flow Board Report'); ?></title>
87 <?php Header::setupHeader(['datetime-picker', 'report-helper']); ?>
89 <script type="text/javascript">
91 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
93 $(document).ready(function() {
94 var win = top.printLogSetup ? top : opener.top;
95 win.printLogSetup(document.getElementById('printbutton'));
97 $('.datepicker').datetimepicker({
98 <?php $datetimepicker_timepicker = false; ?>
99 <?php $datetimepicker_showseconds = false; ?>
100 <?php $datetimepicker_formatInput = false; ?>
101 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
102 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
106 function dosort(orderby) {
107 var f = document.forms[0];
108 f.form_orderby.value = orderby;
109 f.submit();
110 return false;
113 // CapMinds :: invokes find-patient popup.
114 function sel_patient() {
115 dlgopen('../main/calendar/find_patient_popup.php?pflag=0', '_blank', 500, 400);
118 // CapMinds :: callback by the find-patient popup.
119 function setpatient(pid, lname, fname, dob) {
120 var f = document.theform;
121 f.form_patient.value = lname + ', ' + fname;
122 f.form_pid.value = pid;
126 </script>
128 <style type="text/css">
129 /* specifically include & exclude from printing */
130 @media print {
131 #report_parameters {
132 visibility: hidden;
133 display: none;
135 #report_parameters_daterange {
136 visibility: visible;
137 display: inline;
139 #report_results table {
140 margin-top: 0px;
144 /* specifically exclude some from the screen */
145 @media screen {
146 #report_parameters_daterange {
147 visibility: hidden;
148 display: none;
151 </style>
152 </head>
154 <body class="body_top">
156 <!-- Required for the popup date selectors -->
157 <div id="overDiv"
158 style="position: absolute; visibility: hidden; z-index: 1000;"></div>
159 <?php if ($GLOBALS['drug_screen']) { #setting the title of the page based o if drug screening is enabled ?>
160 <span class='title'><?php echo xlt('Patient Flow Board'); ?> - <?php echo xlt('Drug Screen Report'); ?></span>
161 <?php } else { ?>
162 <span class='title'><?php echo xlt('Patient Flow Board Report'); ?></span>
163 <?php } ?>
166 <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 ?>
167 </div>
169 <form method='post' name='theform' id='theform' action='patient_flow_board_report.php' onsubmit='return top.restoreSession()'>
171 <div id="report_parameters">
173 <table>
174 <tr>
175 <td width='650px'>
176 <div style='float: left'>
178 <table class='text'>
179 <tr>
180 <td class='control-label'><?php echo xlt('Facility'); ?>:</td>
181 <td><?php dropdown_facility($facility, 'form_facility'); ?>
182 </td>
183 <td class='control-label'><?php echo xlt('Provider'); ?>:</td>
184 <td><?php
186 # Build a drop-down list of providers.
189 $query = "SELECT id, lname, fname FROM users WHERE ".
190 "authorized = 1 ORDER BY lname, fname"; #(CHEMED) facility filter
192 $ures = sqlStatement($query);
194 echo " <select name='form_provider' class='form-control'>\n";
195 echo " <option value=''>-- " . xlt('All') . " --\n";
197 while ($urow = sqlFetchArray($ures)) {
198 $provid = $urow['id'];
199 echo " <option value='" . attr($provid) . "'";
200 if ($provid == $_POST['form_provider']) {
201 echo " selected";
204 echo ">" . text($urow['lname']) . ", " . text($urow['fname']) . "\n";
207 echo " </select>\n";
209 ?></td>
211 </tr>
213 <tr>
214 <td class='control-label'><?php echo xlt('From'); ?>:</td>
215 <td><input type='text' name='form_from_date' id="form_from_date"
216 class='datepicker form-control'
217 size='10' value='<?php echo attr($from_date) ?>'
218 title='yyyy-mm-dd'>
219 </td>
220 <td class='control-label'><?php echo xlt('To'); ?>:</td>
221 <td><input type='text' name='form_to_date' id="form_to_date"
222 class='datepicker form-control'
223 size='10' value='<?php echo attr($to_date) ?>'
224 title='yyyy-mm-dd'>
225 </td>
226 </tr>
228 <tr>
229 <td class='control-label'><?php echo xlt('Status'); # status code drop down creation ?>:</td>
230 <td><?php generate_form_field(array('data_type'=>1,'field_id'=>'apptstatus','list_id'=>'apptstat','empty_title'=>'All'), $_POST['form_apptstatus']);?></td>
231 <td><?php echo xlt('Category') #category drop down creation ?>:</td>
232 <td>
233 <select id="form_apptcat" name="form_apptcat" class="form-control">
234 <?php
235 $categories=fetchAppointmentCategories();
236 echo "<option value='ALL'>".xlt("All")."</option>";
237 while ($cat=sqlFetchArray($categories)) {
238 echo "<option value='".attr($cat['id'])."'";
239 if ($cat['id']==$_POST['form_apptcat']) {
240 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' class='form-control' style='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">
259 <div class="checkbox">
260 <label><input type="checkbox" name="show_details" id="show_details" <?php if ($chk_show_details) {
261 echo "checked";
262 }?>>&nbsp;<?php echo xlt('Show Details'); ?></label>
263 </div>
264 </td>
265 </tr>
266 <tr>
268 </tr>
269 <?php if ($GLOBALS['drug_screen']) { ?>
270 <tr>
271 <?php # these two selects will are for the drug screen entries the Show Selected for Drug Screens will show all
272 # that have a yes for selected. If you just check the Show Status of Drug Screens all drug screens will be displayed
273 # if both are selected then only completed drug screens will be displayed. ?>
274 <td colspan="2">
275 <div class="checkbox">
276 <label><input type="checkbox" name="show_drug_screens" id="show_drug_screens" <?php if ($chk_show_drug_screens) {
277 echo "checked";
278 }?>>&nbsp;<?php echo xlt('Show Selected for Drug Screens'); ?></label>
279 </div>
280 </td>
281 <td colspan="2">
282 <div class="checkbox">
283 <label><input type="checkbox" name="show_completed_drug_screens" id="show_completed_drug_screens" <?php if ($chk_show_completed_drug_screens) {
284 echo "checked";
285 }?>>&nbsp;<?php echo xlt('Show Status of Drug Screens'); ?></label>
286 </div>
287 </td>
288 </tr>
289 <?php } ?>
291 </table>
293 </div>
295 </td>
296 <td align='left' valign='middle' height="100%">
297 <table style='border-left: 1px solid; width: 100%; height: 100%'>
298 <tr>
299 <td>
300 <div class="text-center">
301 <div class="btn-group" role="group">
302 <a href='#' class='btn btn-default btn-save' onclick='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
303 <?php echo xlt('Submit'); ?>
304 </a>
305 <?php if ($_POST['form_refresh'] || $_POST['form_orderby']) { ?>
306 <a href='#' class='btn btn-default btn-print' id='printbutton'>
307 <?php echo xlt('Print'); ?>
308 </a>
309 <?php } ?>
310 </div>
311 </div>
312 </td>
313 </tr>
314 <tr>&nbsp;&nbsp;<?php echo xlt('Most column headers can be clicked to change sort order') ?></tr>
315 </table>
316 </td>
317 </tr>
318 </table>
320 </div>
321 <!-- end of search parameters --> <?php
322 if ($_POST['form_refresh'] || $_POST['form_orderby']) {
324 <div id="report_results">
325 <table>
327 <thead>
328 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
329 <th><a href="nojs.php" onclick="return dosort('doctor')"
330 <?php if ($form_orderby == "doctor") {
331 echo " style=\"color:#00cc00\"";
332 } ?>><?php echo xlt('Provider'); ?>
333 </a></th>
335 <th><a href="nojs.php" onclick="return dosort('date')"
336 <?php if ($form_orderby == "date") {
337 echo " style=\"color:#00cc00\"";
338 } ?>><?php echo xlt('Date'); ?></a>
339 </th>
341 <th><a href="nojs.php" onclick="return dosort('time')"
342 <?php if ($form_orderby == "time") {
343 echo " style=\"color:#00cc00\"";
344 } ?>><?php echo xlt('Time'); ?></a>
345 </th>
347 <th><a href="nojs.php" onclick="return dosort('patient')"
348 <?php if ($form_orderby == "patient") {
349 echo " style=\"color:#00cc00\"";
350 } ?>>&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
351 </th>
353 <th><a href="nojs.php" onclick="return dosort('pubpid')"
354 <?php if ($form_orderby == "pubpid") {
355 echo " style=\"color:#00cc00\"";
356 } ?>>&nbsp;<?php echo xlt('ID'); ?></a>
357 </th>
359 <th><a href="nojs.php" onclick="return dosort('type')"
360 <?php if ($form_orderby == "type") {
361 echo " style=\"color:#00cc00\"";
362 } ?>><?php echo xlt('Type'); ?></a>
363 </th>
365 <?php if ($chk_show_details) { ?>
366 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
367 <?php if ($form_orderby == "trackerstatus") {
368 echo " style=\"color:#00cc00\"";
369 } ?>><?php echo xlt('Status'); ?></a>
370 </th>
371 <?php } else { ?>
372 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
373 <?php if ($form_orderby == "trackerstatus") {
374 echo " style=\"color:#00cc00\"";
375 } ?>><?php echo xlt('Final Status'); ?></a>
376 </th>
377 <?php } ?>
380 <th><?php
381 if ($chk_show_details) { # not sure if Sorting by Arrive Time is useful
382 echo xlt('Start Time');
383 } else {
384 echo xlt('Arrive Time');
385 }?></th>
387 <th><?php
388 if ($chk_show_details) { # not sure if Sorting by Discharge Time is useful
389 echo xlt('End Time');
390 } else {
391 echo xlt('Discharge Time');
392 }?></th>
394 <th><?php echo xlt('Total Time'); # not adding Sorting by Total Time yet but can see that it might be useful ?></th>
396 <?php } else { # this section is for the drug screen report ?>
398 <th><a href="nojs.php" onclick="return dosort('doctor')"
399 <?php if ($form_orderby == "doctor") {
400 echo " style=\"color:#00cc00\"";
401 } ?>><?php echo xlt('Provider'); ?>
402 </a></th>
404 <th><a href="nojs.php" onclick="return dosort('date')"
405 <?php if ($form_orderby == "date") {
406 echo " style=\"color:#00cc00\"";
407 } ?>><?php echo xlt('Date'); ?></a>
408 </th>
410 <th><a href="nojs.php" onclick="return dosort('time')"
411 <?php if ($form_orderby == "time") {
412 echo " style=\"color:#00cc00\"";
413 } ?>><?php echo xlt('Time'); ?></a>
414 </th>
416 <th><a href="nojs.php" onclick="return dosort('patient')"
417 <?php if ($form_orderby == "patient") {
418 echo " style=\"color:#00cc00\"";
419 } ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
420 </th>
422 <?php if (!$chk_show_completed_drug_screens) { ?>
423 <th><a href="nojs.php" onclick="return dosort('pubpid')"
424 <?php if ($form_orderby == "pubpid") {
425 echo " style=\"color:#00cc00\"";
426 } ?>>&nbsp;<?php echo xlt('ID'); ?></a>
427 </th>
428 <?php } else { ?>
429 <th><a href="nojs.php" onclick="return dosort('pubpid')"
430 <?php if ($form_orderby == "pubpid") {
431 echo " style=\"color:#00cc00\"";
432 } ?>>&nbsp;<?php echo xlt('ID'); ?></a>
433 </th>
434 <?php } ?>
436 <th><?php echo xlt('Drug Screen'); # not sure if Sorting by Drug Screen is useful ?></th>
438 <?php if (!$chk_show_completed_drug_screens) { ?>
439 <th>&nbsp;</th>
440 <?php } else { ?>
441 <th><a href="nojs.php" onclick="return dosort('completed')"
442 <?php if ($form_orderby == "completed") {
443 echo " style=\"color:#00cc00\"";
444 } ?>><?php echo xlt('Completed'); ?></a>
445 </th>
446 <?php } ?>
448 <th></th><th></th><th></th>
450 <?php } ?>
451 </thead>
452 <tbody>
453 <!-- added for better print-ability -->
454 <?php
456 $lastdocname = "";
457 #Appointment Status Checking
458 $form_apptstatus = $_POST['form_apptstatus'];
459 $form_apptcat=null;
460 if (isset($_POST['form_apptcat'])) {
461 if ($form_apptcat!="ALL") {
462 $form_apptcat=intval($_POST['form_apptcat']);
466 #Without provider and facility data checking
467 $with_out_provider = null;
468 $with_out_facility = null;
470 # get the appointments also set the trackerboard flag to true (last entry in the fetchAppointments call so we get the tracker stuff)
471 $appointments = fetchAppointments($from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility, $form_apptcat, true);
472 # sort the appointments by the appointment time
473 $appointments = sortAppointments($appointments, $form_orderby);
474 # $j is used to count the number of patients that match the selected criteria.
475 $j=0;
476 //print_r2($appointments);
477 foreach ($appointments as $appointment) {
478 $patient_id = $appointment['pid'];
479 $tracker_id = $appointment['pt_tracker_id'];
480 $last_seq = $appointment['lastseq'];
481 $docname = $appointment['ulname'] . ', ' . $appointment['ufname'] . ' ' . $appointment['umname'];
482 # only get items with a tracker id.
483 if ($tracker_id == '') {
484 continue;
487 # only get the drug screens that are set to yes.
488 if ($chk_show_drug_screens ==1) {
489 if ($appointment['random_drug_test'] != '1') {
490 continue;
494 #if a patient id is entered just get that patient.
495 if (strlen($form_pid) !=0) {
496 if ($appointment['pid'] != $form_pid) {
497 continue;
501 $errmsg = "";
502 $newarrive = '';
503 $newend = '';
504 $no_visit = 1;
505 # getting arrive time and end time from the elements file.
506 if ($tracker_id != 0) {
507 $newarrive = collect_checkin($tracker_id);
508 $newend = collect_checkout($tracker_id);
511 if ($newend != '' && $newarrive != '') {
512 $no_visit = 0;
515 $tracker_status = $appointment['status'];
516 # get the time interval for the entire visit. to display seconds add last option of true.
517 # get_Tracker_Time_Interval($newarrive, $newend, true)
518 $timecheck2 = get_Tracker_Time_Interval($newarrive, $newend);
519 # Get the tracker elements.
520 $tracker_elements = collect_Tracker_Elements($tracker_id);
521 # $j is incremented for a patient that made it for display.
522 $j=$j+1;
525 <tr bgcolor='<?php echo $bgcolor ?>'>
526 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
527 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
528 </td>
530 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
531 </td>
533 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
534 </td>
536 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
537 </td>
539 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?>
540 </td>
542 <td class="detail">&nbsp;<?php echo text(xl_appt_category($appointment['pc_catname'])) ?>
543 </td>
545 <td class="detail">
546 <?php
547 //Appointment Status
548 if ($chk_show_details) {
549 if ($no_visit != 1) {
550 echo xlt('Complete Visit Time');
552 } else {
553 if ($tracker_status != "") {
554 $frow['data_type']=1;
555 $frow['list_id']='apptstat';
556 generate_print_field($frow, $tracker_status);
560 </td>
562 <td class="detail">&nbsp;<?php echo text(substr($newarrive, 11)) ?>
563 </td>
565 <td class="detail">&nbsp;<?php echo text(substr($newend, 11)) ?>
566 </td>
568 <?php if ($no_visit != 1) { ?>
569 <td class="detail">&nbsp;<?php echo text($timecheck2) ?></td>
570 <?php } else { ?>
571 <td class="detail">&nbsp;</td>
572 <?php } ?>
573 <?php if ($chk_show_details) { # lets show the detail lines
574 $i = '0';
575 $k = '0';
576 for ($x = 1; $x <= $last_seq; $x++) {
578 <tr valign='top' class="detail" >
579 <td colspan="6" class="detail" align='left'>
581 <?php
582 # get the verbiage for the status code
583 $track_stat = $tracker_elements[$i][status];
584 # Get Interval alert time and status color.
585 $colorevents = (collectApptStatusSettings($track_stat));
586 $alert_time = '0';
587 $alert_color = $colorevents['color'];
588 $alert_time = $colorevents['time_alert'];
589 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
591 <td class="detail"><b>
592 <?php
593 } else { ?>
594 <td class="detail">
595 <?php
598 echo getListItemTitle("apptstat", $track_stat);
600 </b></td>
601 <?php
602 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
604 <td class="detail"><b>&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime], 11)); ?></b></td>
605 <?php
606 } else { ?>
607 <td class="detail">&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime], 11)); ?></td>
608 <?php # figure out the next time of the status
611 $k = $i+1;
612 if ($k < $last_seq) {
613 # get the start time of the next status to determine the total time in this status
614 $start_tracker_time = $tracker_elements[$i][start_datetime];
615 $next_tracker_time = $tracker_elements[$k][start_datetime];
616 } else {
617 # since this is the last status the start and end are equal
618 $start_tracker_time = $tracker_elements[$i][start_datetime];
619 $next_tracker_time = $tracker_elements[$i][start_datetime];
622 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block. ?>
623 <td class="detail"><b>&nbsp;<?php echo text(substr($next_tracker_time, 11)) ?></b></td><?php
624 } else { ?>
625 <td class="detail">&nbsp;<?php echo text(substr($next_tracker_time, 11)) ?></td>
626 <?php # compute the total time of the status
629 $tracker_time = get_Tracker_Time_Interval($start_tracker_time, $next_tracker_time);
630 # add code to alert if over time interval for status
631 $timecheck = round(abs(strtotime($start_tracker_time) - strtotime($next_tracker_time)) / 60, 0);
632 if ($timecheck > $alert_time && ($alert_time != '0')) {
633 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block. ?>
634 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'><b>&nbsp;<?php echo text($tracker_time); ?></b></td><?php
635 } else { ?>
636 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'>&nbsp;<?php echo text($tracker_time); ?></td><?php
638 } else {
639 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block. ?>
640 <td class="detail"><b>&nbsp;<?php echo text($tracker_time); ?></b></td><?php
641 } else { ?>
642 <td class="detail">&nbsp;<?php echo text($tracker_time); ?></td><?php
646 $i++;
650 </td>
651 </tr>
653 <?php } else { # this section is for the drug screen report ?>
655 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
656 </td>
658 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
659 </td>
661 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
662 </td>
664 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
665 </td>
667 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?></td>
669 <td class="detail" align = >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($appointment['random_drug_test'] == '1') {
670 echo xlt('Yes');
671 } else {
672 echo xlt('No');
673 }?></td>
675 <?php if ($chk_show_completed_drug_screens) { ?>
676 <td class="detail">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($appointment['drug_screen_completed'] == '1') {
677 echo xlt('Yes');
678 } else {
679 echo xlt('No');
680 }?></td>
681 <?php } else { ?>
682 <td class="detail">&nbsp; </td>
683 <?php } ?>
685 <?php # these last items are used to complete the screen ?>
686 <td class="detail">&nbsp;</td>
688 <td class="detail">&nbsp;</td>
690 <td class="detail">&nbsp;</td>
691 <?php } ?>
692 </tr>
694 <?php
695 $lastdocname = $docname;
696 } # end for
698 <tr>
699 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # is it Patient Flow Board or Drug screen ?>
700 <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>
701 <?php } else { ?>
702 <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>
703 <?php } ?>
704 </tr>
705 </tbody>
706 </table>
707 </div>
708 <!-- end of search results --> <?php } else { ?>
709 <div class='text'><?php echo xlt('Please input search criteria above, and click Submit to view results.'); ?>
710 </div>
711 <?php } ?> <input type="hidden" name="form_orderby"
712 value="<?php echo attr($form_orderby) ?>" /> <input type="hidden"
713 name="patient" value="<?php echo attr($patient) ?>" /> <input type='hidden'
714 name='form_refresh' id='form_refresh' value='' /></form>
716 </body>
718 </html>