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>;.
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";
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 ?>
68 <style type
="text/css">
70 /* specifically include & exclude from printing */
76 #report_parameters_daterange {
80 #report_results table {
85 /* specifically exclude some from the screen */
87 #report_parameters_daterange {
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">
110 <div style
='float:left'>
115 <td
class='label_custom'>
116 <?php
echo xlt('Begin Date'); ?
>:
119 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr($_POST['form_begin_date
']); ?>'
121 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
126 <td
class='label_custom'>
127 <?php
echo xlt('End Date'); ?
>:
130 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr($_POST['form_end_date
']); ?>'
132 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
139 <td align
='left' valign
='middle' height
="100%">
140 <table style
='border-left:1px solid; width:100%; height:100%' >
143 <div style
='margin-left:15px'>
144 <a id
='search_button' href
='#' class='css_button' onclick
='top.restoreSession(); $("#theform").submit()'>
146 <?php
echo xlt('Search'); ?
>
157 </div
> <!-- end of search parameters
-->
161 <?php
if ($_GET['search'] == 1) { ?
>
163 <div id
="report_results">
168 <?php
echo xlt('Date'); ?
>
172 <?php
echo xlt('Patient ID'); ?
>
176 <?php
echo xlt('User ID'); ?
>
180 <?php
echo xlt('Category'); ?
>
184 <?php
echo xlt('All Alerts'); ?
>
188 <?php
echo xlt('New Alerts'); ?
>
192 <tbody
> <!-- added
for better
print-ability
-->
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");
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);
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
>
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']) . ")" .
236 else { // $row['category'] == 'allergy_alert'
237 echo $alert . "<br>";
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']) . ")" .
258 else { // $row['category'] == 'allergy_alert'
259 echo $alert . "<br>";
271 } // $row = sqlFetchArray($res) while
275 </div
> <!-- end of search results
-->
277 <?php
} // end of if search button clicked ?>