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>;.
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";
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 ?>
69 <style type
="text/css">
71 /* specifically include & exclude from printing */
77 #report_parameters_daterange {
81 #report_results table {
86 /* specifically exclude some from the screen */
88 #report_parameters_daterange {
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">
111 <div style
='float:left'>
117 <?php
echo xlt('Begin Date'); ?
>:
120 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr($_POST['form_begin_date
']); ?>'
122 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
128 <?php
echo xlt('End Date'); ?
>:
131 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr($_POST['form_end_date
']); ?>'
133 title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
140 <td align
='left' valign
='middle' height
="100%">
141 <table style
='border-left:1px solid; width:100%; height:100%' >
144 <div style
='margin-left:15px'>
145 <a id
='search_button' href
='#' class='css_button' onclick
='top.restoreSession(); $("#theform").submit()'>
147 <?php
echo xlt('Search'); ?
>
158 </div
> <!-- end of search parameters
-->
162 <?php
if ($_GET['search'] == 1) { ?
>
164 <div id
="report_results">
169 <?php
echo xlt('Date'); ?
>
173 <?php
echo xlt('Patient ID'); ?
>
177 <?php
echo xlt('User ID'); ?
>
181 <?php
echo xlt('Category'); ?
>
185 <?php
echo xlt('All Alerts'); ?
>
189 <?php
echo xlt('New Alerts'); ?
>
193 <tbody
> <!-- added
for better
print-ability
-->
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");
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);
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
>
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']) . ")" .
237 else { // $row['category'] == 'allergy_alert'
238 echo $alert . "<br>";
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']) . ")" .
259 else { // $row['category'] == 'allergy_alert'
260 echo $alert . "<br>";
272 } // $row = sqlFetchArray($res) while
276 </div
> <!-- end of search results
-->
278 <?php
} // end of if search button clicked ?>