ongoing internationalization of date widget
[openemr.git] / interface / reports / cdr_log.php
blob9531113fbc509a7c143e8ab4fa4e861735f6f5eb
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
24 use OpenEMR\Core\Header;
26 require_once("../globals.php");
27 require_once("../../library/patient.inc");
28 require_once "$srcdir/options.inc.php";
29 require_once "$srcdir/clinical_rules.php";
32 <html>
34 <head>
36 <title><?php echo xlt('Alerts Log'); ?></title>
38 <?php Header::setupHeader('datetime-picker'); ?>
40 <script LANGUAGE="JavaScript">
42 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
44 $(document).ready(function() {
45 $('.datepicker').datetimepicker({
46 <?php $datetimepicker_timepicker = true; ?>
47 <?php $datetimepicker_showseconds = true; ?>
48 <?php $datetimepicker_formatInput = false; ?>
49 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
50 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
51 });
52 });
54 </script>
56 <style type="text/css">
58 /* specifically include & exclude from printing */
59 @media print {
60 #report_parameters {
61 visibility: hidden;
62 display: none;
64 #report_parameters_daterange {
65 visibility: visible;
66 display: inline;
68 #report_results table {
69 margin-top: 0px;
73 /* specifically exclude some from the screen */
74 @media screen {
75 #report_parameters_daterange {
76 visibility: hidden;
77 display: none;
81 </style>
82 </head>
84 <body class="body_top">
86 <!-- Required for the popup date selectors -->
87 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
89 <span class='title'><?php echo xlt('Alerts Log'); ?></span>
91 <form method='post' name='theform' id='theform' action='cdr_log.php?search=1' onsubmit='return top.restoreSession()'>
93 <div id="report_parameters">
95 <table>
96 <tr>
97 <td width='470px'>
98 <div style='float:left'>
100 <table class='text'>
102 <tr>
103 <td class='control-label'>
104 <?php echo xlt('Begin Date'); ?>:
105 </td>
106 <td>
107 <input type='text' name='form_begin_date' id='form_begin_date' size='20' value='<?php echo attr($_POST['form_begin_date']); ?>'
108 class='datepicker form-control'
109 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
110 </td>
111 </tr>
113 <tr>
114 <td class='control-label'>
115 <?php echo xlt('End Date'); ?>:
116 </td>
117 <td>
118 <input type='text' name='form_end_date' id='form_end_date' size='20' value='<?php echo attr($_POST['form_end_date']); ?>'
119 class='datepicker form-control'
120 title='<?php echo xla('yyyy-mm-dd hh:mm:ss'); ?>'>
121 </td>
122 </tr>
123 </table>
124 </div>
126 </td>
127 <td align='left' valign='middle' height="100%">
128 <table style='border-left:1px solid; width:100%; height:100%' >
129 <tr>
130 <td>
131 <div class="text-center">
132 <div class="btn-group" role="group">
133 <a id='search_button' href='#' class='btn btn-default btn-search' onclick='top.restoreSession(); $("#theform").submit()'>
134 <?php echo xlt('Search'); ?>
135 </a>
136 </div>
137 </div>
138 </td>
139 </tr>
140 </table>
141 </td>
142 </tr>
143 </table>
145 </div> <!-- end of search parameters -->
147 <br>
149 <?php if ($_GET['search'] == 1) { ?>
151 <div id="report_results">
152 <table>
154 <thead>
155 <th align='center'>
156 <?php echo xlt('Date'); ?>
157 </th>
159 <th align='center'>
160 <?php echo xlt('Patient ID'); ?>
161 </th>
163 <th align='center'>
164 <?php echo xlt('User ID'); ?>
165 </th>
167 <th align='center'>
168 <?php echo xlt('Category'); ?>
169 </th>
171 <th align='center'>
172 <?php echo xlt('All Alerts'); ?>
173 </th>
175 <th align='center'>
176 <?php echo xlt('New Alerts'); ?>
177 </th>
179 </thead>
180 <tbody> <!-- added for better print-ability -->
181 <?php
182 $res = listingCDRReminderLog($_POST['form_begin_date'], $_POST['form_end_date']);
184 while ($row = sqlFetchArray($res)) {
185 //Create category title
186 if ($row['category'] == 'clinical_reminder_widget') {
187 $category_title = xl("Passive Alert");
188 } else if ($row['category'] == 'active_reminder_popup') {
189 $category_title = xl("Active Alert");
190 } else if ($row['category'] == 'allergy_alert') {
191 $category_title = xl("Allergy Warning");
192 } else {
193 $category_title = $row['category'];
196 //Prepare the targets
197 $all_alerts = json_decode($row['value'], true);
198 if (!empty($row['new_value'])) {
199 $new_alerts = json_decode($row['new_value'], true);
202 <tr>
203 <td><?php echo text($row['date']); ?></td>
204 <td><?php echo text($row['pid']); ?></td>
205 <td><?php echo text($row['uid']); ?></td>
206 <td><?php echo text($category_title); ?></td>
207 <td>
208 <?php
209 //list off all targets with rule information shown when hover
210 foreach ($all_alerts as $targetInfo => $alert) {
211 if (($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup')) {
212 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
213 $catAndTarget = explode(':', $targetInfo);
214 $category = $catAndTarget[0];
215 $target = $catAndTarget[1];
216 echo "<span title='" .attr($rule_title) . "'>" .
217 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
218 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
219 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
220 "<span><br>";
221 } else { // $row['category'] == 'allergy_alert'
222 echo $alert . "<br>";
226 </td>
227 <td>
228 <?php
229 if (!empty($row['new_value'])) {
230 //list new targets with rule information shown when hover
231 foreach ($new_alerts as $targetInfo => $alert) {
232 if (($row['category'] == 'clinical_reminder_widget') || ($row['category'] == 'active_reminder_popup')) {
233 $rule_title = getListItemTitle("clinical_rules", $alert['rule_id']);
234 $catAndTarget = explode(':', $targetInfo);
235 $category = $catAndTarget[0];
236 $target = $catAndTarget[1];
237 echo "<span title='" .attr($rule_title) . "'>" .
238 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'), $category) .
239 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'), $target) .
240 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'), $alert['due_status']) . ")" .
241 "<span><br>";
242 } else { // $row['category'] == 'allergy_alert'
243 echo $alert . "<br>";
246 } else {
247 echo "&nbsp;";
250 </td>
251 </tr>
253 <?php
254 } // $row = sqlFetchArray($res) while
256 </tbody>
257 </table>
258 </div> <!-- end of search results -->
260 <?php } // end of if search button clicked ?>
262 </form>
264 </body>
266 </html>