Improved/optimized CDR engine reports (and patient reminders) and added a
[openemr.git] / interface / reports / report_results.php
blobb09b376d984751f843de73d94108600e5c83fe67
1 <?php
2 /**
3 * Generic script to list stored reports. Part of the module to allow the tracking,
4 * storing, and viewing of reports.
6 * Copyright (C) 2012 Brady Miller <brady@sparmy.com>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Brady Miller <brady@sparmy.com>
21 * @link http://www.open-emr.org
24 //SANITIZE ALL ESCAPES
25 $sanitize_all_escapes=true;
28 //STOP FAKE REGISTER GLOBALS
29 $fake_register_globals=false;
32 require_once("../globals.php");
33 require_once("../../library/patient.inc");
34 require_once("$srcdir/formatting.inc.php");
35 require_once "$srcdir/options.inc.php";
36 require_once "$srcdir/formdata.inc.php";
37 require_once "$srcdir/clinical_rules.php";
38 require_once "$srcdir/report_database.inc";
41 <html>
43 <head>
44 <?php html_header_show();?>
46 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
48 <title><?php echo htmlspecialchars( xl('Report Results/History'), ENT_NOQUOTES); ?></title>
50 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
51 <script type="text/javascript" src="../../library/textformat.js"></script>
52 <script type="text/javascript" src="../../library/dialog.js"></script>
53 <script type="text/javascript" src="../../library/js/jquery.1.3.2.js"></script>
55 <script LANGUAGE="JavaScript">
57 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
59 </script>
61 <style type="text/css">
63 /* specifically include & exclude from printing */
64 @media print {
65 #report_parameters {
66 visibility: hidden;
67 display: none;
69 #report_parameters_daterange {
70 visibility: visible;
71 display: inline;
73 #report_results table {
74 margin-top: 0px;
78 /* specifically exclude some from the screen */
79 @media screen {
80 #report_parameters_daterange {
81 visibility: hidden;
82 display: none;
86 </style>
87 </head>
89 <body class="body_top">
91 <!-- Required for the popup date selectors -->
92 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
94 <span class='title'><?php echo htmlspecialchars( xl('Report History/Results'), ENT_NOQUOTES); ?></span>
96 <form method='post' name='theform' id='theform' action='report_results.php' onsubmit='return top.restoreSession()'>
98 <div id="report_parameters">
100 <table>
101 <tr>
102 <td width='470px'>
103 <div style='float:left'>
105 <table class='text'>
107 <tr>
108 <td class='label'>
109 <?php echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES); ?>:
110 </td>
111 <td>
112 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo htmlspecialchars( $_POST['form_begin_date'], ENT_QUOTES); ?>'
113 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
114 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
115 id='img_begin_date' border='0' alt='[?]' style='cursor:pointer'
116 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
117 </td>
118 </tr>
120 <tr>
121 <td class='label'>
122 <?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES); ?>:
123 </td>
124 <td>
125 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo htmlspecialchars( $_POST['form_end_date'], ENT_QUOTES); ?>'
126 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
127 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
128 id='img_end_date' border='0' alt='[?]' style='cursor:pointer'
129 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
130 </td>
131 </tr>
132 </table>
133 </div>
135 </td>
136 <td align='left' valign='middle' height="100%">
137 <table style='border-left:1px solid; width:100%; height:100%' >
138 <tr>
139 <td>
140 <div style='margin-left:15px'>
141 <a id='search_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
142 <span>
143 <?php echo htmlspecialchars( xl('Search'), ENT_NOQUOTES); ?>
144 </span>
145 </a>
146 <a id='refresh_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
147 <span>
148 <?php echo htmlspecialchars( xl('Refresh'), ENT_NOQUOTES); ?>
149 </span>
150 </a>
151 </div>
152 </td>
153 </tr>
154 </table>
155 </td>
156 </tr>
157 </table>
159 </div> <!-- end of search parameters -->
161 <br>
165 <div id="report_results">
166 <table>
168 <thead>
169 <th align='center'>
170 <?php echo htmlspecialchars( xl('Title'), ENT_NOQUOTES); ?>
171 </th>
173 <th align='center'>
174 <?php echo htmlspecialchars( xl('Date'), ENT_NOQUOTES); ?>
175 </th>
177 <th align='center'>
178 <?php echo htmlspecialchars( xl('Status'), ENT_NOQUOTES); ?>
179 </th>
181 </thead>
182 <tbody> <!-- added for better print-ability -->
183 <?php
185 $res = listingReportDatabase($_POST['form_begin_date'],$_POST['form_end_date']);
186 while ($row = sqlFetchArray($res)) {
188 // Figure out the title and link
189 if ($row['type'] == "cqm") {
190 if (!$GLOBALS['enable_cqm']) continue;
191 $type_title = xl('Clinical Quality Measures (CQM)');
192 $link="cqm.php?report_id=" . attr($row["report_id"]) . "&back=list";
194 else if ($row['type'] == "amc") {
195 if (!$GLOBALS['enable_amc']) continue;
196 $type_title = xl('Automated Measure Calculations (AMC)');
197 $link="cqm.php?report_id=" . attr($row["report_id"]) . "&back=list";
199 else if ($row['type'] == "process_reminders") {
200 if (!$GLOBALS['enable_cdr']) continue;
201 $type_title = xl('Processing Patient Reminders');
202 $link="../batchcom/batch_reminders.php?report_id=" . attr($row["report_id"]);
204 else if ($row['type'] == "process_send_reminders") {
205 if (!$GLOBALS['enable_cdr']) continue;
206 $type_title = xl('Processing and Sending Patient Reminders');
207 $link="../batchcom/batch_reminders.php?report_id=" . attr($row["report_id"]);
209 else if ($row['type'] == "passive_alert") {
210 if (!$GLOBALS['enable_cdr']) continue;
211 $type_title = xl('Standard Measures (Passive Alerts)');
212 $link="cqm.php?report_id=" . attr($row["report_id"]) . "&back=list";
214 else if ($row['type'] == "active_alert") {
215 if (!$GLOBALS['enable_cdr']) continue;
216 $type_title = xl('Standard Measures (Active Alerts)');
217 $link="cqm.php?report_id=" . attr($row["report_id"]) . "&back=list";
219 else if ($row['type'] == "patient_reminder") {
220 if (!$GLOBALS['enable_cdr']) continue;
221 $type_title = xl('Standard Measures (Patient Reminders)');
222 $link="cqm.php?report_id=" . attr($row["report_id"]) . "&back=list";
224 else {
225 // Not identified, so give an unknown title
226 $type_title = xl('Unknown');
227 $link="";
230 <tr>
231 <?php if ($row["progress"] == "complete") { ?>
232 <td align='center'><a href='<?php echo $link; ?>' onclick='top.restoreSession()'><?php echo text($type_title); ?></a></td>
233 <?php } else { ?>
234 <td align='center'><?php echo text($type_title); ?></td>
235 <?php } ?>
236 <td align='center'><?php echo text($row["date_report"]); ?></td>
237 <?php if ($row["progress"] == "complete") { ?>
238 <td align='center'><?php echo xlt("Complete") . " (" . xlt("Processing Time") . ": " . text($row['report_time_processing']) . " " . xlt("Minutes") . ")"; ?></td>
239 <?php } else { ?>
240 <td align='center'><?php echo xlt("Pending") . " (" . text($row["progress_items"]) . " / " . text($row["total_items"]) . " " . xlt("Patients Processed") . ")"; ?></td>
241 <?php } ?>
243 </tr>
245 <?php
246 } // $row = sqlFetchArray($res) while
248 </tbody>
249 </table>
250 </div> <!-- end of search results -->
252 </form>
254 </body>
256 <!-- stuff for the popup calendar -->
257 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
258 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
259 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
260 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
261 <script language="Javascript">
262 Calendar.setup({inputField:"form_begin_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_begin_date", showsTime:'true'});
263 Calendar.setup({inputField:"form_end_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_end_date", showsTime:'true'});
264 </script>
266 </html>