bug fixes (#1978)
[openemr.git] / interface / patient_tracker / patient_tracker.php
bloba7600fb500f88d1d3a1c196c53ad412733aeb94f
1 <?php
2 /**
3 * Patient Tracker (Patient Flow Board)
5 * This program displays the information entered in the Calendar program ,
6 * allowing the user to change status and view those changed here and in the Calendar
7 * Will allow the collection of length of time spent in each status
9 * @package OpenEMR
10 * @link http://www.open-emr.org
11 * @author Terry Hill <terry@lilysystems.com>
12 * @author Brady Miller <brady.g.miller@gmail.com>
13 * @author Ray Magauran <magauran@medexbank.com>
14 * @copyright Copyright (c) 2015-2017 Terry Hill <terry@lillysystems.com>
15 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
16 * @copyright Copyright (c) 2017 Ray Magauran <magauran@medexbank.com>
17 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
20 require_once "../globals.php";
21 require_once "$srcdir/patient.inc";
22 require_once "$srcdir/options.inc.php";
23 require_once "$srcdir/patient_tracker.inc.php";
24 require_once "$srcdir/user.inc";
25 require_once "$srcdir/MedEx/API.php";
27 use OpenEMR\Core\Header;
29 if (!empty($_POST)) {
30 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
31 csrfNotVerified();
35 // These settings are sticky user preferences linked to a given page.
36 // mdsupport - user_settings prefix
37 $uspfx = substr(__FILE__, strlen($webserver_root)) . '.';
38 $setting_new_window = prevSetting($uspfx, 'setting_new_window', 'setting_new_window', ' ');
39 // flow board and recall board share bootstrap settings:
40 $setting_bootstrap_submenu = prevSetting('', 'setting_bootstrap_submenu', 'setting_bootstrap_submenu', ' ');
41 $setting_selectors = prevSetting($uspfx, 'setting_selectors', 'setting_selectors', 'block');
42 $form_apptcat = prevSetting($uspfx, 'form_apptcat', 'form_apptcat', '');
43 $form_apptstatus = prevSetting($uspfx, 'form_apptstatus', 'form_apptstatus', '');
44 $facility = prevSetting($uspfx, 'form_facility', 'form_facility', '');
45 $provider = prevSetting($uspfx, 'form_provider', 'form_provider', $_SESSION['authUserID']);
47 if (($_POST['setting_new_window']) ||
48 ($_POST['setting_bootstrap_submenu']) ||
49 ($_POST['setting_selectors'])) {
50 // These are not form elements. We only ever change them via ajax, so exit now.
51 exit();
53 if ($_POST['saveCALLback'] == "Save") {
54 $sqlINSERT = "INSERT INTO medex_outgoing (msg_pc_eid,msg_pid,campaign_uid,msg_type,msg_reply,msg_extra_text)
55 VALUES
56 (?,?,?,'NOTES','CALLED',?)";
57 sqlQuery($sqlINSERT, array($_POST['pc_eid'], $_POST['pc_pid'], $_POST['campaign_uid'], $_POST['txtCALLback']));
60 //set default start date of flow board to value based on globals
61 if (!$GLOBALS['ptkr_date_range']) {
62 $from_date = date('Y-m-d');
63 } elseif (!is_null($_REQUEST['form_from_date'])) {
64 $from_date = DateToYYYYMMDD($_REQUEST['form_from_date']);
65 } elseif (($GLOBALS['ptkr_start_date'])=='D0') {
66 $from_date = date('Y-m-d');
67 } elseif (($GLOBALS['ptkr_start_date'])=='B0') {
68 if (date(w)==GLOBALS['first_day_week']) {
69 //today is the first day of the week
70 $from_date = date('Y-m-d');
71 } elseif ($GLOBALS['first_day_week']==0) {
72 //Sunday
73 $from_date = date('Y-m-d', strtotime('previous sunday'));
74 } elseif ($GLOBALS['first_day_week']==1) {
75 //Monday
76 $from_date = date('Y-m-d', strtotime('previous monday'));
77 } elseif ($GLOBALS['first_day_week']==6) {
78 //Saturday
79 $from_date = date('Y-m-d', strtotime('previous saturday'));
81 } else {
82 //shouldnt be able to get here...
83 $from_date = date('Y-m-d');
86 //set default end date of flow board to value based on globals
87 if ($GLOBALS['ptkr_date_range']) {
88 if (substr($GLOBALS['ptkr_end_date'], 0, 1) == 'Y') {
89 $ptkr_time = substr($GLOBALS['ptkr_end_date'], 1, 1);
90 $ptkr_future_time = mktime(0, 0, 0, date('m'), date('d'), date('Y') + $ptkr_time);
91 } elseif (substr($GLOBALS['ptkr_end_date'], 0, 1) == 'M') {
92 $ptkr_time = substr($GLOBALS['ptkr_end_date'], 1, 1);
93 $ptkr_future_time = mktime(0, 0, 0, date('m') + $ptkr_time, date('d'), date('Y'));
94 } elseif (substr($GLOBALS['ptkr_end_date'], 0, 1) == 'D') {
95 $ptkr_time = substr($GLOBALS['ptkr_end_date'], 1, 1);
96 $ptkr_future_time = mktime(0, 0, 0, date('m'), date('d') + $ptkr_time, date('Y'));
99 $to_date = date('Y-m-d', $ptkr_future_time);
100 $to_date = !is_null($_REQUEST['form_to_date']) ? DateToYYYYMMDD($_REQUEST['form_to_date']) : $to_date;
101 } else {
102 $to_date = date('Y-m-d');
105 $form_patient_name = !is_null($_POST['form_patient_name']) ? $_POST['form_patient_name'] : null;
106 $form_patient_id = !is_null($_POST['form_patient_id']) ? $_POST['form_patient_id'] : null;
109 $lres = sqlStatement("SELECT option_id, title FROM list_options WHERE list_id = ? AND activity=1", array('apptstat'));
110 while ($lrow = sqlFetchArray($lres)) {
111 // if exists, remove the legend character
112 if ($lrow['title'][1] == ' ') {
113 $splitTitle = explode(' ', $lrow['title']);
114 array_shift($splitTitle);
115 $title = implode(' ', $splitTitle);
116 } else {
117 $title = $lrow['title'];
119 $statuses_list[$lrow['option_id']] = $title;
122 if ($GLOBALS['medex_enable'] == '1') {
123 $query2 = "SELECT * FROM medex_icons";
124 $iconed = sqlStatement($query2);
125 while ($icon = sqlFetchArray($iconed)) {
126 $icons[$icon['msg_type']][$icon['msg_status']]['html'] = $icon['i_html'];
128 $MedEx = new MedExApi\MedEx('MedExBank.com');
129 $sql = "SELECT * FROM medex_prefs LIMIT 1";
130 $preferences = sqlStatement($sql);
131 $prefs = sqlFetchArray($preferences);
132 $results = json_decode($prefs['status'], true);
133 $logged_in=$results;
134 if (!empty($prefs)) {
135 foreach ($results['campaigns']['events'] as $event) {
136 if ($event['M_group'] != 'REMINDER') {
137 continue;
139 $icon = $icons[$event['M_type']]['SCHEDULED']['html'];
140 if ($event['E_timing'] == '1') {
141 $action = xl("before");
143 if ($event['E_timing'] == '2') {
144 $action = xl("before (PM)");
146 if ($event['E_timing'] == '3') {
147 $action = xl("after");
149 if ($event['E_timing'] == '4') {
150 $action = xl("after (PM)");
152 $days = ($event['E_fire_time'] == '1') ? xl("day") : xl("days");
153 $current_events .= $icon . " &nbsp; " . (int)$event['E_fire_time'] . " " . text($days) . " " . text($action) . "<br />";
155 } else {
156 $current_events = $icons['SMS']['FAILED']['html'] . " " . xlt("Currently off-line");
160 if (!$_REQUEST['flb_table']) {
162 <html>
163 <head>
164 <title><?php echo xlt('Flow Board'); ?></title>
166 <?php Header::setupHeader(['datetime-picker', 'jquery-ui', 'jquery-ui-cupertino', 'opener', 'pure']); ?>
168 <script type="text/javascript">
169 <?php require_once "$srcdir/restoreSession.php"; ?>
170 </script>
172 <link rel="stylesheet" href="<?php echo $GLOBALS['web_root']; ?>/library/css/bootstrap_navbar.css?v=<?php echo $v_js_includes; ?>" type="text/css">
173 <script type="text/javascript" src="<?php echo $GLOBALS['web_root']; ?>/interface/main/messages/js/reminder_appts.js?v=<?php echo $v_js_includes; ?>"></script>
175 <link rel="shortcut icon" href="<?php echo $webroot; ?>/sites/default/favicon.ico" />
177 <meta charset="utf-8">
178 <meta http-equiv="X-UA-Compatible" content="IE=edge">
179 <meta name="author" content="OpenEMR: MedExBank">
180 <meta name="viewport" content="width=device-width, initial-scale=1">
181 <style>
182 label {
183 font-weight: 400;
186 select {
187 width: 170px;
190 .btn{
191 border: solid black 0.5pt;
192 box-shadow: 3px 3px 3px #7b777760;
193 color:white;
196 .dialogIframe {
197 border: none;
200 .scheduled {
201 background-color: white;
202 color: black;
203 padding: 5px;
206 .divTable {
207 display: table;
208 font-size: 0.9em;
209 background: white;
210 box-shadow: 2px 3px 9px #c0c0c0;
211 border-radius: 8px;
212 padding: 10px;
213 margin: 15px auto;
214 min-width: 400px;
215 overflow: hidden;
218 .title {
219 font-family: Georgia, serif;
220 font-weight: bold;
221 padding: 3px 10px;
222 text-transform: uppercase;
223 line-height: 1.5em;
224 color: #455832;
225 border-bottom: 2px solid #455832;
226 margin: 0 auto;
227 width: 70%;
229 .ui-datepicker-year {
230 color: #000;
232 input[type="text"] {
233 text-align:center;
235 .ui-widget {
236 font-size: 1.0em;
238 body_top {
239 height:100%;
241 a:hover {
242 color:black;
243 text-decoration:none;
245 </style>
247 </head>
249 <body class="body_top">
250 <?php
251 if (($GLOBALS['medex_enable'] == '1') && (empty($_REQUEST['nomenu']))) {
252 $MedEx->display->navigation($logged_in);
255 <div class="container-fluid" style="margin-top: 20px;">
256 <div class="row-fluid" id="flb_selectors" style="display:<?php echo attr($setting_selectors); ?>;">
257 <div class="col-sm-12">
258 <div class="showRFlow" id="show_flows" style="text-align:center;margin:20px auto;" name="kiosk_hide">
259 <div class="title"><?php echo xlt('Flow Board'); ?></div>
260 <div name="div_response" id="div_response" class="nodisplay"></div>
261 <?php
262 if ($GLOBALS['medex_enable'] == '1') {
263 $col_width = "3";
264 } else {
265 $col_width = "4";
266 $last_col_width = "nodisplay";
269 <br/>
270 <form name="flb" id="flb" method="post">
271 <input type="hidden" name="csrf_token_form" value="<?php echo attr(collectCsrfToken()); ?>" />
272 <div class=" text-center row divTable" style="width: 85%;padding: 10px 10px 0;margin: 10px auto;">
273 <div class="col-sm-<?php echo attr($col_width); ?> text-center" style="margin-top:15px;">
274 <select id="form_apptcat" name="form_apptcat" class="form-group ui-selectmenu-button ui-button ui-widget ui-selectmenu-button-closed ui-corner-all"
275 onchange="refineMe('apptcat');" title="">
276 <?php
277 $categories = fetchAppointmentCategories();
278 echo "<option value=''>" . xlt("Visit Categories") . "</option>";
279 while ($cat = sqlFetchArray($categories)) {
280 echo "<option value='" . attr($cat['id']) . "'";
281 if ($cat['id'] == $_POST['form_apptcat']) {
282 echo " selected='true' ";
284 echo ">" . xlt($cat['category']) . "</option>";
287 </select>
289 <select id="form_apptstatus" name="form_apptstatus" class="form-group ui-selectmenu-button ui-button ui-widget ui-selectmenu-button-closed ui-corner-all"
290 onchange="refineMe();">
291 <option value=""><?php echo xlt("Visit Status"); ?></option>
293 <?php
294 $apptstats = sqlStatement("SELECT * FROM list_options WHERE list_id = 'apptstat' AND activity = 1 ORDER BY seq");
295 while ($apptstat = sqlFetchArray($apptstats)) {
296 echo "<option value='" . attr($apptstat['option_id']) . "'";
297 if ($apptstat['option_id'] == $_POST['form_apptstatus']) {
298 echo " selected='true' ";
300 echo ">" . xlt($apptstat['title']) . "</option>";
303 </select>
305 <input type="text"
306 placeholder="<?php echo xla('Patient Name'); ?>"
307 class="form-control input-sm" id="form_patient_name" name="form_patient_name"
308 value="<?php echo ($form_patient_name) ? attr($form_patient_name) : ""; ?>"
309 onKeyUp="refineMe();">
310 </div>
311 <div class="col-sm-<?php echo attr($col_width); ?> text-center" style="margin-top:15px;">
312 <select class="form-group ui-selectmenu-button ui-button ui-widget ui-selectmenu-button-closed ui-corner-all" id="form_facility" name="form_facility"
313 <?php
314 $fac_sql = sqlStatement("SELECT * FROM facility ORDER BY id");
315 while ($fac = sqlFetchArray($fac_sql)) {
316 $true = ($fac['id'] == $_POST['form_facility']) ? "selected=true" : '';
317 $select_facs .= "<option value=" . attr($fac['id']) . " " . $true . ">" . text($fac['name']) . "</option>\n";
318 $count_facs++;
320 if ($count_facs < '1') {
321 echo "disabled";
323 ?> onchange="refineMe('facility');">
324 <option value=""><?php echo xlt('All Facilities'); ?></option>
325 <?php echo $select_facs; ?>
326 </select>
328 <?php
329 // Build a drop-down list of ACTIVE providers.
330 $query = "SELECT id, lname, fname FROM users WHERE " .
331 "authorized = 1 AND active = 1 AND username > '' ORDER BY lname, fname"; #(CHEMED) facility filter
332 $ures = sqlStatement($query);
333 while ($urow = sqlFetchArray($ures)) {
334 $provid = $urow['id'];
335 $select_provs .= " <option value='" . attr($provid) . "'";
336 if (isset($_POST['form_provider']) && $provid == $_POST['form_provider']) {
337 $select_provs .= " selected";
338 } elseif (!isset($_POST['form_provider']) && $_SESSION['userauthorized'] && $provid == $_SESSION['authUserID']) {
339 $select_provs .= " selected";
341 $select_provs .= ">" . text($urow['lname']) . ", " . text($urow['fname']) . "\n";
342 $count_provs++;
346 <select class="form-group ui-selectmenu-button ui-button ui-widget ui-selectmenu-button-closed ui-corner-all" id="form_provider" name="form_provider" <?php
347 if ($count_provs < '2') {
348 echo "disabled";
350 ?> onchange="refineMe('provider');">
351 <option value="" selected><?php echo xlt('All Providers'); ?></option>
353 <?php
354 echo $select_provs;
356 </select>
357 <input placeholder="<?php echo xla('Patient ID'); ?>"
358 class="form-control input-sm" type="text"
359 id="form_patient_id" name="form_patient_id"
360 value="<?php echo ($form_patient_id) ? attr($form_patient_id) : ""; ?>"
361 onKeyUp="refineMe();">
362 </div>
363 <div class="col-sm-<?php echo attr($col_width); ?>">
364 <div style="margin: 0 auto;" class="input-append">
365 <table class="table-hover table-condensed" style="margin:0 auto;">
366 <?php
367 if ($GLOBALS['ptkr_date_range'] == '1') {
368 $type = 'date';
369 $style = '';
370 } else {
371 $type = 'hidden';
372 $style = 'display:none;';
373 } ?>
374 <tr style="<?php echo $style; ?>" class="align-bottom">
375 <td class="text-right align-bottom">
376 <label for="flow_from"><?php echo xlt('From'); ?>:</label></td>
377 <td>
378 <input type="text"
379 id="form_from_date" name="form_from_date"
380 class="datepicker form-control input-sm text-center"
381 value="<?php echo attr(oeFormatShortDate($from_date)); ?>"
382 style="max-width:140px;min-width:85px;">
383 </td>
384 </tr>
385 <tr style="<?php echo $style; ?>">
386 <td class="text-right">
387 <label for="flow_to">&nbsp;&nbsp;<?php echo xlt('To'); ?>:</label></td>
388 <td>
389 <input type="text"
390 id="form_to_date" name="form_to_date"
391 class="datepicker form-control input-sm text-center"
392 value="<?php echo attr(oeFormatShortDate($to_date)); ?>"
393 style="max-width:140px;min-width:85px;">
394 </td>
395 </tr>
396 <tr>
397 <td class="text-center" colspan="2">
398 <a id="filter_submit" class="btn btn-primary"><?php echo xlt('Filter'); ?></a>
399 <input type="hidden" id="kiosk" name="kiosk"
400 value="<?php echo attr($_REQUEST['kiosk']); ?>">
401 </td>
402 </tr>
403 </table>
404 </div>
405 </div>
406 <div class="col-sm-<?php echo attr($col_width) . " " . attr($last_col_width); ?> text-center">
407 <?php
408 if ($GLOBALS['medex_enable'] == '1') {
411 <div class="text-center" style="margin: 0 auto;">
412 <span class="bold" style="text-decoration:underline;font-size:1.2em;">MedEx <?php echo xlt('Reminders'); ?></span><br/>
413 <div class="text-left blockquote" style="width: 65%;margin: 5px auto;">
414 <a href="https://medexbank.com/cart/upload/index.php?route=information/campaigns&amp;g=rem"
415 target="_medex">
416 <?php echo $current_events; ?>
417 </a>
418 </div>
419 </div>
420 <?php } ?>
421 </div>
422 <div id="message" class="warning"></div>
423 </div>
424 </div>
425 </form>
426 </div>
427 </div>
429 <div class="row-fluid">
430 <div class="col-md-12">
431 <div class=" text-center row divTable" style="width: 85%;padding: 10px 10px 0;margin: 10px auto;">
432 <div class="col-sm-12" id="loader">
433 <div class="text-center">
434 <i class="fa fa-spinner fa-pulse fa-fw" style="font-size: 140px; color: #0000cc; padding: 20px"></i>
435 <h2 ><?php echo xlt('Loading data'); ?>...</h2>
436 </div>
437 </div>
438 <div id="flb_table" name="flb_table">
439 <?php
440 } else {
441 //end of if !$_REQUEST['flb_table'] - this is the table we fetch via ajax during a refreshMe() call
442 // get all appts for date range and refine view client side. very fast...
443 $appointments = array();
444 $datetime = date("Y-m-d H:i:s");
445 $appointments = fetch_Patient_Tracker_Events($from_date, $to_date, '', '', '', '', $form_patient_name, $form_patient_id);
446 $appointments = sortAppointments($appointments, 'date', 'time');
447 //grouping of the count of every status
448 $appointments_status = getApptStatus($appointments);
450 $chk_prov = array(); // list of providers with appointments
451 // Scan appointments for additional info
452 foreach ($appointments as $apt) {
453 $chk_prov[$apt['uprovider_id']] = $apt['ulname'] . ', ' . $apt['ufname'] . ' ' . $apt['umname'];
457 <div class="col-sm-12 text-center" style='margin:5px;'>
458 <span class="hidden-xs" id="status_summary">
459 <?php
460 $statuses_output = "<span style='margin:0 10px;'><em>" . xlt('Total patients') . ':</em> <span class="badge">' . text($appointments_status['count_all']) . "</span></span>";
461 unset($appointments_status['count_all']);
462 foreach ($appointments_status as $status_symbol => $count) {
463 $statuses_output .= " | <span style='margin:0 10px;'><em>" . text(xl_list_label($statuses_list[$status_symbol])) . ":</em> <span class='badge'>" . text($count) . "</span></span>";
465 echo $statuses_output;
467 </span>
468 <span id="pull_kiosk_right" class="pull-right">
469 <a id='setting_cog'><i class="fa fa-cog fa-2x fa-fw">&nbsp;</i></a>
471 <label for='setting_new_window' id='settings'>
472 <input type='checkbox' name='setting_new_window' id='setting_new_window'
473 value='<?php echo attr($setting_new_window); ?>' <?php echo attr($setting_new_window); ?> />
474 <?php echo xlt('Open Patient in New Window'); ?>
475 </label>
476 <a id='refreshme'><i class="fa fa-refresh fa-2x fa-fw">&nbsp;</i></a>
477 <span class="fa-stack fa-lg" id="flb_caret" onclick="toggleSelectors();"
478 title="<?php echo xla('Show/Hide the Selection Area'); ?>"
479 style="color:<?php echo $color = ($setting_selectors == 'none') ? 'red' : 'black'; ?>;">
480 <i class="fa fa-square-o fa-stack-2x"></i>
481 <i id="print_caret"
482 class='fa fa-caret-<?php echo $caret = ($setting_selectors == 'none') ? 'down' : 'up'; ?> fa-stack-1x'></i>
483 </span>
485 <a class='btn btn-primary' onclick="print_FLB();"> <?php echo xlt('Print'); ?> </a>
487 <?php if ($GLOBALS['new_tabs_layout']) { ?>
488 <a class='btn btn-primary' onclick="kiosk_FLB();"> <?php echo xlt('Kiosk'); ?> </a>
489 <?php } ?>
490 </span>
491 </div>
493 <div class="col-sm-12 textclear" >
495 <table class="table table-responsive table-condensed table-hover table-bordered">
496 <thead>
497 <tr bgcolor="#cccff" class="small bold text-center">
498 <?php if ($GLOBALS['ptkr_show_pid']) { ?>
499 <td class="dehead hidden-xs text-center" name="kiosk_hide">
500 <?php echo xlt('PID'); ?>
501 </td>
502 <?php } ?>
503 <td class="dehead text-center" style="max-width:150px;">
504 <?php echo xlt('Patient'); ?>
505 </td>
506 <?php if ($GLOBALS['ptkr_visit_reason'] == '1') { ?>
507 <td class="dehead hidden-xs text-center" name="kiosk_hide">
508 <?php echo xlt('Reason'); ?>
509 </td>
510 <?php } ?>
511 <?php if ($GLOBALS['ptkr_show_encounter']) { ?>
512 <td class="dehead text-center hidden-xs hidden-sm" name="kiosk_hide">
513 <?php echo xlt('Encounter'); ?>
514 </td>
515 <?php } ?>
517 <?php if ($GLOBALS['ptkr_date_range'] == '1') { ?>
518 <td class="dehead hidden-xs text-center" name="kiosk_hide">
519 <?php echo xlt('Appt Date'); ?>
520 </td>
521 <?php } ?>
522 <td class="dehead text-center">
523 <?php echo xlt('Appt Time'); ?>
524 </td>
525 <td class="dehead hidden-xs text-center">
526 <?php echo xlt('Arrive Time'); ?>
527 </td>
528 <td class="dehead visible-xs hidden-sm hidden-md hidden-lg text-center">
529 <?php echo xlt('Arrival'); ?>
530 </td>
531 <td class="dehead hidden-xs text-center">
532 <?php echo xlt('Appt Status'); ?>
533 </td>
534 <td class="dehead hidden-xs text-center">
535 <?php echo xlt('Current Status'); ?>
536 </td>
537 <td class="dehead visible-xs hidden-sm hidden-md hidden-lg text-center">
538 <?php echo xlt('Current'); ?>
539 </td>
540 <td class="dehead hidden-xs text-center" name="kiosk_hide">
541 <?php echo xlt('Visit Type'); ?>
542 </td>
543 <?php if (count($chk_prov) > 1) { ?>
544 <td class="dehead text-center hidden-xs">
545 <?php echo xlt('Provider'); ?>
546 </td>
547 <?php } ?>
548 <td class="dehead text-center">
549 <?php echo xlt('Total Time'); ?>
550 </td>
551 <td class="dehead hidden-xs text-center">
552 <?php echo xlt('Check Out Time'); ?>
553 </td>
554 <td class="dehead visible-xs hidden-sm hidden-md hidden-lg text-center">
555 <?php echo xlt('Out Time'); ?>
556 </td>
557 <?php
558 if ($GLOBALS['ptkr_show_staff']) { ?>
559 <td class="dehead hidden-xs hidden-sm text-center" name="kiosk_hide">
560 <?php echo xlt('Updated By'); ?>
561 </td>
562 <?php
564 if ($_REQUEST['kiosk'] != '1') {
565 if ($GLOBALS['drug_screen']) { ?>
566 <td class="dehead center hidden-xs " name="kiosk_hide">
567 <?php echo xlt('Random Drug Screen'); ?>
568 </td>
569 <td class="dehead center hidden-xs " name="kiosk_hide">
570 <?php echo xlt('Drug Screen Completed'); ?>
571 </td>
572 <?php
574 } ?>
575 </tr>
576 </thead>
577 <tbody>
578 <?php
579 $prev_appt_date_time = "";
580 foreach ($appointments as $appointment) {
581 // Collect appt date and set up squashed date for use below
582 $date_appt = $appointment['pc_eventDate'];
583 $date_squash = str_replace("-", "", $date_appt);
584 if (empty($appointment['room']) && ($logged_in)) {
585 //Patient has not arrived yet, display MedEx Reminder info
586 //one icon per type of response.
587 //If there was a SMS dialog, display it as a mouseover/title
588 //Display date received also as mouseover title.
589 $other_title = '';
590 $title = '';
591 $icon2_here = '';
592 $icon_CALL = '';
593 $icon_4_CALL = '';
594 $appt['stage'] = '';
595 $icon_here = array();
596 $prog_text = '';
597 $CALLED = '';
598 $FINAL = '';
599 $icon_CALL = '';
601 $query = "SELECT * FROM medex_outgoing WHERE msg_pc_eid =? ORDER BY medex_uid asc";
602 $myMedEx = sqlStatement($query, array($appointment['eid']));
604 * Each row for this pc_eid in the medex_outgoing table represents an event.
605 * Every event is recorded in $prog_text.
606 * A modality is represented by an icon (eg mail icon, phone icon, text icon).
607 * The state of the Modality is represented by the color of the icon:
608 * CONFIRMED = green
609 * READ = blue
610 * FAILED = pink
611 * SENT/in process = yellow
612 * SCHEDULED = white
613 * Icons are displayed in their highest state.
615 while ($row = sqlFetchArray($myMedEx)) {
616 // Need to convert $row['msg_date'] to localtime (stored as GMT) & then oeFormatShortDate it.
617 // I believe there is a new GLOBAL for server timezone??? If so, it will be easy.
618 // If not we need to import it from Medex through medex_preferences. It should really be in openEMR though.
619 // Delete when we figure this out.
620 $other_title = '';
621 if (!empty($row['msg_extra_text'])) {
622 $local = attr($row['msg_extra_text']) . " |";
624 $prog_text .= attr(oeFormatShortDate($row['msg_date'])) . " :: " . attr($row['msg_type']) . " : " . attr($row['msg_reply']) . " | " . $local . " |";
626 if ($row['msg_reply'] == 'Other') {
627 $other_title .= $row['msg_extra_text'] . "\n";
628 $icon_extra .= str_replace(
629 "EXTRA",
630 attr(oeFormatShortDate($row['msg_date'])) . "\n" . xla('Patient Message') . ":\n" . attr($row['msg_extra_text']) . "\n",
631 $icons[$row['msg_type']]['EXTRA']['html']
633 continue;
634 } elseif ($row['msg_reply'] == 'CANCELLED') {
635 $appointment[$row['msg_type']]['stage'] = "CANCELLED";
636 $icon_here[$row['msg_type']] = '';
637 } elseif ($row['msg_reply'] == "FAILED") {
638 $appointment[$row['msg_type']]['stage'] = "FAILED";
639 $icon_here[$row['msg_type']] = $icons[$row['msg_type']]['FAILED']['html'];
640 } elseif (($row['msg_reply'] == "CONFIRMED") || ($appointment[$row['msg_type']]['stage'] == "CONFIRMED")) {
641 $appointment[$row['msg_type']]['stage'] = "CONFIRMED";
642 $icon_here[$row['msg_type']] = $icons[$row['msg_type']]['CONFIRMED']['html'];
643 } elseif ($row['msg_type'] == "NOTES") {
644 $CALLED = "1";
645 $FINAL = $icons['NOTES']['CALLED']['html'];
646 $icon_CALL = str_replace("Call Back: COMPLETED", attr(oeFormatShortDate($row['msg_date'])) . " :: " . xla('Callback Performed') . " | " . xla('NOTES') . ": " . $row['msg_extra_text'] . " | ", $FINAL);
647 continue;
648 } elseif (($row['msg_reply'] == "READ") || ($appointment[$row['msg_type']]['stage'] == "READ")) {
649 $appointment[$row['msg_type']]['stage'] = "READ";
650 $icon_here[$row['msg_type']] = $icons[$row['msg_type']]['READ']['html'];
651 } elseif (($row['msg_reply'] == "SENT") || ($appointment[$row['msg_type']]['stage'] == "SENT")) {
652 $appointment[$row['msg_type']]['stage'] = "SENT";
653 $icon_here[$row['msg_type']] = $icons[$row['msg_type']]['SENT']['html'];
654 } elseif (($row['msg_reply'] == "To Send") || (empty($appointment['stage']))) {
655 if (($appointment[$row['msg_type']]['stage'] != "CONFIRMED") &&
656 ($appointment[$row['msg_type']]['stage'] != "READ") &&
657 ($appointment[$row['msg_type']]['stage'] != "SENT") &&
658 ($appointment[$row['msg_type']]['stage'] != "FAILED")) {
659 $appointment[$row['msg_type']]['stage'] = "QUEUED";
660 $icon_here[$row['msg_type']] = $icons[$row['msg_type']]['SCHEDULED']['html'];
663 //these are additional icons if present
664 if (($row['msg_reply'] == "CALL") && (!$CALLED)) {
665 $icon_here = '';
666 $icon_4_CALL = $icons[$row['msg_type']]['CALL']['html'];
667 $icon_CALL = "<span onclick=\"doCALLback(" . attr_js($date_squash) . "," . attr_js($appointment['eid']) . "," . attr_js($appointment['pc_cattype']) . ")\">" . $icon_4_CALL . "</span>
668 <span class='hidden' name='progCALLback_" . attr($appointment['eid']) . "' id='progCALLback_" . attr($appointment['eid']) . "'>
669 <form id='notation_" . attr($appointment['eid']) . "' method='post'
670 action='#'>
671 <input type='hidden' name='csrf_token_form' value='<?php echo attr(collectCsrfToken()); ?>' />
672 <h4>" . xlt('Call Back Notes') . ":</h4>
673 <input type='hidden' name='pc_eid' id='pc_eid' value='" . attr($appointment['eid']) . "'>
674 <input type='hidden' name='pc_pid' id='pc_pid' value='" . attr($appointment['pc_pid']) . "'>
675 <input type='hidden' name='campaign_uid' id='campaign_uid' value='" . attr($row['campaign_uid']) . "'>
676 <textarea name='txtCALLback' id='txtCALLback' rows=6 cols=20></textarea>
677 <input type='submit' name='saveCALLback' id='saveCALLback' value='" . xla("Save") ."'>
678 </form>
679 </span>
681 } elseif ($row['msg_reply'] == "STOP") {
682 $icon2_here .= $icons[$row['msg_type']]['STOP']['html'];
683 } elseif ($row['msg_reply'] == "Other") {
684 $icon2_here .= $icons[$row['msg_type']]['Other']['html'];
685 } elseif ($row['msg_reply'] == "CALLED") {
686 $icon2_here .= $icons[$row['msg_type']]['CALLED']['html'];
689 //if pc_apptstatus == '-', update it now to=status
690 if (!empty($other_title)) {
691 $appointment['messages'] = $icon2_here . $icon_extra;
695 // Collect variables and do some processing
696 $docname = $chk_prov[$appointment['uprovider_id']];
697 if (strlen($docname) <= 3) {
698 continue;
700 $ptname = $appointment['lname'] . ', ' . $appointment['fname'] . ' ' . $appointment['mname'];
701 $ptname_short = $appointment['fname'][0] . " " . $appointment['lname'][0];
702 $appt_enc = $appointment['encounter'];
703 $appt_eid = (!empty($appointment['eid'])) ? $appointment['eid'] : $appointment['pc_eid'];
704 $appt_pid = (!empty($appointment['pid'])) ? $appointment['pid'] : $appointment['pc_pid'];
705 if ($appt_pid == 0) {
706 continue; // skip when $appt_pid = 0, since this means it is not a patient specific appt slot
708 $status = (!empty($appointment['status']) && (!is_numeric($appointment['status']))) ? $appointment['status'] : $appointment['pc_apptstatus'];
709 $appt_room = (!empty($appointment['room'])) ? $appointment['room'] : $appointment['pc_room'];
710 $appt_time = (!empty($appointment['appttime'])) ? $appointment['appttime'] : $appointment['pc_startTime'];
711 $tracker_id = $appointment['id'];
712 // reason for visit
713 if ($GLOBALS['ptkr_visit_reason']) {
714 $reason_visit = $appointment['pc_hometext'];
716 $newarrive = collect_checkin($tracker_id);
717 $newend = collect_checkout($tracker_id);
718 $colorevents = (collectApptStatusSettings($status));
719 $bgcolor = $colorevents['color'];
720 $statalert = $colorevents['time_alert'];
721 // process the time to allow items with a check out status to be displayed
722 if (is_checkout($status) && (($GLOBALS['checkout_roll_off'] > 0) && strlen($form_apptstatus) != 1)) {
723 $to_time = strtotime($newend);
724 $from_time = strtotime($datetime);
725 $display_check_out = round(abs($from_time - $to_time) / 60, 0);
726 if ($display_check_out >= $GLOBALS['checkout_roll_off']) {
727 continue;
731 echo '<tr data-apptstatus="' . attr($appointment['pc_apptstatus']) . '"
732 data-apptcat="' . attr($appointment['pc_catid']) . '"
733 data-facility="' . attr($appointment['pc_facility']) . '"
734 data-provider="' . attr($appointment['uprovider_id']) . '"
735 data-pid="' . attr($appointment['pc_pid']) . '"
736 data-pname="' . attr($ptname) . '"
737 class="text-small"
738 bgcolor="' . attr($bgcolor) . '" >';
739 if ($GLOBALS['ptkr_show_pid']) {
741 <td class="detail hidden-xs" align="center" name="kiosk_hide">
742 <?php echo text($appt_pid); ?>
743 </td>
744 <?php
748 <td class="detail text-center hidden-xs" name="kiosk_hide">
749 <a href="#"
750 onclick="return topatient(<?php echo attr_js($appt_pid); ?>,<?php echo attr_js($appt_enc); ?>)">
751 <?php echo text($ptname); ?></a>
752 </td>
753 <td class="detail text-center visible-xs hidden-sm hidden-md hidden-lg"
754 style="white-space: normal;" name="kiosk_hide">
755 <a href="#"
756 onclick="return topatient(<?php echo attr_js($appt_pid); ?>,<?php echo attr_js($appt_enc); ?>)">
757 <?php echo text($ptname_short); ?></a>
758 </td>
760 <td class="detail text-center" style="white-space: normal;" name="kiosk_show">
761 <a href="#"
762 onclick="return topatient(<?php echo attr_js($appt_pid); ?>,<?php echo attr_js($appt_enc); ?>)">
763 <?php echo text($ptname_short); ?></a>
764 </td>
766 <!-- reason -->
767 <?php if ($GLOBALS['ptkr_visit_reason']) { ?>
768 <td class="detail hidden-xs text-center" name="kiosk_hide">
769 <?php echo text($reason_visit) ?>
770 </td>
771 <?php } ?>
772 <?php if ($GLOBALS['ptkr_show_encounter']) { ?>
773 <td class="detail hidden-xs hidden-sm text-center" name="kiosk_hide">
774 <?php
775 if ($appt_enc != 0) {
776 echo text($appt_enc);
779 </td>
780 <?php } ?>
781 <?php if ($GLOBALS['ptkr_date_range'] == '1') { ?>
782 <td class="detail hidden-xs text-center" name="kiosk_hide">
783 <?php echo text(oeFormatShortDate($appointment['pc_eventDate']));
785 </td>
786 <?php } ?>
787 <td class="detail" align="center">
788 <?php echo text(oeFormatTime($appt_time)); ?>
789 </td>
790 <td class="detail text-center">
791 <?php
792 if ($newarrive) {
793 echo text(oeFormatTime($newarrive));
796 </td>
797 <td class="detail hidden-xs text-center small">
798 <?php if (empty($tracker_id)) { //for appt not yet with tracker id and for recurring appt ?>
799 <a onclick="return calendarpopup(<?php echo attr_js($appt_eid) . "," . attr_js($date_squash); // calls popup for add edit calendar event?>)">
800 <?php } else { ?>
801 <a onclick="return bpopup(<?php echo attr_js($tracker_id); // calls popup for patient tracker status?>)">
802 <?php } ?>
803 <?php
804 if ($appointment['room'] > '') {
805 echo text(getListItemTitle('patient_flow_board_rooms', $appt_room));
806 } else {
807 echo text(getListItemTitle("apptstat", $status)); // drop down list for appointment status
810 </a>
811 </td>
813 <?php
814 //time in current status
815 $to_time = strtotime(date("Y-m-d H:i:s"));
816 $yestime = '0';
817 if (strtotime($newend) != '') {
818 $from_time = strtotime($newarrive);
819 $to_time = strtotime($newend);
820 $yestime = '0';
821 } else {
822 $from_time = strtotime($appointment['start_datetime']);
823 $yestime = '1';
826 $timecheck = round(abs($to_time - $from_time) / 60, 0);
827 if ($timecheck >= $statalert && ($statalert > '0')) { // Determine if the time in status limit has been reached.
828 echo "<td class='text-center js-blink-infinite small' nowrap> "; // and if so blink
829 } else {
830 echo "<td class='detail text-center' nowrap> "; // and if not do not blink
832 if (($yestime == '1') && ($timecheck >= 1) && (strtotime($newarrive) != '')) {
833 echo text($timecheck . ' ' . ($timecheck >= 2 ? xl('minutes') : xl('minute')));
834 } else if ($icon_here || $icon2_here || $icon_CALL) {
835 echo "<span style='font-size:0.7em;' onclick='return calendarpopup(" . attr_js($appt_eid) . "," . attr_js($date_squash) . ")'>" . implode($icon_here) . $icon2_here . "</span> " . $icon_CALL;
836 } else if ($logged_in) {
837 $pat = $MedEx->display->possibleModalities($appointment);
838 echo "<span style='font-size:0.7em;' onclick='return calendarpopup(" . attr_js($appt_eid) . "," . attr_js($date_squash) . ")'>" . $pat['SMS'] . $pat['AVM'] . $pat['EMAIL'] . "</span>";
840 //end time in current status
841 echo "</td>";
843 <td class="detail hidden-xs text-center" name="kiosk_hide">
844 <?php echo xlt($appointment['pc_title']); ?>
845 </td>
846 <?php
847 if (count($chk_prov) > 1) { ?>
848 <td class="detail text-center hidden-xs">
849 <?php echo text($docname); ?>
850 </td>
851 <?php
852 } ?>
853 <td class="detail text-center">
854 <?php
855 // total time in practice
856 if (strtotime($newend) != '') {
857 $from_time = strtotime($newarrive);
858 $to_time = strtotime($newend);
859 } else {
860 $from_time = strtotime($newarrive);
861 $to_time = strtotime(date("Y-m-d H:i:s"));
863 $timecheck2 = round(abs($to_time - $from_time) / 60, 0);
864 if (strtotime($newarrive) != '' && ($timecheck2 >= 1)) {
865 echo text($timecheck2 . ' ' . ($timecheck2 >= 2 ? xl('minutes') : xl('minute')));
867 // end total time in practice
868 echo text($appointment['pc_time']); ?>
869 </td>
870 <td class="detail text-center">
873 </td>
874 <?php
875 if ($GLOBALS['ptkr_show_staff'] == '1') {
877 <td class="detail hidden-xs hidden-sm text-center" name="kiosk_hide">
878 <?php echo text($appointment['user']) ?>
879 </td>
880 <?php
882 if ($GLOBALS['drug_screen']) {
883 if (strtotime($newarrive) != '') { ?>
884 <td class="detail hidden-xs text-center" name="kiosk_hide">
885 <?php
886 if ($appointment['random_drug_test'] == '1') {
887 echo xlt('Yes');
888 } else {
889 echo xlt('No');
890 } ?>
891 </td>
892 <?php
893 } ?>
894 <?php
895 if (strtotime($newarrive) != '' && $appointment['random_drug_test'] == '1') { ?>
896 <td class="detail hidden-xs text-center" name="kiosk_hide">
897 <?php
898 if (strtotime($newend) != '') {
899 // the following block allows the check box for drug screens to be disabled once the status is check out ?>
900 <input type=checkbox disabled='disable' class="drug_screen_completed"
901 id="<?php echo attr($appointment['pt_tracker_id']) ?>" <?php echo ($appointment['drug_screen_completed'] == "1") ? "checked" : ""; ?>>
902 <?php
903 } else {
905 <input type=checkbox class="drug_screen_completed"
906 id='<?php echo attr($appointment['pt_tracker_id']) ?>'
907 name="drug_screen_completed" <?php echo ($appointment['drug_screen_completed'] == "1") ? "checked" : ""; ?>>
908 <?php
909 } ?>
910 </td>
911 <?php
912 } else {
913 echo " </td>";
917 </tr>
918 <?php
919 } //end foreach
921 </tbody>
922 </table>
924 <?php
926 if (!$_REQUEST['flb_table']) { ?>
927 </div>
928 </div>
929 </div>
930 </div>
931 </div><?php //end container ?>
932 <!-- form used to open a new top level window when a patient row is clicked -->
933 <form name='fnew' method='post' target='_blank'
934 action='../main/main_screen.php?auth=login&site=<?php echo attr_url($_SESSION['site_id']); ?>'>
935 <input type="hidden" name="csrf_token_form" value="<?php echo attr(collectCsrfToken()); ?>" />
936 <input type='hidden' name='patientID' value='0'/>
937 <input type='hidden' name='encounterID' value='0'/>
938 </form>
940 <?php echo myLocalJS(); ?>
941 </body>
942 </html>
943 <?php
944 } //end of second !$_REQUEST['flb_table']
947 exit;
949 function myLocalJS()
952 <script type="text/javascript">
953 var auto_refresh = null;
954 //this can be refined to redact HIPAA material using @media print options.
955 top.restoreSession();
956 if (top.tab_mode) {
957 window.parent.$("[name='flb']").attr('allowFullscreen', 'true');
958 } else {
959 $(this).attr('allowFullscreen', 'true');
961 <?php
962 if ($_REQUEST['kiosk'] == '1') { ?>
963 $("[name='kiosk_hide']").hide();
964 $("[name='kiosk_show']").show();
965 <?php } else { ?>
966 $("[name='kiosk_hide']").show();
967 $("[name='kiosk_show']").hide();
968 <?php } ?>
969 function print_FLB() {
970 window.print();
973 function toggleSelectors() {
974 if ($("#flb_selectors").css('display') === 'none') {
975 $.post("<?php echo $GLOBALS['webroot'] . "/interface/patient_tracker/patient_tracker.php"; ?>", {
976 setting_selectors: 'block',
977 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
978 }).done(
979 function (data) {
980 $("#flb_selectors").slideToggle();
981 $("#flb_caret").css('color', '#000');
983 } else {
984 $.post("<?php echo $GLOBALS['webroot'] . "/interface/patient_tracker/patient_tracker.php"; ?>", {
985 setting_selectors: 'none',
986 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
987 }).done(
988 function (data) {
989 $("#flb_selectors").slideToggle();
990 $("#flb_caret").css('color', 'red');
993 $("#print_caret").toggleClass('fa-caret-up').toggleClass('fa-caret-down');
997 * This function refreshes the whole flb_table according to our to/from dates.
999 function refreshMe(fromTimer) {
1001 if(typeof fromTimer === 'undefined' || !fromTimer) {
1002 //Show loader in the first loading or manual loading not by timer
1003 $("#flb_table").html('');
1004 $('#loader').show();
1007 var startRequestTime = Date.now();
1008 top.restoreSession();
1009 var posting = $.post('../patient_tracker/patient_tracker.php', {
1010 flb_table: '1',
1011 form_from_date: $("#form_from_date").val(),
1012 form_to_date: $("#form_to_date").val(),
1013 form_facility: $("#form_facility").val(),
1014 form_provider: $("#form_provider").val(),
1015 form_apptstatus: $("#form_apptstatus").val(),
1016 form_patient_name: $("#form_patient_name").val(),
1017 form_patient_id: $("#form_patient_id").val(),
1018 form_apptcat: $("#form_apptcat").val(),
1019 kiosk: $("#kiosk").val(),
1020 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
1021 }).done(
1022 function (data) {
1023 //minimum 400 ms of loader (In the first loading or manual loading not by timer)
1024 if((typeof fromTimer === 'undefined' || !fromTimer) && Date.now() - startRequestTime < 400 ){
1025 setTimeout(drawTable, 500, data);
1026 } else {
1027 drawTable(data)
1032 function drawTable(data) {
1034 $('#loader').hide();
1035 $("#flb_table").html(data);
1036 if ($("#kiosk").val() === '') {
1037 $("[name='kiosk_hide']").show();
1038 $("[name='kiosk_show']").hide();
1039 } else {
1040 $("[name='kiosk_hide']").hide();
1041 $("[name='kiosk_show']").show();
1044 refineMe();
1046 initTableButtons();
1050 function refreshme() {
1051 // Just need this to support refreshme call from the popup used for recurrent appt
1052 refreshMe();
1056 * This function hides all then shows only the flb_table rows that match our selection, client side.
1057 * It is called on initial load, on refresh and 'onchange/onkeyup' of a flow board parameter.
1059 function refineMe() {
1060 var apptcatV = $("#form_apptcat").val();
1061 var apptstatV = $("#form_apptstatus").val();
1062 var facV = $("#form_facility").val();
1063 var provV = $("#form_provider").val();
1064 var pidV = String($("#form_patient_id").val());
1065 var pidRE = new RegExp(pidV, 'g');
1066 var pnameV = $("#form_patient_name").val();
1067 var pnameRE = new RegExp(pnameV, 'ig');
1069 //and hide what we don't want to show
1070 $('#flb_table tbody tr').hide().filter(function () {
1071 var d = $(this).data();
1072 meets_cat = (apptcatV === '') || (apptcatV == d.apptcat);
1073 meets_stat = (apptstatV === '') || (apptstatV == d.apptstatus);
1074 meets_fac = (facV === '') || (facV == d.facility);
1075 meets_prov = (provV === '') || (provV == d.provider);
1076 meets_pid = (pidV === '');
1077 if ((pidV > '') && pidRE.test(d.pid)) {
1078 meets_pid = true;
1080 meets_pname = (pnameV === '');
1081 if ((pnameV > '') && pnameRE.test(d.pname)) {
1082 meets_pname = true;
1084 return meets_pname && meets_pid && meets_cat && meets_stat && meets_fac && meets_prov;
1085 }).show();
1088 // popup for patient tracker status
1089 function bpopup(tkid) {
1090 top.restoreSession();
1091 dlgopen('../patient_tracker/patient_tracker_status.php?tracker_id=' + encodeURIComponent(tkid) + '&csrf_token_form=' + <?php echo js_url(collectCsrfToken()); ?>, '_blank', 500, 250);
1092 return false;
1095 // popup for calendar add edit
1096 function calendarpopup(eid, date_squash) {
1097 top.restoreSession();
1098 dlgopen('../main/calendar/add_edit_event.php?eid=' + encodeURIComponent(eid) + '&date=' + encodeURIComponent(date_squash), '_blank', 775, 500);
1099 return false;
1102 // used to display the patient demographic and encounter screens
1103 function topatient(newpid, enc) {
1104 if ($('#setting_new_window').val() === 'checked') {
1105 openNewTopWindow(newpid, enc);
1107 else {
1108 top.restoreSession();
1109 if (enc > 0) {
1110 top.RTop.location = "<?php echo $GLOBALS['webroot']; ?>/interface/patient_file/summary/demographics.php?set_pid=" + encodeURIComponent(newpid) + "&set_encounterid=" + encodeURIComponent(enc);
1112 else {
1113 top.RTop.location = "<?php echo $GLOBALS['webroot']; ?>/interface/patient_file/summary/demographics.php?set_pid=" + encodeURIComponent(newpid);
1118 function doCALLback(eventdate, eid, pccattype) {
1119 $("#progCALLback_" + eid).parent().removeClass('js-blink-infinite').css('animation-name', 'none');
1120 $("#progCALLback_" + eid).removeClass("hidden");
1121 clearInterval(auto_refresh);
1124 // opens the demographic and encounter screens in a new window
1125 function openNewTopWindow(newpid, newencounterid) {
1126 document.fnew.patientID.value = newpid;
1127 document.fnew.encounterID.value = newencounterid;
1128 top.restoreSession();
1129 document.fnew.submit();
1132 //opens the two-way SMS phone app
1134 * @return {boolean}
1136 function SMS_bot(pid) {
1137 top.restoreSession();
1138 var from = <?php echo js_escape($from_date); ?>;
1139 var to = <?php echo js_escape($to_date); ?>;
1140 var oefrom = <?php echo js_escape(oeFormatShortDate($from_date)); ?>;
1141 var oeto = <?php echo js_escape(oeFormatShortDate($to_date)); ?>;
1142 window.open('../main/messages/messages.php?nomenu=1&go=SMS_bot&pid=' + encodeURIComponent(pid) + '&to=' + encodeURIComponent(to) + '&from=' + encodeURIComponent(from) + '&oeto=' + encodeURIComponent(oeto) + '&oefrom=' + encodeURIComponent(oefrom), 'SMS_bot', 'width=370,height=600,resizable=0');
1143 return false;
1146 function kiosk_FLB() {
1147 $("#kiosk").val('1');
1148 $("[name='kiosk_hide']").hide();
1149 $("[name='kiosk_show']").show();
1150 var i = document.getElementById("flb_table");
1151 // go full-screen
1152 if (i.requestFullscreen) {
1153 i.requestFullscreen();
1154 } else if (i.webkitRequestFullscreen) {
1155 i.webkitRequestFullscreen();
1156 } else if (i.mozRequestFullScreen) {
1157 i.mozRequestFullScreen();
1158 } else if (i.msRequestFullscreen) {
1159 i.msRequestFullscreen();
1161 // refreshMe();
1164 $(document).ready(function () {
1165 refreshMe();
1166 $("#kiosk").val('');
1167 $("[name='kiosk_hide']").show();
1168 $("[name='kiosk_show']").hide();
1170 onresize = function () {
1171 var state = 1 >= outerHeight - innerHeight ? "fullscreen" : "windowed";
1172 if (window.state === state) return;
1173 window.state = state;
1174 var event = document.createEvent("Event");
1175 event.initEvent(state, true, true);
1176 window.dispatchEvent(event);
1179 addEventListener('windowed', function (e) {
1180 $("#kiosk").val('');
1181 $("[name='kiosk_hide']").show();
1182 $("[name='kiosk_show']").hide();
1183 //alert(e.type);
1184 }, false);
1185 addEventListener('fullscreen', function (e) {
1186 $("#kiosk").val('1');
1187 $("[name='kiosk_hide']").hide();
1188 $("[name='kiosk_show']").show();
1189 //alert(e.type);
1190 }, false);
1192 <?php if ($GLOBALS['pat_trkr_timer'] != '0') { ?>
1193 var reftime = <?php echo js_escape($GLOBALS['pat_trkr_timer']); ?>;
1194 var parsetime = reftime.split(":");
1195 parsetime = (parsetime[0] * 60) + (parsetime[1] * 1) * 1000;
1196 if (auto_refresh) clearInteral(auto_refresh);
1197 auto_refresh = setInterval(function () {
1198 refreshMe(true) // this will run after every parsetime seconds
1199 }, parsetime);
1200 <?php } ?>
1202 $('.js-blink-infinite').each(function () {
1203 // set up blinking text
1204 var elem = $(this);
1205 setInterval(function () {
1206 if (elem.css('visibility') === 'hidden') {
1207 elem.css('visibility', 'visible');
1208 } else {
1209 elem.css('visibility', 'hidden');
1211 }, 500);
1213 // toggle of the check box status for drug screen completed and ajax call to update the database
1214 $('body').on('click', '.drug_screen_completed', function () {
1215 top.restoreSession();
1216 if (this.checked) {
1217 testcomplete_toggle = "true";
1218 } else {
1219 testcomplete_toggle = "false";
1221 $.post("../../library/ajax/drug_screen_completed.php", {
1222 trackerid: this.id,
1223 testcomplete: testcomplete_toggle,
1224 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
1228 // mdsupport - Immediately post changes to setting_new_window
1229 $('body').on('click', '#setting_new_window', function () {
1230 $('#setting_new_window').val(this.checked ? 'checked' : ' ');
1231 $.post("<?php echo $GLOBALS['webroot'] . "/interface/patient_tracker/patient_tracker.php"; ?>", {
1232 setting_new_window: $('#setting_new_window').val(),
1233 csrf_token_form: <?php echo js_escape(collectCsrfToken()); ?>
1234 }).done(
1235 function (data) {
1240 $('#filter_submit').click(function (e) {
1241 e.preventDefault;
1242 top.restoreSession;
1243 refreshMe();
1246 $('[data-toggle="tooltip"]').tooltip();
1248 $('.datepicker').datetimepicker({
1249 <?php $datetimepicker_timepicker = false; ?>
1250 <?php $datetimepicker_showseconds = false; ?>
1251 <?php $datetimepicker_formatInput = true; ?>
1252 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
1253 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
1258 function initTableButtons() {
1259 $('#refreshme').click(function () {
1260 refreshMe();
1261 refineMe();
1264 $('#setting_cog').click(function () {
1265 $(this).css("display", "none");
1266 $('#settings').css("display", "inline");
1269 $('#settings').css("display", "none");
1272 initTableButtons();
1274 </script>
1275 <?php } ?>