added new datepicker to amendments gui
[openemr.git] / interface / reports / cdr_log.php
blob34952e5af24b4c07c6ecac04d5dcc5b2ad8a676d
1 <?php
2 /**
3 * CDR trigger log report.
5 * Copyright (C) 2015-2017 Brady Miller <brady@sparmy.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@sparmy.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/formatting.inc.php");
34 require_once "$srcdir/options.inc.php";
35 require_once "$srcdir/clinical_rules.php";
38 <html>
40 <head>
41 <?php html_header_show();?>
43 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
44 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
46 <title><?php echo xlt('Alerts Log'); ?></title>
48 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
49 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
50 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
51 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
52 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
54 <script LANGUAGE="JavaScript">
56 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
58 $(document).ready(function() {
59 $('.datepicker').datetimepicker({
60 <?php $datetimepicker_timepicker = true; ?>
61 <?php $datetimepicker_formatInput = false; ?>
62 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
63 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
64 });
65 });
67 </script>
69 <style type="text/css">
71 /* specifically include & exclude from printing */
72 @media print {
73 #report_parameters {
74 visibility: hidden;
75 display: none;
77 #report_parameters_daterange {
78 visibility: visible;
79 display: inline;
81 #report_results table {
82 margin-top: 0px;
86 /* specifically exclude some from the screen */
87 @media screen {
88 #report_parameters_daterange {
89 visibility: hidden;
90 display: none;
94 </style>
95 </head>
97 <body class="body_top">
99 <!-- Required for the popup date selectors -->
100 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
102 <span class='title'><?php echo xlt('Alerts Log'); ?></span>
104 <form method='post' name='theform' id='theform' action='cdr_log.php?search=1' onsubmit='return top.restoreSession()'>
106 <div id="report_parameters">
108 <table>
109 <tr>
110 <td width='470px'>
111 <div style='float:left'>
113 <table class='text'>
115 <tr>
116 <td class='label'>
117 <?php echo xlt('Begin Date'); ?>:
118 </td>
119 <td>
120 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr($_POST['form_begin_date']); ?>'
121 class='datepicker'
122 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
123 </td>
124 </tr>
126 <tr>
127 <td class='label'>
128 <?php echo xlt('End Date'); ?>:
129 </td>
130 <td>
131 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr($_POST['form_end_date']); ?>'
132 class='datepicker'
133 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
134 </td>
135 </tr>
136 </table>
137 </div>
139 </td>
140 <td align='left' valign='middle' height="100%">
141 <table style='border-left:1px solid; width:100%; height:100%' >
142 <tr>
143 <td>
144 <div style='margin-left:15px'>
145 <a id='search_button' href='#' class='css_button' onclick='top.restoreSession(); $("#theform").submit()'>
146 <span>
147 <?php echo xlt('Search'); ?>
148 </span>
149 </a>
150 </div>
151 </td>
152 </tr>
153 </table>
154 </td>
155 </tr>
156 </table>
158 </div> <!-- end of search parameters -->
160 <br>
162 <?php if ($_GET['search'] == 1) { ?>
164 <div id="report_results">
165 <table>
167 <thead>
168 <th align='center'>
169 <?php echo xlt('Date'); ?>
170 </th>
172 <th align='center'>
173 <?php echo xlt('Patient ID'); ?>
174 </th>
176 <th align='center'>
177 <?php echo xlt('User ID'); ?>
178 </th>
180 <th align='center'>
181 <?php echo xlt('Category'); ?>
182 </th>
184 <th align='center'>
185 <?php echo xlt('All Alerts'); ?>
186 </th>
188 <th align='center'>
189 <?php echo xlt('New Alerts'); ?>
190 </th>
192 </thead>
193 <tbody> <!-- added for better print-ability -->
194 <?php
195 $res = listingCDRReminderLog($_POST['form_begin_date'],$_POST['form_end_date']);
197 while ($row = sqlFetchArray($res)) {
198 //Create category title
199 if ($row['category'] == 'clinical_reminder_widget') {
200 $category_title = xl("Passive Alert");
202 else if ($row['category'] == 'active_reminder_popup') {
203 $category_title = xl("Active Alert");
205 else if ($row['category'] == 'allergy_alert') {
206 $category_title = xl("Allergy Warning");
208 else {
209 $category_title = $row['category'];
211 //Prepare the targets
212 $all_alerts = json_decode($row['value'], true);
213 if (!empty($row['new_value'])) {
214 $new_alerts = json_decode($row['new_value'], true);
217 <tr>
218 <td><?php echo text($row['date']); ?></td>
219 <td><?php echo text($row['pid']); ?></td>
220 <td><?php echo text($row['uid']); ?></td>
221 <td><?php echo text($category_title); ?></td>
222 <td>
223 <?php
224 //list off all targets with rule information shown when hover
225 foreach ($all_alerts as $targetInfo => $alert) {
226 if ( ($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup') ) {
227 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
228 $catAndTarget = explode(':',$targetInfo);
229 $category = $catAndTarget[0];
230 $target = $catAndTarget[1];
231 echo "<span title='" .attr($rule_title) . "'>" .
232 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
233 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
234 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
235 "<span><br>";
237 else { // $row['category'] == 'allergy_alert'
238 echo $alert . "<br>";
242 </td>
243 <td>
244 <?php
245 if (!empty($row['new_value'])) {
246 //list new targets with rule information shown when hover
247 foreach ($new_alerts as $targetInfo => $alert) {
248 if ( ($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup') ) {
249 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
250 $catAndTarget = explode(':',$targetInfo);
251 $category = $catAndTarget[0];
252 $target = $catAndTarget[1];
253 echo "<span title='" .attr($rule_title) . "'>" .
254 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
255 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
256 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
257 "<span><br>";
259 else { // $row['category'] == 'allergy_alert'
260 echo $alert . "<br>";
264 else {
265 echo "&nbsp;";
268 </td>
269 </tr>
271 <?php
272 } // $row = sqlFetchArray($res) while
274 </tbody>
275 </table>
276 </div> <!-- end of search results -->
278 <?php } // end of if search button clicked ?>
280 </form>
282 </body>
284 </html>