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-2010 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");
18 use OpenEMR\Core\Header
;
19 use OpenEMR\Services\PatientService
;
24 <title
><?php
echo xlt('Charts Checked Out'); ?
></title
>
26 <?php Header
::setupHeader(); ?
>
30 /* specifically include & exclude from printing */
36 #report_parameters_daterange {
40 #report_results table {
45 /* specifically exclude some from the screen */
47 #report_parameters_daterange {
56 <body
class="body_top">
58 <span
class='title'><?php
echo xlt('Report'); ?
> - <?php
echo xlt('Charts Checked Out'); ?
></span
>
60 <div id
="report_results">
63 /*********************************************************************
64 $query = "SELECT ct.ct_when, " .
65 "u.username, u.fname AS ufname, u.mname AS umname, u.lname AS ulname, " .
66 "p.pubpid, p.fname, p.mname, p.lname " .
67 "FROM chart_tracker AS ct " .
68 "LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid " .
69 "LEFT OUTER JOIN patient_data AS p ON p.pid = ct.ct_pid " .
70 "WHERE (ct.ct_pid, ct.ct_when) in " .
71 "(SELECT ct_pid, MAX(ct_when) FROM chart_tracker GROUP BY ct_pid) " .
72 "AND ct.ct_userid != 0 " .
74 *********************************************************************/
76 // Oops, the above requires MySQL 4.1 or later and so it was rewritten
77 // as follows to use a temporary table.
79 sqlStatement("DROP TEMPORARY TABLE IF EXISTS cttemp");
80 sqlStatement("CREATE TEMPORARY TABLE cttemp SELECT " .
81 "ct_pid, MAX(ct_when) AS ct_when FROM chart_tracker GROUP BY ct_pid");
82 $res = PatientService
::getChartTrackerInformation();
84 while ($row = sqlFetchArray($res)) {
85 if ($data_ctr == 0) { ?
>
87 <thead
class='thead-light'>
88 <th
> <?php
echo xlt('Chart'); ?
> </th
>
89 <th
> <?php
echo xlt('Patient'); ?
> </th
>
90 <th
> <?php
echo xlt('Location'); ?
> </th
>
91 <th
> <?php
echo xlt('As Of'); ?
> </th
>
99 <?php
echo text($row['pubpid']); ?
>
102 <?php
echo text($row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname']); ?
>
105 <?php
echo text($row['ulname'] . ', ' . $row['ufname'] . ' ' . $row['umname']); ?
>
108 <?php
echo text(oeFormatDateTime($row['ct_when'], "global", true)); ?
>
116 if ($data_ctr < 1) { ?
>
117 <span
class='text'><?php
echo xla('There are no charts checked out.'); ?
></span
>
124 </div
> <!-- end of results
-->