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.
10 use OpenEMR\Core\Header
;
12 require_once("../globals.php");
13 require_once("$srcdir/patient.inc");
18 <title
><?php
xl('Charts Checked Out', 'e'); ?
></title
>
20 <?php Header
::setupHeader(); ?
>
22 <style type
="text/css">
24 /* specifically include & exclude from printing */
30 #report_parameters_daterange {
34 #report_results table {
39 /* specifically exclude some from the screen */
41 #report_parameters_daterange {
50 <body
class="body_top">
52 <span
class='title'><?php
xl('Report', 'e'); ?
> - <?php
xl('Charts Checked Out', 'e'); ?
></span
>
54 <div id
="report_results">
57 /*********************************************************************
58 $query = "SELECT ct.ct_when, " .
59 "u.username, u.fname AS ufname, u.mname AS umname, u.lname AS ulname, " .
60 "p.pubpid, p.fname, p.mname, p.lname " .
61 "FROM chart_tracker AS ct " .
62 "LEFT OUTER JOIN users AS u ON u.id = ct.ct_userid " .
63 "LEFT OUTER JOIN patient_data AS p ON p.pid = ct.ct_pid " .
64 "WHERE (ct.ct_pid, ct.ct_when) in " .
65 "(SELECT ct_pid, MAX(ct_when) FROM chart_tracker GROUP BY ct_pid) " .
66 "AND ct.ct_userid != 0 " .
68 *********************************************************************/
70 // Oops, the above requires MySQL 4.1 or later and so it was rewritten
71 // as follows to use a temporary table.
73 sqlStatement("DROP TEMPORARY TABLE IF EXISTS cttemp");
74 sqlStatement("CREATE TEMPORARY TABLE cttemp SELECT " .
75 "ct_pid, MAX(ct_when) AS ct_when FROM chart_tracker GROUP BY ct_pid");
76 $res = \services\PatientService
::getChartTrackerInformation();
78 while ($row = sqlFetchArray($res)) {
79 if ($data_ctr == 0) { ?
>
82 <th
> <?php
xl('Chart', 'e'); ?
> </th
>
83 <th
> <?php
xl('Patient', 'e'); ?
> </th
>
84 <th
> <?php
xl('Location', 'e'); ?
> </th
>
85 <th
> <?php
xl('As Of', 'e'); ?
> </th
>
93 <?php
echo $row['pubpid']; ?
>
96 <?php
echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname']; ?
>
99 <?php
echo $row['ulname'] . ', ' . $row['ufname'] . ' ' . $row['umname']; ?
>
102 <?php
echo oeFormatShortDate(substr($row['ct_when'], 0, 10)) . substr($row['ct_when'], 10); ?
>
110 if ($data_ctr < 1) { ?
>
111 <span
class='text'><?php
xl('There are no charts checked out.', 'e'); ?
></span
>
118 </div
> <!-- end of results
-->