3 * CDR trigger log report.
5 * Copyright (C) 2015 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">
45 <title
><?php
echo xlt('Alerts Log'); ?
></title
>
47 <script type
="text/javascript" src
="../../library/overlib_mini.js"></script
>
48 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
49 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
50 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
52 <script LANGUAGE
="JavaScript">
54 var mypcc
= '<?php echo $GLOBALS['phone_country_code
'] ?>';
58 <style type
="text/css">
60 /* specifically include & exclude from printing */
66 #report_parameters_daterange {
70 #report_results table {
75 /* specifically exclude some from the screen */
77 #report_parameters_daterange {
86 <body
class="body_top">
88 <!-- Required
for the popup date selectors
-->
89 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
91 <span
class='title'><?php
echo xlt('Alerts Log'); ?
></span
>
93 <form method
='post' name
='theform' id
='theform' action
='cdr_log.php?search=1' onsubmit
='return top.restoreSession()'>
95 <div id
="report_parameters">
100 <div style
='float:left'>
106 <?php
echo xlt('Begin Date'); ?
>:
109 <input type
='text' name
='form_begin_date' id
='form_begin_date' size
='20' value
='<?php echo attr($_POST['form_begin_date
']); ?>'
110 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
111 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
112 id
='img_begin_date' border
='0' alt
='[?]' style
='cursor:pointer'
113 title
='<?php echo xla('Click here to choose a date
'); ?>'>
119 <?php
echo xlt('End Date'); ?
>:
122 <input type
='text' name
='form_end_date' id
='form_end_date' size
='20' value
='<?php echo attr($_POST['form_end_date
']); ?>'
123 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo xla('yyyy
-mm
-dd hh
:mm
:ss
'); ?>'>
124 <img src
='../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
125 id
='img_end_date' border
='0' alt
='[?]' style
='cursor:pointer'
126 title
='<?php echo xla('Click here to choose a date
'); ?>'>
133 <td align
='left' valign
='middle' height
="100%">
134 <table style
='border-left:1px solid; width:100%; height:100%' >
137 <div style
='margin-left:15px'>
138 <a id
='search_button' href
='#' class='css_button' onclick
='top.restoreSession(); $("#theform").submit()'>
140 <?php
echo xlt('Search'); ?
>
151 </div
> <!-- end of search parameters
-->
155 <?php
if ($_GET['search'] == 1) { ?
>
157 <div id
="report_results">
162 <?php
echo xlt('Date'); ?
>
166 <?php
echo xlt('Patient ID'); ?
>
170 <?php
echo xlt('User ID'); ?
>
174 <?php
echo xlt('Category'); ?
>
178 <?php
echo xlt('All Alerts'); ?
>
182 <?php
echo xlt('New Alerts'); ?
>
186 <tbody
> <!-- added
for better
print-ability
-->
188 $res = listingCDRReminderLog($_POST['form_begin_date'],$_POST['form_end_date']);
190 while ($row = sqlFetchArray($res)) {
191 //Create category title
192 if ($row['category'] == 'clinical_reminder_widget') {
193 $category_title = xl("Passive Alert");
195 else if ($row['category'] == 'active_reminder_popup') {
196 $category_title = xl("Active Alert");
198 else if ($row['category'] == 'allergy_alert') {
199 $category_title = xl("Allergy Warning");
202 $category_title = $row['category'];
204 //Prepare the targets
205 $all_alerts = json_decode($row['value'], true);
206 if (!empty($row['new_value'])) {
207 $new_alerts = json_decode($row['new_value'], true);
211 <td
><?php
echo text($row['date']); ?
></td
>
212 <td
><?php
echo text($row['pid']); ?
></td
>
213 <td
><?php
echo text($row['uid']); ?
></td
>
214 <td
><?php
echo text($category_title); ?
></td
>
217 //list off all targets with rule information shown when hover
218 foreach ($all_alerts as $targetInfo => $alert) {
219 if ( ($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup') ) {
220 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
221 $catAndTarget = explode(':',$targetInfo);
222 $category = $catAndTarget[0];
223 $target = $catAndTarget[1];
224 echo "<span title='" .attr($rule_title) . "'>" .
225 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
226 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
227 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
230 else { // $row['category'] == 'allergy_alert'
231 echo $alert . "<br>";
238 if (!empty($row['new_value'])) {
239 //list new targets with rule information shown when hover
240 foreach ($new_alerts as $targetInfo => $alert) {
241 if ( ($row['category'] == 'clinical_reminder_widget') ||
($row['category'] == 'active_reminder_popup') ) {
242 $rule_title = getListItemTitle("clinical_rules",$alert['rule_id']);
243 $catAndTarget = explode(':',$targetInfo);
244 $category = $catAndTarget[0];
245 $target = $catAndTarget[1];
246 echo "<span title='" .attr($rule_title) . "'>" .
247 generate_display_field(array('data_type'=>'1','list_id'=>'rule_action_category'),$category) .
248 ": " . generate_display_field(array('data_type'=>'1','list_id'=>'rule_action'),$target) .
249 " (" . generate_display_field(array('data_type'=>'1','list_id'=>'rule_reminder_due_opt'),$alert['due_status']) . ")" .
252 else { // $row['category'] == 'allergy_alert'
253 echo $alert . "<br>";
265 } // $row = sqlFetchArray($res) while
269 </div
> <!-- end of search results
-->
271 <?php
} // end of if search button clicked ?>
277 <!-- stuff
for the popup calendar
-->
278 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
279 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
280 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
281 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
282 <script language
="Javascript">
283 Calendar
.setup({inputField
:"form_begin_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_begin_date", showsTime
:'true'});
284 Calendar
.setup({inputField
:"form_end_date", ifFormat
:"%Y-%m-%d %H:%M:%S", button
:"img_end_date", showsTime
:'true'});