Highway to PSR2
[openemr.git] / interface / reports / charts_checked_out.php
blob85700f32fe3192f0595a6e847dbb68d45f5b4ea2
1 <?php
2 // Copyright (C) 2008-2010 Rod Roark <rod@sunsetsystems.com>
3 //
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");
15 <html>
16 <head>
18 <title><?php xl('Charts Checked Out', 'e'); ?></title>
20 <?php Header::setupHeader(); ?>
22 <style type="text/css">
24 /* specifically include & exclude from printing */
25 @media print {
26 #report_parameters {
27 visibility: hidden;
28 display: none;
30 #report_parameters_daterange {
31 visibility: visible;
32 display: inline;
34 #report_results table {
35 margin-top: 0px;
39 /* specifically exclude some from the screen */
40 @media screen {
41 #report_parameters_daterange {
42 visibility: hidden;
43 display: none;
47 </style>
48 </head>
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">
55 <br/>
56 <?php
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 " .
67 "ORDER BY p.pubpid";
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();
77 $data_ctr = 0;
78 while ($row = sqlFetchArray($res)) {
79 if ($data_ctr == 0) { ?>
80 <table>
81 <thead>
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>
86 </thead>
87 <tbody>
88 <?php
89 } ?>
91 <tr>
92 <td>
93 <?php echo $row['pubpid']; ?>
94 </td>
95 <td>
96 <?php echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname']; ?>
97 </td>
98 <td>
99 <?php echo $row['ulname'] . ', ' . $row['ufname'] . ' ' . $row['umname']; ?>
100 </td>
101 <td>
102 <?php echo oeFormatShortDate(substr($row['ct_when'], 0, 10)) . substr($row['ct_when'], 10); ?>
103 </td>
104 </tr>
105 <?php
107 $data_ctr++;
108 } // end while
110 if ($data_ctr < 1) { ?>
111 <span class='text'><?php xl('There are no charts checked out.', 'e'); ?></span>
112 <?php
116 </tbody>
117 </table>
118 </div> <!-- end of results -->
119 </body>
120 </html>