immun updates (#4145)
[openemr.git] / interface / reports / report_results.php
blob87bfc772ac5643197cd438e850c0468e995aef39
1 <?php
3 /**
4 * Generic script to list stored reports. Part of the module to allow the tracking,
5 * storing, and viewing of reports.
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2012-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("../../library/patient.inc");
16 require_once "$srcdir/options.inc.php";
17 require_once "$srcdir/clinical_rules.php";
18 require_once "$srcdir/report_database.inc";
20 use OpenEMR\Common\Csrf\CsrfUtils;
21 use OpenEMR\Core\Header;
23 if (!empty($_POST)) {
24 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
25 CsrfUtils::csrfNotVerified();
29 $form_begin_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_begin_date'] ?? '');
30 $form_end_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_end_date'] ?? '');
33 <html>
35 <head>
37 <title><?php echo xlt('Report Results/History'); ?></title>
39 <?php Header::setupHeader('datetime-picker'); ?>
41 <script>
42 $(function () {
43 $('.datepicker').datetimepicker({
44 <?php $datetimepicker_timepicker = true; ?>
45 <?php $datetimepicker_showseconds = true; ?>
46 <?php $datetimepicker_formatInput = true; ?>
47 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
48 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
49 });
50 });
51 </script>
53 <style>
54 /* specifically include & exclude from printing */
55 @media print {
56 #report_parameters {
57 visibility: hidden;
58 display: none;
60 #report_parameters_daterange {
61 visibility: visible;
62 display: inline;
64 #report_results table {
65 margin-top: 0;
69 /* specifically exclude some from the screen */
70 @media screen {
71 #report_parameters_daterange {
72 visibility: hidden;
73 display: none;
76 </style>
77 </head>
79 <body class="body_top">
81 <!-- Required for the popup date selectors -->
82 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
84 <span class='title'><?php echo xlt('Report History/Results'); ?></span>
86 <form method='post' name='theform' id='theform' action='report_results.php' onsubmit='return top.restoreSession()'>
87 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
89 <div id="report_parameters">
91 <table>
92 <tr>
93 <td width='470px'>
94 <div class="float-left">
96 <table class='text'>
98 <tr>
99 <td class='col-form-label'>
100 <?php echo xlt('Begin Date'); ?>:
101 </td>
102 <td>
103 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, 0, true)); ?>'
104 class='datepicker form-control' />
105 </td>
106 </tr>
108 <tr>
109 <td class='col-form-label'>
110 <?php echo xlt('End Date'); ?>:
111 </td>
112 <td>
113 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, 0, true)); ?>'
114 class='datepicker form-control' />
115 </td>
116 </tr>
117 </table>
118 </div>
120 </td>
121 <td class='h-100' align='left' valign='middle'>
122 <table class='w-100 h-100' style='border-left: 1px solid;'>
123 <tr>
124 <td>
125 <div class="text-center">
126 <div class="btn-group" role="group">
127 <a href='#' id='search_button' class='btn btn-secondary btn-search' onclick='top.restoreSession(); $("#theform").submit()'>
128 <?php echo xlt('Search'); ?>
129 </a>
130 <a href='#' id='refresh_button' class='btn btn-secondary btn-refresh' onclick='top.restoreSession(); $("#theform").submit()'>
131 <?php echo xlt('Refresh'); ?>
132 </a>
133 </div>
134 </div>
135 </td>
136 </tr>
137 </table>
138 </td>
139 </tr>
140 </table>
142 </div> <!-- end of search parameters -->
144 <br />
148 <div id="report_results">
149 <table class='table'>
151 <thead class='thead-light'>
152 <th class='text-center'>
153 <?php echo xlt('Title'); ?>
154 </th>
156 <th class='text-center'>
157 <?php echo xlt('Date'); ?>
158 </th>
160 <th class='text-center'>
161 <?php echo xlt('Status'); ?>
162 </th>
164 </thead>
165 <tbody> <!-- added for better print-ability -->
166 <?php
168 $res = listingReportDatabase($form_begin_date, $form_end_date);
169 while ($row = sqlFetchArray($res)) {
170 // Figure out the title and link
171 if ($row['type'] == "cqm") {
172 if (!$GLOBALS['enable_cqm']) {
173 continue;
176 $type_title = xl('Clinical Quality Measures (CQM)');
177 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
178 } elseif ($row['type'] == "cqm_2011") {
179 if (!$GLOBALS['enable_cqm']) {
180 continue;
183 $type_title = xl('2011 Clinical Quality Measures (CQM)');
184 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
185 } elseif ($row['type'] == "cqm_2014") {
186 if (!$GLOBALS['enable_cqm']) {
187 continue;
190 $type_title = xl('2014 Clinical Quality Measures (CQM)');
191 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
192 } elseif ($row['type'] == "amc") {
193 if (!$GLOBALS['enable_amc']) {
194 continue;
197 $type_title = xl('Automated Measure Calculations (AMC)');
198 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
199 } elseif ($row['type'] == "amc_2011") {
200 if (!$GLOBALS['enable_amc']) {
201 continue;
204 $type_title = xl('2011 Automated Measure Calculations (AMC)');
205 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
206 } elseif ($row['type'] == "amc_2014") {
207 if (!$GLOBALS['enable_amc']) {
208 continue;
211 $type_title = xl('2014 Automated Measure Calculations (AMC)');
212 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
213 } elseif ($row['type'] == "amc_2014_stage1") {
214 if (!$GLOBALS['enable_amc']) {
215 continue;
218 $type_title = xl('2014 Automated Measure Calculations (AMC) - Stage I');
219 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
220 } elseif ($row['type'] == "amc_2014_stage2") {
221 if (!$GLOBALS['enable_amc']) {
222 continue;
225 $type_title = xl('2014 Automated Measure Calculations (AMC) - Stage II');
226 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
227 } elseif ($row['type'] == "process_reminders") {
228 if (!$GLOBALS['enable_cdr']) {
229 continue;
232 $type_title = xl('Processing Patient Reminders');
233 $link = "../batchcom/batch_reminders.php?report_id=" . attr_url($row["report_id"]);
234 } elseif ($row['type'] == "process_send_reminders") {
235 if (!$GLOBALS['enable_cdr']) {
236 continue;
239 $type_title = xl('Processing and Sending Patient Reminders');
240 $link = "../batchcom/batch_reminders.php?report_id=" . attr_url($row["report_id"]);
241 } elseif ($row['type'] == "passive_alert") {
242 if (!$GLOBALS['enable_cdr']) {
243 continue;
246 $type_title = xl('Standard Measures (Passive Alerts)');
247 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
248 } elseif ($row['type'] == "active_alert") {
249 if (!$GLOBALS['enable_cdr']) {
250 continue;
253 $type_title = xl('Standard Measures (Active Alerts)');
254 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
255 } elseif ($row['type'] == "patient_reminder") {
256 if (!$GLOBALS['enable_cdr']) {
257 continue;
260 $type_title = xl('Standard Measures (Patient Reminders)');
261 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
262 } else {
263 // Not identified, so give an unknown title
264 $type_title = xl('Unknown') . "-" . $row['type'];
265 $link = "";
268 <tr>
269 <?php if ($row["progress"] == "complete") { ?>
270 <td class='text-center'><a href='<?php echo $link; ?>' onclick='top.restoreSession()'><?php echo text($type_title); ?></a></td>
271 <?php } else { ?>
272 <td class='text-center'><?php echo text($type_title); ?></td>
273 <?php } ?>
274 <td class='text-center'><?php echo text(oeFormatDateTime($row["date_report"], "global", true)); ?></td>
275 <?php if ($row["progress"] == "complete") { ?>
276 <td class='text-center'><?php echo xlt("Complete") . " (" . xlt("Processing Time") . ": " . text($row['report_time_processing']) . " " . xlt("Minutes") . ")"; ?></td>
277 <?php } else { ?>
278 <td class='text-center'><?php echo xlt("Pending") . " (" . text($row["progress_items"]) . " / " . text($row["total_items"]) . " " . xlt("Patients Processed") . ")"; ?></td>
279 <?php } ?>
281 </tr>
283 <?php
284 } // $row = sqlFetchArray($res) while
286 </tbody>
287 </table>
288 </div> <!-- end of search results -->
290 </form>
292 </body>
294 </html>