4 * Generic script to list stored reports. Part of the module to allow the tracking,
5 * storing, and viewing of reports.
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")]);
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'] ??
'');
45 <title
><?php
echo xlt('Report Results/History'); ?
></title
>
47 <?php Header
::setupHeader('datetime-picker'); ?
>
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 ?>
62 /* specifically include & exclude from printing */
68 #report_parameters_daterange {
72 #report_results table {
77 /* specifically exclude some from the screen */
79 #report_parameters_daterange {
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">
102 <div
class="float-left">
107 <td
class='col-form-label'>
108 <?php
echo xlt('Begin Date'); ?
>:
111 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr(oeFormatDateTime($form_begin_date, 0, true)); ?>'
112 class='datepicker form-control' />
117 <td
class='col-form-label'>
118 <?php
echo xlt('End Date'); ?
>:
121 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr(oeFormatDateTime($form_end_date, 0, true)); ?>'
122 class='datepicker form-control' />
129 <td
class='h-100' align
='left' valign
='middle'>
130 <table
class='w-100 h-100' style
='border-left: 1px solid;'>
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'); ?
>
138 <a href
='#' id
='refresh_button' class='btn btn-secondary btn-refresh' onclick
='top.restoreSession(); $("#theform").submit()'>
139 <?php
echo xlt('Refresh'); ?
>
150 </div
> <!-- end of search parameters
-->
156 <div id
="report_results">
157 <table
class='table'>
159 <thead
class='thead-light'>
160 <th
class='text-center'>
161 <?php
echo xlt('Title'); ?
>
164 <th
class='text-center'>
165 <?php
echo xlt('Date'); ?
>
168 <th
class='text-center'>
169 <?php
echo xlt('Status'); ?
>
173 <tbody
> <!-- added
for better
print-ability
-->
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']) {
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']) {
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']) {
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']) {
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']) {
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']) {
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']) {
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']) {
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']) {
242 $type_title = xl('Standard Measures (Patient Reminders)');
243 $link = "cqm.php?report_id=" . attr_url($row["report_id"]) . "&back=list";
245 // Not identified, so give an unknown title
246 $type_title = xl('Unknown') . "-" . $row['type'];
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
>
254 <td
class='text-center'><?php
echo text($type_title); ?
></td
>
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
>
260 <td
class='text-center'><?php
echo xlt("Pending") . " (" . text($row["progress_items"]) . " / " . text($row["total_items"]) . " " . xlt("Patients Processed") . ")"; ?
></td
>
266 } // $row = sqlFetchArray($res) while
270 </div
> <!-- end of search results
-->