More security fixes Sc/security fixes (#1278)
[openemr.git] / interface / reports / charts_checked_out.php
blob1c039e5921aa3f5b3b41a4793fc5fed98c875510
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.
11 require_once("../globals.php");
12 require_once("$srcdir/patient.inc");
14 use OpenEMR\Core\Header;
15 use OpenEMR\Services\PatientService;
18 <html>
19 <head>
21 <title><?php xl('Charts Checked Out', 'e'); ?></title>
23 <?php Header::setupHeader(); ?>
25 <style type="text/css">
27 /* specifically include & exclude from printing */
28 @media print {
29 #report_parameters {
30 visibility: hidden;
31 display: none;
33 #report_parameters_daterange {
34 visibility: visible;
35 display: inline;
37 #report_results table {
38 margin-top: 0px;
42 /* specifically exclude some from the screen */
43 @media screen {
44 #report_parameters_daterange {
45 visibility: hidden;
46 display: none;
50 </style>
51 </head>
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">
58 <br/>
59 <?php
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 " .
70 "ORDER BY p.pubpid";
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();
80 $data_ctr = 0;
81 while ($row = sqlFetchArray($res)) {
82 if ($data_ctr == 0) { ?>
83 <table>
84 <thead>
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>
89 </thead>
90 <tbody>
91 <?php
92 } ?>
94 <tr>
95 <td>
96 <?php echo $row['pubpid']; ?>
97 </td>
98 <td>
99 <?php echo $row['lname'] . ', ' . $row['fname'] . ' ' . $row['mname']; ?>
100 </td>
101 <td>
102 <?php echo $row['ulname'] . ', ' . $row['ufname'] . ' ' . $row['umname']; ?>
103 </td>
104 <td>
105 <?php echo text(oeFormatShortDate(substr($row['ct_when'], 0, 10))) . substr($row['ct_when'], 10); ?>
106 </td>
107 </tr>
108 <?php
110 $data_ctr++;
111 } // end while
113 if ($data_ctr < 1) { ?>
114 <span class='text'><?php xl('There are no charts checked out.', 'e'); ?></span>
115 <?php
119 </tbody>
120 </table>
121 </div> <!-- end of results -->
122 </body>
123 </html>