migrated ubiquitous libraries to composer autoloader (#421)
[openemr.git] / interface / reports / patient_flow_board_report.php
blob5574f7bc2ae5767c02fd597d6f7e96d1e7db9aa0
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/appointments.inc.php";
39 require_once("$srcdir/patient_tracker.inc.php");
41 $patient = $_REQUEST['patient'];
43 if ($patient && ! $_POST['form_from_date']) {
44 # This sets the dates in the date select calendars
45 # If a specific patient, default to 2 years ago.
46 $tmp = date('Y') - 2;
47 $from_date = date("$tmp-m-d");
48 } else {
49 $from_date = fixDate($_POST['form_from_date'], date('Y-m-d'));
50 $to_date = fixDate($_POST['form_to_date'], date('Y-m-d'));
53 # check box information
54 $chk_show_details = false;
55 if ( $_POST['show_details'] ) {
56 $chk_show_details = true;
59 $chk_show_drug_screens = false;
60 if ( $_POST['show_drug_screens'] ) {
61 $chk_show_drug_screens = true;
64 $chk_show_completed_drug_screens = false;
65 if ( $_POST['show_completed_drug_screens'] ) {
66 $chk_show_completed_drug_screens = true;
69 # end check box information
71 $provider = $_POST['form_provider'];
72 $facility = $_POST['form_facility']; #(CHEMED) facility filter
73 $form_orderby = getComparisonOrder( $_REQUEST['form_orderby'] ) ? $_REQUEST['form_orderby'] : 'date';
74 if ($_POST["form_patient"])
75 $form_patient = isset($_POST['form_patient']) ? $_POST['form_patient'] : '';
76 $form_pid = isset($_POST['form_pid']) ? $_POST['form_pid'] : '';
77 if ($form_patient == '' ) $form_pid = '';
80 <html>
82 <head>
83 <?php html_header_show();?>
85 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
87 <title><?php echo xlt('Patient Flow Board Report'); ?></title>
89 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
90 <script type="text/javascript" src="../../library/textformat.js"></script>
91 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
92 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
94 <script type="text/javascript">
96 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
98 $(document).ready(function() {
99 var win = top.printLogSetup ? top : opener.top;
100 win.printLogSetup(document.getElementById('printbutton'));
103 function dosort(orderby) {
104 var f = document.forms[0];
105 f.form_orderby.value = orderby;
106 f.submit();
107 return false;
110 // CapMinds :: invokes find-patient popup.
111 function sel_patient() {
112 dlgopen('../main/calendar/find_patient_popup.php?pflag=0', '_blank', 500, 400);
115 // CapMinds :: callback by the find-patient popup.
116 function setpatient(pid, lname, fname, dob) {
117 var f = document.theform;
118 f.form_patient.value = lname + ', ' + fname;
119 f.form_pid.value = pid;
123 </script>
125 <style type="text/css">
126 /* specifically include & exclude from printing */
127 @media print {
128 #report_parameters {
129 visibility: hidden;
130 display: none;
132 #report_parameters_daterange {
133 visibility: visible;
134 display: inline;
136 #report_results table {
137 margin-top: 0px;
141 /* specifically exclude some from the screen */
142 @media screen {
143 #report_parameters_daterange {
144 visibility: hidden;
145 display: none;
148 </style>
149 </head>
151 <body class="body_top">
153 <!-- Required for the popup date selectors -->
154 <div id="overDiv"
155 style="position: absolute; visibility: hidden; z-index: 1000;"></div>
156 <?php if ($GLOBALS['drug_screen']) { #setting the title of the page based o if drug screening is enabled ?>
157 <span class='title'><?php echo xlt('Patient Flow Board'); ?> - <?php echo xlt('Drug Screen Report'); ?></span>
158 <?php } else { ?>
159 <span class='title'><?php echo xlt('Patient Flow Board Report'); ?></span>
160 <?php } ?>
163 <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 ?>
164 </div>
166 <form method='post' name='theform' id='theform' action='patient_flow_board_report.php' onsubmit='return top.restoreSession()'>
168 <div id="report_parameters">
170 <table>
171 <tr>
172 <td width='650px'>
173 <div style='float: left'>
175 <table class='text'>
176 <tr>
177 <td class='label'><?php echo xlt('Facility'); ?>:</td>
178 <td><?php dropdown_facility($facility, 'form_facility'); ?>
179 </td>
180 <td class='label'><?php echo xlt('Provider'); ?>:</td>
181 <td><?php
183 # Build a drop-down list of providers.
186 $query = "SELECT id, lname, fname FROM users WHERE ".
187 "authorized = 1 ORDER BY lname, fname"; #(CHEMED) facility filter
189 $ures = sqlStatement($query);
191 echo " <select name='form_provider'>\n";
192 echo " <option value=''>-- " . xlt('All') . " --\n";
194 while ($urow = sqlFetchArray($ures)) {
195 $provid = $urow['id'];
196 echo " <option value='" . attr($provid) . "'";
197 if ($provid == $_POST['form_provider']) echo " selected";
198 echo ">" . text($urow['lname']) . ", " . text($urow['fname']) . "\n";
201 echo " </select>\n";
203 ?></td>
205 </tr>
207 <tr>
208 <td class='label'><?php echo xlt('From'); ?>:</td>
209 <td><input type='text' name='form_from_date' id="form_from_date"
210 size='10' value='<?php echo attr($from_date) ?>'
211 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
212 title='yyyy-mm-dd'> <img src='../pic/show_calendar.gif'
213 align='absbottom' width='24' height='22' id='img_from_date'
214 border='0' alt='[?]' style='cursor: pointer'
215 title='<?php echo xlt('Click here to choose a date'); ?>'></td>
216 <td class='label'><?php echo xlt('To'); ?>:</td>
217 <td><input type='text' name='form_to_date' id="form_to_date"
218 size='10' value='<?php echo attr($to_date) ?>'
219 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
220 title='yyyy-mm-dd'> <img src='../pic/show_calendar.gif'
221 align='absbottom' width='24' height='22' id='img_to_date'
222 border='0' alt='[?]' style='cursor: pointer'
223 title='<?php echo xlt('Click here to choose a date'); ?>'></td>
224 </tr>
226 <tr>
227 <td class='label'><?php echo xlt('Status'); # status code drop down creation ?>:</td>
228 <td><?php generate_form_field(array('data_type'=>1,'field_id'=>'apptstatus','list_id'=>'apptstat','empty_title'=>'All'),$_POST['form_apptstatus']);?></td>
229 <td><?php echo xlt('Category') #category drop down creation ?>:</td>
230 <td>
231 <select id="form_apptcat" name="form_apptcat">
232 <?php
233 $categories=fetchAppointmentCategories();
234 echo "<option value='ALL'>".xlt("All")."</option>";
235 while($cat=sqlFetchArray($categories))
237 echo "<option value='".attr($cat['id'])."'";
238 if($cat['id']==$_POST['form_apptcat'])
240 echo " selected='true' ";
242 echo ">".text(xl_appt_category($cat['category']))."</option>";
245 </select>
246 </td>
247 </tr>
248 <tr>
249 <td>
250 &nbsp;&nbsp;<span class='text'><?php echo xlt('Patient'); ?>: </span>
251 </td>
252 <td>
253 <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'); ?>' />
254 <input type='hidden' name='form_pid' value='<?php echo attr($form_pid); ?>' />
255 </td>
257 <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>
258 </tr>
259 <tr>
261 </tr>
262 <?php if ($GLOBALS['drug_screen']) { ?>
263 <tr>
264 <?php # these two selects will are for the drug screen entries the Show Selected for Drug Screens will show all
265 # that have a yes for selected. If you just check the Show Status of Drug Screens all drug screens will be displayed
266 # if both are selected then only completed drug screens will be displayed. ?>
267 <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>
268 <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>
269 </tr>
270 <?php } ?>
272 </table>
274 </div>
276 </td>
277 <td align='left' valign='middle' height="100%">
278 <table style='border-left: 1px solid; width: 100%; height: 100%'>
279 <tr>
280 <td>
281 <div style='margin-left: 15px'>
282 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
283 <span> <?php echo xlt('Submit'); ?> </span> </a>
284 <?php if ($_POST['form_refresh'] || $_POST['form_orderby'] ) { ?>
285 <a href='#' class='css_button' id='printbutton'>
286 <span> <?php echo xlt('Print'); ?> </span> </a>
287 <?php } ?>
288 </div>
289 </td>
290 </tr>
291 <tr>&nbsp;&nbsp;<?php echo xlt('Most column headers can be clicked to change sort order') ?></tr>
292 </table>
293 </td>
294 </tr>
295 </table>
297 </div>
298 <!-- end of search parameters --> <?php
299 if ($_POST['form_refresh'] || $_POST['form_orderby']) {
301 <div id="report_results">
302 <table>
304 <thead>
305 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
306 <th><a href="nojs.php" onclick="return dosort('doctor')"
307 <?php if ($form_orderby == "doctor") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Provider'); ?>
308 </a></th>
310 <th><a href="nojs.php" onclick="return dosort('date')"
311 <?php if ($form_orderby == "date") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Date'); ?></a>
312 </th>
314 <th><a href="nojs.php" onclick="return dosort('time')"
315 <?php if ($form_orderby == "time") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Time'); ?></a>
316 </th>
318 <th><a href="nojs.php" onclick="return dosort('patient')"
319 <?php if ($form_orderby == "patient") echo " style=\"color:#00cc00\"" ?>>&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
320 </th>
322 <th><a href="nojs.php" onclick="return dosort('pubpid')"
323 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
324 </th>
326 <th><a href="nojs.php" onclick="return dosort('type')"
327 <?php if ($form_orderby == "type") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Type'); ?></a>
328 </th>
330 <?php if ($chk_show_details) { ?>
331 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
332 <?php if ($form_orderby == "trackerstatus") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Status'); ?></a>
333 </th>
334 <?php } else { ?>
335 <th><a href="nojs.php" onclick="return dosort('trackerstatus')"
336 <?php if ($form_orderby == "trackerstatus") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Final Status'); ?></a>
337 </th>
338 <?php } ?>
341 <th><?php
342 if ($chk_show_details) { # not sure if Sorting by Arrive Time is useful
343 echo xlt('Start Time');
345 else
347 echo xlt('Arrive Time');
348 }?></th>
350 <th><?php
351 if ($chk_show_details) { # not sure if Sorting by Discharge Time is useful
352 echo xlt('End Time');
354 else
356 echo xlt('Discharge Time');
357 }?></th>
359 <th><?php echo xlt('Total Time'); # not adding Sorting by Total Time yet but can see that it might be useful ?></th>
361 <?php } else { # this section is for the drug screen report ?>
363 <th><a href="nojs.php" onclick="return dosort('doctor')"
364 <?php if ($form_orderby == "doctor") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Provider'); ?>
365 </a></th>
367 <th><a href="nojs.php" onclick="return dosort('date')"
368 <?php if ($form_orderby == "date") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Date'); ?></a>
369 </th>
371 <th><a href="nojs.php" onclick="return dosort('time')"
372 <?php if ($form_orderby == "time") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Time'); ?></a>
373 </th>
375 <th><a href="nojs.php" onclick="return dosort('patient')"
376 <?php if ($form_orderby == "patient") echo " style=\"color:#00cc00\"" ?>>&nbsp;&nbsp;&nbsp;&nbsp;<?php echo xlt('Patient'); ?></a>
377 </th>
379 <?php if (!$chk_show_completed_drug_screens) { ?>
380 <th><a href="nojs.php" onclick="return dosort('pubpid')"
381 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
382 </th>
383 <?php } else { ?>
384 <th><a href="nojs.php" onclick="return dosort('pubpid')"
385 <?php if ($form_orderby == "pubpid") echo " style=\"color:#00cc00\"" ?>>&nbsp;<?php echo xlt('ID'); ?></a>
386 </th>
387 <?php } ?>
389 <th><?php echo xlt('Drug Screen'); # not sure if Sorting by Drug Screen is useful ?></th>
391 <?php if (!$chk_show_completed_drug_screens) { ?>
392 <th>&nbsp;</th>
393 <?php } else { ?>
394 <th><a href="nojs.php" onclick="return dosort('completed')"
395 <?php if ($form_orderby == "completed") echo " style=\"color:#00cc00\"" ?>><?php echo xlt('Completed'); ?></a>
396 </th>
397 <?php } ?>
399 <th></th><th></th><th></th>
401 <?php } ?>
402 </thead>
403 <tbody>
404 <!-- added for better print-ability -->
405 <?php
407 $lastdocname = "";
408 #Appointment Status Checking
409 $form_apptstatus = $_POST['form_apptstatus'];
410 $form_apptcat=null;
411 if(isset($_POST['form_apptcat']))
413 if($form_apptcat!="ALL")
415 $form_apptcat=intval($_POST['form_apptcat']);
419 #Without provider and facility data checking
420 $with_out_provider = null;
421 $with_out_facility = null;
423 # get the appointments also set the trackerboard flag to true (last entry in the fetchAppointments call so we get the tracker stuff)
424 $appointments = fetchAppointments( $from_date, $to_date, $patient, $provider, $facility, $form_apptstatus, $with_out_provider, $with_out_facility,$form_apptcat,true );
425 # sort the appointments by the appointment time
426 $appointments = sortAppointments( $appointments, $form_orderby );
427 # $j is used to count the number of patients that match the selected criteria.
428 $j=0;
429 //print_r2($appointments);
430 foreach ( $appointments as $appointment ) {
431 $patient_id = $appointment['pid'];
432 $tracker_id = $appointment['pt_tracker_id'];
433 $last_seq = $appointment['lastseq'];
434 $docname = $appointment['ulname'] . ', ' . $appointment['ufname'] . ' ' . $appointment['umname'];
435 # only get items with a tracker id.
436 if ($tracker_id == '' ) continue;
437 # only get the drug screens that are set to yes.
438 if ($chk_show_drug_screens ==1 ) {
439 if ($appointment['random_drug_test'] != '1') continue;
441 #if a patient id is entered just get that patient.
442 if (strlen($form_pid) !=0 ) {
443 if ($appointment['pid'] != $form_pid ) continue;
446 $errmsg = "";
447 $newarrive = '';
448 $newend = '';
449 $no_visit = 1;
450 # getting arrive time and end time from the elements file.
451 if ($tracker_id != 0) {
452 $newarrive = collect_checkin($tracker_id);
453 $newend = collect_checkout($tracker_id);
456 if ($newend != '' && $newarrive != '') {
457 $no_visit = 0;
459 $tracker_status = $appointment['status'];
460 # get the time interval for the entire visit. to display seconds add last option of true.
461 # get_Tracker_Time_Interval($newarrive, $newend, true)
462 $timecheck2 = get_Tracker_Time_Interval($newarrive, $newend);
463 # Get the tracker elements.
464 $tracker_elements = collect_Tracker_Elements($tracker_id);
465 # $j is incremented for a patient that made it for display.
466 $j=$j+1;
469 <tr bgcolor='<?php echo $bgcolor ?>'>
470 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # the first part of this block is for the Patient Flow Board report ?>
471 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
472 </td>
474 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
475 </td>
477 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
478 </td>
480 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
481 </td>
483 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?>
484 </td>
486 <td class="detail">&nbsp;<?php echo text(xl_appt_category($appointment['pc_catname'])) ?>
487 </td>
489 <td class="detail">
490 <?php
491 //Appointment Status
492 if($chk_show_details) {
493 if($no_visit != 1) {
494 echo xlt('Complete Visit Time');
497 else
499 if($tracker_status != ""){
500 $frow['data_type']=1;
501 $frow['list_id']='apptstat';
502 generate_print_field($frow, $tracker_status);
506 </td>
508 <td class="detail">&nbsp;<?php echo text(substr($newarrive,11)) ?>
509 </td>
511 <td class="detail">&nbsp;<?php echo text(substr($newend,11)) ?>
512 </td>
514 <?php if ($no_visit != 1) { ?>
515 <td class="detail">&nbsp;<?php echo text($timecheck2) ?></td>
516 <?php } else { ?>
517 <td class="detail">&nbsp;</td>
518 <?php } ?>
519 <?php if ($chk_show_details) { # lets show the detail lines
520 $i = '0';
521 $k = '0';
522 for ($x = 1; $x <= $last_seq; $x++) {
524 <tr valign='top' class="detail" >
525 <td colspan="6" class="detail" align='left'>
527 <?php
528 # get the verbiage for the status code
529 $track_stat = $tracker_elements[$i][status];
530 # Get Interval alert time and status color.
531 $colorevents = (collectApptStatusSettings($track_stat));
532 $alert_time = '0';
533 $alert_color = $colorevents['color'];
534 $alert_time = $colorevents['time_alert'];
535 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
537 <td class="detail"><b>
538 <?php } else { ?>
539 <td class="detail">
540 <?php
542 echo getListItemTitle("apptstat",$track_stat);
544 </b></td>
545 <?php
546 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
548 <td class="detail"><b>&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime],11)); ?></b></td>
549 <?php } else { ?>
550 <td class="detail">&nbsp;<?php echo text(substr($tracker_elements[$i][start_datetime],11)); ?></td>
551 <?php # figure out the next time of the status
553 $k = $i+1;
554 if($k < $last_seq) {
555 # get the start time of the next status to determine the total time in this status
556 $start_tracker_time = $tracker_elements[$i][start_datetime];
557 $next_tracker_time = $tracker_elements[$k][start_datetime];
559 else
561 # since this is the last status the start and end are equal
562 $start_tracker_time = $tracker_elements[$i][start_datetime];
563 $next_tracker_time = $tracker_elements[$i][start_datetime];
565 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
567 <td class="detail"><b>&nbsp;<?php echo text(substr($next_tracker_time,11)) ?></b></td>
568 <?php } else { ?>
569 <td class="detail">&nbsp;<?php echo text(substr($next_tracker_time,11)) ?></td>
570 <?php # compute the total time of the status
572 $tracker_time = get_Tracker_Time_Interval($start_tracker_time, $next_tracker_time);
573 # add code to alert if over time interval for status
574 $timecheck = round(abs( strtotime($start_tracker_time) - strtotime($next_tracker_time)) / 60,0);
575 if($timecheck > $alert_time && ($alert_time != '0')) {
576 if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block.
578 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'><b>&nbsp;<?php echo text($tracker_time); ?></b></td>
579 <?php } else { ?>
580 <td class="detail" bgcolor='<?php echo attr($alert_color) ?>'>&nbsp;<?php echo text($tracker_time); ?></td>
581 <?php } ?>
582 <?php } else { if (is_checkin($track_stat) || is_checkout($track_stat)) { #bold the check in and check out times in this block. ?>
583 <td class="detail"><b>&nbsp;<?php echo text($tracker_time); ?></b></td>
584 <?php } else { ?>
585 <td class="detail">&nbsp;<?php echo text($tracker_time); ?></td>
586 <?php
589 $i++;
593 </td>
594 </tr>
596 <?php } else { # this section is for the drug screen report ?>
598 <td class="detail">&nbsp;<?php echo ($docname == $lastdocname) ? "" : $docname ?>
599 </td>
601 <td class="detail"><?php echo text(oeFormatShortDate($appointment['pc_eventDate'])) ?>
602 </td>
604 <td class="detail"><?php echo text(oeFormatTime($appointment['pc_startTime'])) ?>
605 </td>
607 <td class="detail">&nbsp;<?php echo text($appointment['fname'] . " " . $appointment['lname']) ?>
608 </td>
610 <td class="detail">&nbsp;<?php echo text($appointment['pubpid']) ?></td>
612 <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>
614 <?php if ($chk_show_completed_drug_screens) { ?>
615 <td class="detail">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if ($appointment['drug_screen_completed'] == '1') { echo xlt('Yes'); } else { echo xlt('No'); }?></td>
616 <?php } else { ?>
617 <td class="detail">&nbsp; </td>
618 <?php } ?>
620 <?php # these last items are used to complete the screen ?>
621 <td class="detail">&nbsp;</td>
623 <td class="detail">&nbsp;</td>
625 <td class="detail">&nbsp;</td>
626 <?php } ?>
627 </tr>
629 <?php
630 $lastdocname = $docname;
631 } # end for
633 <tr>
634 <?php if (!$chk_show_drug_screens && !$chk_show_completed_drug_screens) { # is it Patient Flow Board or Drug screen ?>
635 <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>
636 <?php } else { ?>
637 <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>
638 <?php } ?>
639 </tr>
640 </tbody>
641 </table>
642 </div>
643 <!-- end of search results --> <?php } else { ?>
644 <div class='text'><?php echo xlt('Please input search criteria above, and click Submit to view results.' ); ?>
645 </div>
646 <?php } ?> <input type="hidden" name="form_orderby"
647 value="<?php echo attr($form_orderby) ?>" /> <input type="hidden"
648 name="patient" value="<?php echo attr($patient) ?>" /> <input type='hidden'
649 name='form_refresh' id='form_refresh' value='' /></form>
651 </body>
653 <!-- stuff for the popup calendar -->
654 <style type="text/css">
655 @import url(../../library/dynarch_calendar.css);
656 </style>
657 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
658 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
659 <script type="text/javascript"
660 src="../../library/dynarch_calendar_setup.js"></script>
661 <script type="text/javascript">
662 Calendar.setup({inputField:"form_from_date", ifFormat:"%Y-%m-%d", button:"img_from_date"});
663 Calendar.setup({inputField:"form_to_date", ifFormat:"%Y-%m-%d", button:"img_to_date"});
664 </script>
666 </html>