feat: show collection balance in billing widget (#7454)
[openemr.git] / interface / main / dated_reminders / dated_reminders_log.php
blobf6b4a74d39576fc1a000f6829239f9fbbdf90c1b
1 <?php
3 /**
4 * Used for adding dated reminders.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Craig Bezuidenhout <http://www.tajemo.co.za/>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2012 tajemo.co.za <http://www.tajemo.co.za/>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
14 require_once("../../globals.php");
15 require_once("$srcdir/dated_reminder_functions.php");
17 use OpenEMR\Common\Acl\AclMain;
18 use OpenEMR\Common\Csrf\CsrfUtils;
19 use OpenEMR\Core\Header;
21 $isAdmin = AclMain::aclCheckCore('admin', 'users');
23 <?php
25 ------------------- HANDLE POST ---------------------
27 if ($_GET) {
28 if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) {
29 CsrfUtils::csrfNotVerified();
32 if (!$isAdmin) {
33 if (empty($_GET['sentBy']) and empty($_GET['sentTo'])) {
34 $_GET['sentTo'] = array(intval($_SESSION['authUserID']));
38 echo ' <div class="col-12">
39 <h4>' . xlt('Click and drag bottom right corner to resize this display') . '</h4>
40 <table class="table table-bordered" id="logTable">
41 <thead>
42 <tr>
43 <th>' . xlt('ID') . '</th>
44 <th>' . xlt('Sent Date') . '</th>
45 <th>' . xlt('From') . '</th>
46 <th>' . xlt('To{{Destination}}') . '</th>
47 <th>' . xlt('Patient') . '</th>
48 <th>' . xlt('Message') . '</th>
49 <th>' . xlt('Due Date') . '</th>
50 <th>' . xlt('Processed Date') . '</th>
51 <th>' . xlt('Processed By') . '</th>
52 </tr>
53 </thead>
54 <tbody>';
55 $remindersArray = array();
56 $TempRemindersArray = logRemindersArray();
57 foreach ($TempRemindersArray as $RA) {
58 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
59 $remindersArray[$RA['messageID']]['ToName'] = ((!empty($remindersArray[$RA['messageID']]['ToName'])) ? $remindersArray[$RA['messageID']]['ToName'] . ', ' . ($RA['ToName'] ?? '') : ($RA['ToName'] ?? ''));
60 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
61 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
62 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
63 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
64 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
65 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
66 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
69 foreach ($remindersArray as $RA) {
70 echo '<tr class="heading">
71 <td>' . text($RA['messageID']) . '</td>
72 <td>' . text(oeFormatDateTime($RA['sDate'])) . '</td>
73 <td>' . text($RA['fromName']) . '</td>
74 <td>' . text($RA['ToName']) . '</td>
75 <td>' . text($RA['PatientName']) . '</td>
76 <td>' . text($RA['message']) . '</td>
77 <td>' . text(oeFormatShortDate($RA['dDate'])) . '</td>
78 <td>' . text(oeFormatDateTime($RA['pDate'])) . '</td>
79 <td>' . text($RA['processedByName']) . '</td>
80 </tr>';
83 echo '</tbody></table></div>';
85 die;
88 <html>
89 <head>
90 <?php Header::setupHeader(['datetime-picker']); ?>
92 <script>
93 $(function () {
94 $("#submitForm").click(function(){
95 // top.restoreSession(); --> can't use this as it negates this ajax refresh
96 $.get("dated_reminders_log.php?"+$("#logForm").serialize(),
97 function(data) {
98 $("#resultsDiv").html(data);
99 <?php
100 if (!$isAdmin) {
101 echo '$("select option").removeAttr("selected");';
104 return false;
107 return false;
110 $('.datepicker').datetimepicker({
111 <?php $datetimepicker_timepicker = false; ?>
112 <?php $datetimepicker_showseconds = false; ?>
113 <?php $datetimepicker_formatInput = true; ?>
114 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
115 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
118 </script>
119 </head>
120 <body>
121 <div class="container">
122 <!-- Required for the popup date selectors -->
123 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
124 <?php
125 $allUsers = array();
126 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?', array(intval($_SESSION['authUserID'])));
127 for ($i = 0; $uRow = sqlFetchArray($uSQL); $i++) {
128 $allUsers[] = $uRow;
131 <div class="row">
132 <div class="col-12">
133 <h2><?php echo xlt('Dated Message Log');?> &nbsp;<i id="show_hide" class="fa fa-eye-slash fa-2x small" data-toggle="tooltip" data-placement="top" title="<?php echo xla('Click to Hide Filters'); ?>"></i></h2>
134 </div>
135 <div class="col-12 hideaway">
136 <form method="get" id="logForm" onsubmit="return top.restoreSession()">
137 <input type="hidden" name="csrf_token_form" value="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
138 <fieldset>
139 <legend><?php echo xlt('Filters') ?></legend>
140 <h5><?php echo xlt('Date The Message Was Sent');?></h5>
141 <div class="form-group row">
142 <div class="col-12 col-md-6">
143 <label class="col-form-label" for="sd"><?php echo xlt('Start Date') ?>:</label>
144 <input id="sd" type="text" class='form-control datepicker' name="sd" value="" title='<?php echo attr(DateFormatRead('validateJS')) ?>'>
145 </div>
146 <div class="col-12 col-md-6">
147 <label class="col-form-label" for="ed"><?php echo xlt('End Date') ?>:</label>
148 <input id="ed" type="text" class='form-control datepicker' name="ed" value="" title='<?php echo attr(DateFormatRead('validateJS')) ?>'>
149 </div>
150 </div>
151 <div class="form-group row">
152 <div class="col-12 col-md-6">
153 <label class="col-form-label" for="sentBy"><?php echo xlt('Sent By, Leave Blank For All');?>:</label>
154 <select class="form-control" id="sentBy" name="sentBy[]" multiple="multiple">
155 <option value="<?php echo attr(intval($_SESSION['authUserID'])); ?>"><?php echo xlt('Myself') ?></option>
156 <?php
157 if ($isAdmin) {
158 foreach ($allUsers as $user) {
159 echo '<option value="' . attr($user['id']) . '">' . text($user['fname'] . ' ' . $user['mname'] . ' ' . $user['lname']) . '</option>';
163 </select>
164 </div>
165 <div class="col-12 col-md-6">
166 <label class="col-form-label" for="sentBy"><?php echo xlt('Sent To, Leave Blank For All') ?>:</label>
167 <select class="form-control" id="sentTo" name="sentTo[]" multiple="multiple">
168 <option value="<?php echo attr(intval($_SESSION['authUserID'])); ?>"><?php echo xlt('Myself') ?></option>
169 <?php
170 if ($isAdmin) {
171 foreach ($allUsers as $user) {
172 echo '<option value="' . attr($user['id']) . '">' . text($user['fname'] . ' ' . $user['mname'] . ' ' . $user['lname']) . '</option>';
176 </select>
177 </div>
178 </div>
179 <div class="form-group row">
180 <div class="checkbox">
181 <label>
182 <input type="checkbox" name="processed" id="processed"><?php echo xlt('Processed') ?>
183 </label>
184 <label>
185 <input type="checkbox" name="pending" id="pending"><?php echo xlt('Pending') ?>
186 </label>
187 </div>
188 </div>
189 </fieldset>
190 <div class="form-group row">
191 <div class="col-sm-12 position-override">
192 <div class="btn-group form-group" role="group">
193 <button type="button" value="Refresh" id="submitForm" class="btn btn-secondary btn-refresh" ><?php echo xlt('Refresh') ?></button>
194 </div>
195 </div>
196 </div>
197 </form>
198 </div>
199 <div class="col-12">
200 <div id="resultsDiv"></div>
201 </div>
202 </div>
203 </div><!--end of container div-->
204 <script>
205 $('#show_hide').click(function() {
206 var elementTitle = $('#show_hide').prop('title');
207 var hideTitle = '<?php echo xla('Click to Hide Filters'); ?>';
208 var showTitle = '<?php echo xla('Click to Show Filters'); ?>';
209 $('.hideaway').toggle('1000');
210 $(this).toggleClass('fa-eye-slash fa-eye');
211 if (elementTitle == hideTitle) {
212 elementTitle = showTitle;
213 } else if (elementTitle == showTitle) {
214 elementTitle = hideTitle;
216 $('#show_hide').prop('title', elementTitle);
218 $(function () {
219 $('[data-toggle="tooltip"]').tooltip();
221 </script>
222 </body>
223 </html>