Feat openemr fix 7480 7494 email prescription (#7495)
[openemr.git] / interface / reports / report_results.php
blob2041dd417dc06f17c0dde795f922f1560eea007b
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.php");
16 require_once "$srcdir/options.inc.php";
17 require_once "$srcdir/clinical_rules.php";
18 require_once "$srcdir/report_database.inc.php";
20 use OpenEMR\ClinicialDecisionRules\AMC\CertificationReportTypes;
21 use OpenEMR\Common\Acl\AclMain;
22 use OpenEMR\Common\Csrf\CsrfUtils;
23 use OpenEMR\Common\Twig\TwigContainer;
24 use OpenEMR\Core\Header;
26 if (!AclMain::aclCheckCore('patients', 'med')) {
27 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Report Results/History")]);
28 exit;
31 if (!empty($_POST)) {
32 if (!CsrfUtils::verifyCsrfToken($_POST["csrf_token_form"])) {
33 CsrfUtils::csrfNotVerified();
37 $form_begin_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_begin_date'] ?? '');
38 $form_end_date = DateTimeToYYYYMMDDHHMMSS($_POST['form_end_date'] ?? '');
41 <html>
43 <head>
45 <title><?php echo xlt('Report Results/History'); ?></title>
47 <?php Header::setupHeader('datetime-picker'); ?>
49 <script>
50 $(function () {
51 $('.datepicker').datetimepicker({
52 <?php $datetimepicker_timepicker = true; ?>
53 <?php $datetimepicker_showseconds = true; ?>
54 <?php $datetimepicker_formatInput = true; ?>
55 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
56 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
57 });
58 });
59 </script>
61 <style>
62 /* specifically include & exclude from printing */
63 @media print {
64 #report_parameters {
65 visibility: hidden;
66 display: none;
68 #report_parameters_daterange {
69 visibility: visible;
70 display: inline;
72 #report_results table {
73 margin-top: 0;
77 /* specifically exclude some from the screen */
78 @media screen {
79 #report_parameters_daterange {
80 visibility: hidden;
81 display: none;
84 </style>
85 </head>
87 <body class="body_top">
89 <!-- Required for the popup date selectors -->
90 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
92 <span class='title'><?php echo xlt('Report History/Results'); ?></span>
94 <form method='post' name='theform' id='theform' action='report_results.php' onsubmit='return top.restoreSession()'>
95 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
97 <div id="report_parameters">
99 <table>
100 <tr>
101 <td width='470px'>
102 <div class="float-left">
104 <table class='text'>
106 <tr>
107 <td class='col-form-label'>
108 <?php echo xlt('Begin Date'); ?>:
109 </td>
110 <td>
111 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr(oeFormatDateTime($form_begin_date, "global", true)); ?>'
112 class='datepicker form-control' />
113 </td>
114 </tr>
116 <tr>
117 <td class='col-form-label'>
118 <?php echo xlt('End Date'); ?>:
119 </td>
120 <td>
121 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr(oeFormatDateTime($form_end_date, "global", true)); ?>'
122 class='datepicker form-control' />
123 </td>
124 </tr>
125 </table>
126 </div>
128 </td>
129 <td class='h-100' align='left' valign='middle'>
130 <table class='w-100 h-100' style='border-left: 1px solid;'>
131 <tr>
132 <td>
133 <div class="text-center">
134 <div class="btn-group" role="group">
135 <a href='#' id='search_button' class='btn btn-secondary btn-search' onclick='top.restoreSession(); $("#theform").submit()'>
136 <?php echo xlt('Search'); ?>
137 </a>
138 <a href='#' id='refresh_button' class='btn btn-secondary btn-refresh' onclick='top.restoreSession(); $("#theform").submit()'>
139 <?php echo xlt('Refresh'); ?>
140 </a>
141 </div>
142 </div>
143 </td>
144 </tr>
145 </table>
146 </td>
147 </tr>
148 </table>
150 </div> <!-- end of search parameters -->
152 <br />
156 <div id="report_results">
157 <table class='table'>
159 <thead class='thead-light'>
160 <th class='text-center'>
161 <?php echo xlt('Title'); ?>
162 </th>
164 <th class='text-center'>
165 <?php echo xlt('Date'); ?>
166 </th>
168 <th class='text-center'>
169 <?php echo xlt('Status'); ?>
170 </th>
172 </thead>
173 <tbody> <!-- added for better print-ability -->
174 <?php
176 $amc_report_types = CertificationReportTypes::getReportTypeRecords();
178 $res = listingReportDatabase($form_begin_date, $form_end_date);
179 while ($row = sqlFetchArray($res)) {
180 // Figure out the title and link
181 if ($row['type'] == "cqm") {
182 if (!$GLOBALS['enable_cqm']) {
183 continue;
186 $type_title = xl('Clinical Quality Measures (CQM)');
187 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
188 } elseif ($row['type'] == "cqm_2011") {
189 if (!$GLOBALS['enable_cqm']) {
190 continue;
193 $type_title = xl('2011 Clinical Quality Measures (CQM)');
194 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
195 } elseif ($row['type'] == "cqm_2014") {
196 if (!$GLOBALS['enable_cqm']) {
197 continue;
200 $type_title = xl('2014 Clinical Quality Measures (CQM)');
201 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
202 } elseif (CertificationReportTypes::isAMCReportType($row['type'])) {
203 if (!$GLOBALS['enable_amc']) {
204 continue;
206 $record = $amc_report_types[$row['type']];
207 $type_title = $record['ruleset_title'];
208 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
209 } elseif ($row['type'] == "process_reminders") {
210 if (!$GLOBALS['enable_cdr']) {
211 continue;
214 $type_title = xl('Processing Patient Reminders');
215 $link = "../batchcom/batch_reminders.php?report_id=" . attr_url($row["report_id"]);
216 } elseif ($row['type'] == "process_send_reminders") {
217 if (!$GLOBALS['enable_cdr']) {
218 continue;
221 $type_title = xl('Processing and Sending Patient Reminders');
222 $link = "../batchcom/batch_reminders.php?report_id=" . attr_url($row["report_id"]);
223 } elseif ($row['type'] == "passive_alert") {
224 if (!$GLOBALS['enable_cdr']) {
225 continue;
228 $type_title = xl('Standard Measures (Passive Alerts)');
229 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
230 } elseif ($row['type'] == "active_alert") {
231 if (!$GLOBALS['enable_cdr']) {
232 continue;
235 $type_title = xl('Standard Measures (Active Alerts)');
236 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
237 } elseif ($row['type'] == "patient_reminder") {
238 if (!$GLOBALS['enable_cdr']) {
239 continue;
242 $type_title = xl('Standard Measures (Patient Reminders)');
243 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
244 } else {
245 // Not identified, so give an unknown title
246 $type_title = xl('Unknown') . "-" . $row['type'];
247 $link = "";
250 <tr>
251 <?php if ($row["progress"] == "complete") { ?>
252 <td class='text-center'><a href='<?php echo $link; ?>' onclick='top.restoreSession()'><?php echo text($type_title); ?></a></td>
253 <?php } else { ?>
254 <td class='text-center'><?php echo text($type_title); ?></td>
255 <?php } ?>
256 <td class='text-center'><?php echo text(oeFormatDateTime($row["date_report"], "global", true)); ?></td>
257 <?php if ($row["progress"] == "complete") { ?>
258 <td class='text-center'><?php echo xlt("Complete") . " (" . xlt("Processing Time") . ": " . text($row['report_time_processing']) . " " . xlt("Minutes") . ")"; ?></td>
259 <?php } else { ?>
260 <td class='text-center'><?php echo xlt("Pending") . " (" . text($row["progress_items"]) . " / " . text($row["total_items"]) . " " . xlt("Patients Processed") . ")"; ?></td>
261 <?php } ?>
263 </tr>
265 <?php
266 } // $row = sqlFetchArray($res) while
268 </tbody>
269 </table>
270 </div> <!-- end of search results -->
272 </form>
274 </body>
276 </html>