removal of overlib_mini.js and calendar.js (#640)
[openemr.git] / interface / reports / cdr_log.php
blob746d910ae077ef90a63180c27d93a9808cc78688
1 <?php
2 /**
3 * CDR trigger log report.
5 * Copyright (C) 2015-2017 Brady Miller <brady.g.miller@gmail.com>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Brady Miller <brady.g.miller@gmail.com>
20 * @link http://www.open-emr.org
23 //SANITIZE ALL ESCAPES
24 $sanitize_all_escapes=true;
27 //STOP FAKE REGISTER GLOBALS
28 $fake_register_globals=false;
31 require_once("../globals.php");
32 require_once("../../library/patient.inc");
33 require_once "$srcdir/options.inc.php";
34 require_once "$srcdir/clinical_rules.php";
37 <html>
39 <head>
40 <?php html_header_show();?>
42 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
43 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
45 <title><?php echo xlt('Alerts Log'); ?></title>
47 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
48 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
49 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
50 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
52 <script LANGUAGE="JavaScript">
54 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
56 $(document).ready(function() {
57 $('.datepicker').datetimepicker({
58 <?php $datetimepicker_timepicker = true; ?>
59 <?php $datetimepicker_showseconds = true; ?>
60 <?php $datetimepicker_formatInput = false; ?>
61 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
62 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
63 });
64 });
66 </script>
68 <style type="text/css">
70 /* specifically include & exclude from printing */
71 @media print {
72 #report_parameters {
73 visibility: hidden;
74 display: none;
76 #report_parameters_daterange {
77 visibility: visible;
78 display: inline;
80 #report_results table {
81 margin-top: 0px;
85 /* specifically exclude some from the screen */
86 @media screen {
87 #report_parameters_daterange {
88 visibility: hidden;
89 display: none;
93 </style>
94 </head>
96 <body class="body_top">
98 <!-- Required for the popup date selectors -->
99 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
101 <span class='title'><?php echo xlt('Alerts Log'); ?></span>
103 <form method='post' name='theform' id='theform' action='cdr_log.php?search=1' onsubmit='return top.restoreSession()'>
105 <div id="report_parameters">
107 <table>
108 <tr>
109 <td width='470px'>
110 <div style='float:left'>
112 <table class='text'>
114 <tr>
115 <td class='label_custom'>
116 <?php echo xlt('Begin Date'); ?>:
117 </td>
118 <td>
119 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr($_POST['form_begin_date']); ?>'
120 class='datepicker'
121 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
122 </td>
123 </tr>
125 <tr>
126 <td class='label_custom'>
127 <?php echo xlt('End Date'); ?>:
128 </td>
129 <td>
130 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr($_POST['form_end_date']); ?>'
131 class='datepicker'
132 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
133 </td>
134 </tr>
135 </table>
136 </div>
138 </td>
139 <td align='left' valign='middle' height="100%">
140 <table style='border-left:1px solid; width:100%; height:100%' >
141 <tr>
142 <td>
143 <div style='margin-left:15px'>
144 <a id='search_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
145 <span>
146 <?php echo xlt('Search'); ?>
147 </span>
148 </a>
149 </div>
150 </td>
151 </tr>
152 </table>
153 </td>
154 </tr>
155 </table>
157 </div> <!-- end of search parameters -->
159 <br>
161 <?php if ($_GET['search'] == 1) { ?>
163 <div id="report_results">
164 <table>
166 <thead>
167 <th align='center'>
168 <?php echo xlt('Date'); ?>
169 </th>
171 <th align='center'>
172 <?php echo xlt('Patient ID'); ?>
173 </th>
175 <th align='center'>
176 <?php echo xlt('User ID'); ?>
177 </th>
179 <th align='center'>
180 <?php echo xlt('Category'); ?>
181 </th>
183 <th align='center'>
184 <?php echo xlt('All Alerts'); ?>
185 </th>
187 <th align='center'>
188 <?php echo xlt('New Alerts'); ?>
189 </th>
191 </thead>
192 <tbody> <!-- added for better print-ability -->
193 <?php
194 $res = listingCDRReminderLog($_POST['form_begin_date'],$_POST['form_end_date']);
196 while ($row = sqlFetchArray($res)) {
197 //Create category title
198 if ($row['category'] == 'clinical_reminder_widget') {
199 $category_title = xl("Passive Alert");
201 else if ($row['category'] == 'active_reminder_popup') {
202 $category_title = xl("Active Alert");
204 else if ($row['category'] == 'allergy_alert') {
205 $category_title = xl("Allergy Warning");
207 else {
208 $category_title = $row['category'];
210 //Prepare the targets
211 $all_alerts = json_decode($row['value'], true);
212 if (!empty($row['new_value'])) {
213 $new_alerts = json_decode($row['new_value'], true);
216 <tr>
217 <td><?php echo text($row['date']); ?></td>
218 <td><?php echo text($row['pid']); ?></td>
219 <td><?php echo text($row['uid']); ?></td>
220 <td><?php echo text($category_title); ?></td>
221 <td>
222 <?php
223 //list off all targets with rule information shown when hover
224 foreach ($all_alerts as $targetInfo => $alert) {
225 if ( ($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup') ) {
226 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
227 $catAndTarget = explode(':',$targetInfo);
228 $category = $catAndTarget[0];
229 $target = $catAndTarget[1];
230 echo "<span title='" .attr($rule_title) . "'>" .
231 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
232 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
233 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
234 "<span><br>";
236 else { // $row['category'] == 'allergy_alert'
237 echo $alert . "<br>";
241 </td>
242 <td>
243 <?php
244 if (!empty($row['new_value'])) {
245 //list new targets with rule information shown when hover
246 foreach ($new_alerts as $targetInfo => $alert) {
247 if ( ($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup') ) {
248 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
249 $catAndTarget = explode(':',$targetInfo);
250 $category = $catAndTarget[0];
251 $target = $catAndTarget[1];
252 echo "<span title='" .attr($rule_title) . "'>" .
253 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
254 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
255 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
256 "<span><br>";
258 else { // $row['category'] == 'allergy_alert'
259 echo $alert . "<br>";
263 else {
264 echo "&nbsp;";
267 </td>
268 </tr>
270 <?php
271 } // $row = sqlFetchArray($res) while
273 </tbody>
274 </table>
275 </div> <!-- end of search results -->
277 <?php } // end of if search button clicked ?>
279 </form>
281 </body>
283 </html>