2 // Copyright (C) 2008-2010 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This reports checkins and checkouts for a specified patient's chart.
11 require_once("../globals.php");
12 require_once("$srcdir/patient.inc");
14 use OpenEMR\Core\Header
;
15 use OpenEMR\Services\PatientService
;
21 <title
><?php
xl('Charts Checked Out', 'e'); ?
></title
>
23 <?php Header
::setupHeader(); ?
>
25 <style type
="text/css">
27 /* specifically include & exclude from printing */
33 #report_parameters_daterange {
37 #report_results table {
42 /* specifically exclude some from the screen */
44 #report_parameters_daterange {
53 <body
class="body_top">
55 <span
class='title'><?php
xl('Report', 'e'); ?
> - <?php
xl('Charts Checked Out', 'e'); ?
></span
>
57 <div id
="report_results">
60 /*********************************************************************
61 $query = "SELECT ct.ct_when, " .
62 "u.username, u.fname AS ufname, u.mname AS umname, u.lname AS ulname, " .
63 "p.pubpid, p.fname, p.mname, p.lname " .
64 "FROM chart_tracker AS ct " .
65 "LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid " .
66 "LEFT OUTER JOIN patient_data AS p ON p.pid = ct.ct_pid " .
67 "WHERE (ct.ct_pid, ct.ct_when) in " .
68 "(SELECT ct_pid, MAX(ct_when) FROM chart_tracker GROUP BY ct_pid) " .
69 "AND ct.ct_userid != 0 " .
71 *********************************************************************/
73 // Oops, the above requires MySQL 4.1 or later and so it was rewritten
74 // as follows to use a temporary table.
76 sqlStatement("DROP TEMPORARY TABLE IF EXISTS cttemp");
77 sqlStatement("CREATE TEMPORARY TABLE cttemp SELECT " .
78 "ct_pid, MAX(ct_when) AS ct_when FROM chart_tracker GROUP BY ct_pid");
79 $res = PatientService
::getChartTrackerInformation();
81 while ($row = sqlFetchArray($res)) {
82 if ($data_ctr == 0) { ?
>
85 <th
> <?php
xl('Chart', 'e'); ?
> </th
>
86 <th
> <?php
xl('Patient', 'e'); ?
> </th
>
87 <th
> <?php
xl('Location', 'e'); ?
> </th
>
88 <th
> <?php
xl('As Of', 'e'); ?
> </th
>
96 <?php
echo $row['pubpid']; ?
>
99 <?php
echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname']; ?
>
102 <?php
echo $row['ulname'] . ', ' . $row['ufname'] . ' ' . $row['umname']; ?
>
105 <?php
echo text(oeFormatShortDate(substr($row['ct_when'], 0, 10))) . substr($row['ct_when'], 10); ?
>
113 if ($data_ctr < 1) { ?
>
114 <span
class='text'><?php
xl('There are no charts checked out.', 'e'); ?
></span
>
121 </div
> <!-- end of results
-->