4 * This reports checkins and checkouts for a specified patient's chart.
7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2008-2015 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc.php");
17 require_once("$srcdir/options.inc.php");
19 use OpenEMR\Common\Csrf\CsrfUtils
;
20 use OpenEMR\Core\Header
;
21 use OpenEMR\Services\PatientService
;
24 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
25 CsrfUtils
::csrfNotVerified();
29 $form_patient_id = trim($_POST['form_patient_id'] ??
'');
33 <title
><?php
echo xlt('Chart Location Activity'); ?
></title
>
35 <?php Header
::setupHeader(); ?
>
38 /* specifically include & exclude from printing */
44 #report_parameters_daterange {
48 #report_results table {
53 /* specifically exclude some from the screen */
55 #report_parameters_daterange {
64 var win
= top
.printLogSetup ? top
: opener
.top
;
65 win
.printLogSetup(document
.getElementById('printbutton'));
70 <body
class="body_top">
72 <span
class='title'><?php
echo xlt('Report'); ?
> - <?php
echo xlt('Chart Location Activity'); ?
></span
>
77 if (!empty($form_patient_id)) {
78 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
79 "pubpid = ? ORDER BY pid LIMIT 1";
80 $ptrow = sqlQuery($query, array($form_patient_id));
83 echo "<font color='red'>" . xlt('Chart ID') . " '" . text($form_patient_id) . "' " . xlt('not found!') . "</font><br /> <br />";
85 $curr_pid = $ptrow['pid'];
87 } elseif (!empty($curr_pid)) {
88 $query = "SELECT pid, pubpid, fname, mname, lname FROM patient_data WHERE " .
90 $ptrow = sqlQuery($query, array($curr_pid));
91 $form_patient_id = $ptrow['pubpid'];
95 echo '<span class="title">' . xlt('for') . ' ';
96 echo text($ptrow['lname']) . ', ' . text($ptrow['fname']) . ' ' . text($ptrow['mname']) . ' ';
97 echo "(" . text($ptrow['pubpid']) . ")";
102 <div id
="report_parameters_daterange">
105 <form name
='theform' id
='theform' method
='post' action
='chart_location_activity.php' onsubmit
='return top.restoreSession()'>
106 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
108 <div id
="report_parameters">
110 <input type
='hidden' name
='form_refresh' id
='form_refresh' value
=''/>
114 <div style
='float:left'>
118 <td
class='col-form-label'>
119 <?php
echo xlt('Patient ID'); ?
>:
122 <input type
='text' name
='form_patient_id' class='form-control' size
='10' maxlength
='31' value
='<?php echo attr($form_patient_id) ?>'
123 title
='<?php echo xla('Patient ID
'); ?>' />
131 <td
class='h-100' align
='left' valign
='middle'>
132 <table
class='w-100 h-100' style
='border-left:1px solid;'>
135 <div
class="text-center">
136 <div
class="btn-group" role
="group">
137 <a href
='#' class='btn btn-secondary btn-save' onclick
='$("#form_refresh").attr("value","true"); $("#theform").submit();'>
138 <?php
echo xlt('Submit'); ?
>
140 <?php
if (!empty($_POST['form_refresh']) ||
!empty($ptrow)) { ?
>
141 <a href
='#' class='btn btn-secondary btn-print' id
='printbutton'>
142 <?php
echo xlt('Print'); ?
>
154 </div
> <!-- end of parameters
-->
157 if (!empty($_POST['form_refresh']) ||
!empty($ptrow)) {
159 <div id
="report_results">
160 <table
class='table'>
161 <thead
class='thead-light'>
162 <th
> <?php
echo xlt('Time'); ?
> </th
>
163 <th
> <?php
echo xlt('Destination'); ?
> </th
>
168 if (!empty($ptrow)) {
169 $res = PatientService
::getChartTrackerInformationActivity($curr_pid);
170 while ($row = sqlFetchArray($res)) {
174 <?php
echo text(oeFormatDateTime($row['ct_when'], "global", true)); ?
>
178 if (!empty($row['ct_location'])) {
179 echo generate_display_field(array('data_type' => '1','list_id' => 'chartloc'), $row['ct_location']);
180 } elseif (!empty($row['ct_userid'])) {
181 echo text($row['lname']) . ', ' . text($row['fname']) . ' ' . text($row['mname']);
192 </div
> <!-- end of results
-->
195 <?php
echo xlt('Please input search criteria above, and click Submit to view results.'); ?
>