ongoing internationalization of date widget
[openemr.git] / interface / reports / amc_tracking.php
blob1bb78b0874cecbb439abf5969bbaff21f6055e03
1 <?php
2 /**
4 * Copyright (C) 2011-2017 Brady Miller <brady.g.miller@gmail.com>
6 * LICENSE: This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
17 * @package OpenEMR
18 * @author Brady Miller <brady.g.miller@gmail.com>
19 * @link http://www.open-emr.org
23 use OpenEMR\Core\Header;
25 require_once("../globals.php");
26 require_once("../../library/patient.inc");
27 require_once "$srcdir/options.inc.php";
28 require_once "$srcdir/amc.php";
30 // Collect form parameters (set defaults if empty)
31 $begin_date = (isset($_POST['form_begin_date'])) ? trim($_POST['form_begin_date']) : "";
32 $end_date = (isset($_POST['form_end_date'])) ? trim($_POST['form_end_date']) : "";
33 $rule = (isset($_POST['form_rule'])) ? trim($_POST['form_rule']) : "";
34 $provider = trim($_POST['form_provider']);
38 <html>
40 <head>
42 <title><?php echo htmlspecialchars(xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></title>
44 <?php Header::setupHeader('datetime-picker') ?>
46 <script LANGUAGE="JavaScript">
48 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
50 $(document).ready(function() {
51 var win = top.printLogSetup ? top : opener.top;
52 win.printLogSetup(document.getElementById('printbutton'));
54 $('.datepicker').datetimepicker({
55 <?php $datetimepicker_timepicker = true; ?>
56 <?php $datetimepicker_showseconds = true; ?>
57 <?php $datetimepicker_formatInput = false; ?>
58 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
59 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
60 });
61 });
63 function send_sum(patient_id,transaction_id) {
64 if ( $('#send_sum_flag_' + patient_id + '_' + transaction_id).prop('checked') ) {
65 var mode = "add";
67 else {
68 var mode = "remove";
70 top.restoreSession();
71 $.post( "../../library/ajax/amc_misc_data.php",
72 { amc_id: "send_sum_amc",
73 complete: true,
74 mode: mode,
75 patient_id: patient_id,
76 object_category: "transactions",
77 object_id: transaction_id
82 function send_sum_elec(patient_id,transaction_id) {
83 if ( $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).prop('checked') ) {
84 if ( !$('#send_sum_flag_' + patient_id + '_' + transaction_id).prop('checked') ) {
85 $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).prop("checked", false);
86 alert("<?php echo xls('Can not set this unless the Summary of Care Sent toggle is set.'); ?>");
87 return false;
89 var mode = "add";
91 else {
92 var mode = "remove";
94 top.restoreSession();
95 $.post( "../../library/ajax/amc_misc_data.php",
96 { amc_id: "send_sum_elec_amc",
97 complete: true,
98 mode: mode,
99 patient_id: patient_id,
100 object_category: "transactions",
101 object_id: transaction_id
106 function provide_rec_pat(patient_id,date_created) {
107 if ( $('#provide_rec_pat_flag_' + patient_id ).prop('checked') ) {
108 var mode = "complete_safe";
110 else {
111 var mode = "uncomplete_safe";
113 top.restoreSession();
114 $.post( "../../library/ajax/amc_misc_data.php",
115 { amc_id: "provide_rec_pat_amc",
116 complete: true,
117 mode: mode,
118 date_created: date_created,
119 patient_id: patient_id
124 function provide_sum_pat(patient_id,encounter_id) {
125 if ( $('#provide_sum_pat_flag_' + patient_id + '_' + encounter_id).prop('checked') ) {
126 var mode = "add";
128 else {
129 var mode = "remove";
131 top.restoreSession();
132 $.post( "../../library/ajax/amc_misc_data.php",
133 { amc_id: "provide_sum_pat_amc",
134 complete: true,
135 mode: mode,
136 patient_id: patient_id,
137 object_category: "form_encounter",
138 object_id: encounter_id
143 </script>
145 <style type="text/css">
147 /* specifically include & exclude from printing */
148 @media print {
149 #report_parameters {
150 visibility: hidden;
151 display: none;
153 #report_parameters_daterange {
154 visibility: visible;
155 display: inline;
157 #report_results table {
158 margin-top: 0px;
162 /* specifically exclude some from the screen */
163 @media screen {
164 #report_parameters_daterange {
165 visibility: hidden;
166 display: none;
170 </style>
171 </head>
173 <body class="body_top">
175 <!-- Required for the popup date selectors -->
176 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
178 <span class='title'><?php echo htmlspecialchars(xl('Report'), ENT_NOQUOTES); ?> -
180 <?php echo htmlspecialchars(xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></span>
182 <form method='post' name='theform' id='theform' action='amc_tracking.php' onsubmit='return top.restoreSession()'>
184 <div id="report_parameters">
186 <table>
187 <tr>
188 <td width='470px'>
189 <div style='float:left'>
191 <table class='text'>
193 <tr>
194 <td class='control-label'>
195 <?php echo htmlspecialchars(xl('Begin Date'), ENT_NOQUOTES); ?>:
196 </td>
197 <td>
198 <input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo htmlspecialchars($begin_date, ENT_QUOTES); ?>'
199 class='datepicker form-control'
200 title='<?php echo htmlspecialchars(xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
201 </td>
202 </tr>
204 <tr>
205 <td class='control-label'>
206 <?php echo htmlspecialchars(xl('End Date'), ENT_NOQUOTES); ?>:
207 </td>
208 <td>
209 <input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo htmlspecialchars($end_date, ENT_QUOTES); ?>'
210 class='datepicker form-control'
211 title='<?php echo htmlspecialchars(xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
212 </td>
213 </tr>
215 <tr>
216 <td class='control-label'>
217 <?php echo htmlspecialchars(xl('Rule'), ENT_NOQUOTES); ?>:
218 </td>
219 <td>
220 <select name='form_rule' class='form-control'>
221 <option value='send_sum_amc' <?php if ($rule == "send_sum_amc") {
222 echo "selected";
223 } ?>>
224 <?php echo htmlspecialchars(xl('Send Summaries with Referrals'), ENT_NOQUOTES); ?></option>
225 <option value='provide_rec_pat_amc' <?php if ($rule == "provide_rec_pat_amc") {
226 echo "selected";
227 } ?>>
228 <?php echo htmlspecialchars(xl('Patient Requested Medical Records'), ENT_NOQUOTES); ?></option>
229 <option value='provide_sum_pat_amc' <?php if ($rule == "provide_sum_pat_amc") {
230 echo "selected";
231 } ?>>
232 <?php echo htmlspecialchars(xl('Provide Records to Patient for Visit'), ENT_NOQUOTES); ?></option>
233 </select>
234 </td>
235 </tr>
237 <tr>
238 <td class='control-label'>
239 <?php echo htmlspecialchars(xl('Provider'), ENT_NOQUOTES); ?>:
240 </td>
241 <td>
242 <?php
244 // Build a drop-down list of providers.
247 $query = "SELECT id, lname, fname FROM users WHERE ".
248 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
250 $ures = sqlStatement($query);
252 echo " <select name='form_provider' class='form-control'>\n";
253 echo " <option value=''>-- " . htmlspecialchars(xl('All'), ENT_NOQUOTES) . " --\n";
255 while ($urow = sqlFetchArray($ures)) {
256 $provid = $urow['id'];
257 echo " <option value='".htmlspecialchars($provid, ENT_QUOTES)."'";
258 if ($provid == $_POST['form_provider']) {
259 echo " selected";
262 echo ">" . htmlspecialchars($urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES) . "\n";
265 echo " </select>\n";
268 </td>
269 </tr>
270 </table>
272 </div>
274 </td>
275 <td align='left' valign='middle' height="100%">
276 <table style='border-left:1px solid; width:100%; height:100%' >
277 <tr>
278 <td>
279 <div class="text-center">
280 <div class="btn-group" role="group">
281 <a href='#' class='btn btn-default btn-save' onclick='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
282 <?php echo xlt('Submit'); ?>
283 </a>
284 <?php if ($_POST['form_refresh']) { ?>
285 <a href='#' class='btn btn-default btn-print' id='printbutton'>
286 <?php echo xlt('Print'); ?>
287 </a>
288 <?php } ?>
289 </div>
290 </div>
291 </td>
292 </tr>
293 </table>
294 </td>
295 </tr>
296 </table>
298 </div> <!-- end of search parameters -->
300 <br>
302 <?php
303 if ($_POST['form_refresh']) {
307 <div id="report_results">
308 <table>
310 <thead>
311 <th>
312 <?php echo htmlspecialchars(xl('Patient Name'), ENT_NOQUOTES); ?>
313 </th>
315 <th>
316 <?php echo htmlspecialchars(xl('Patient ID'), ENT_NOQUOTES); ?>
317 </th>
319 <th>
320 <?php
321 if ($rule == "send_sum_amc") {
322 echo htmlspecialchars(xl('Referral Date'), ENT_NOQUOTES);
323 } else if ($rule == "provide_rec_pat_amc") {
324 echo htmlspecialchars(xl('Record Request Date'), ENT_NOQUOTES);
325 } else { // $rule == "provide_sum_pat_amc"
326 echo htmlspecialchars(xl('Encounter Date'), ENT_NOQUOTES);
329 </th>
331 <th>
332 <?php
333 if ($rule == "send_sum_amc") {
334 echo htmlspecialchars(xl('Referral ID'), ENT_NOQUOTES);
335 } else if ($rule == "provide_rec_pat_amc") {
336 echo "&nbsp";
337 } else { // $rule == "provide_sum_pat_amc"
338 echo htmlspecialchars(xl('Encounter ID'), ENT_NOQUOTES);
341 </th>
343 <th>
344 <?php
345 if ($rule == "provide_rec_pat_amc") {
346 echo htmlspecialchars(xl('Medical Records Sent'), ENT_NOQUOTES);
347 } else if ($rule == "send_sum_amc") {
348 echo htmlspecialchars(xl('Summary of Care Sent'), ENT_NOQUOTES);
349 } else { // $rule == "provide_sum_pat_amc"
350 echo htmlspecialchars(xl('Medical Summary Given'), ENT_NOQUOTES);
353 </th>
354 <?php
355 if ($rule == "send_sum_amc") {
356 echo "<th>";
357 echo htmlspecialchars(xl('Summary of Care Sent Electronically'), ENT_NOQUOTES);
358 echo "<th>";
362 </thead>
363 <tbody> <!-- added for better print-ability -->
364 <?php
366 // Send the request for information
367 $resultsArray = amcTrackingRequest($rule, $begin_date, $end_date, $provider);
371 <?php
372 foreach ($resultsArray as $result) {
373 echo "<tr bgcolor='" . $bgcolor ."'>";
374 echo "<td>" . htmlspecialchars($result['lname'].",".$result['fname'], ENT_NOQUOTES) . "</td>";
375 echo "<td>" . htmlspecialchars($result['pid'], ENT_NOQUOTES) . "</td>";
376 echo "<td>" . htmlspecialchars($result['date'], ENT_NOQUOTES) . "</td>";
377 if ($rule == "send_sum_amc" || $rule == "provide_sum_pat_amc") {
378 echo "<td>" . htmlspecialchars($result['id'], ENT_NOQUOTES) . "</td>";
379 } else { //$rule == "provide_rec_pat_amc"
380 echo "<td>&nbsp</td>";
383 if ($rule == "send_sum_amc") {
384 echo "<td><input type='checkbox' id='send_sum_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='send_sum(\"".htmlspecialchars($result['pid'], ENT_QUOTES)."\",\"".htmlspecialchars($result['id'], ENT_QUOTES)."\")'>" . htmlspecialchars(xl('Yes'), ENT_NOQUOTES) . "</td>";
385 echo "<td><input type='checkbox' id='send_sum_elec_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='send_sum_elec(\"".htmlspecialchars($result['pid'], ENT_QUOTES)."\",\"".htmlspecialchars($result['id'], ENT_QUOTES)."\")'>" . htmlspecialchars(xl('Yes'), ENT_NOQUOTES) . "</td>";
386 } else if ($rule == "provide_rec_pat_amc") {
387 echo "<td><input type='checkbox' id='provide_rec_pat_flag_".attr($result['pid'])."' onclick='provide_rec_pat(\"".htmlspecialchars($result['pid'], ENT_QUOTES)."\",\"".htmlspecialchars($result['date'], ENT_QUOTES)."\")'>" . htmlspecialchars(xl('Yes'), ENT_NOQUOTES) . "</td>";
388 } else { //$rule == "provide_sum_pat_amc"
389 echo "<td><input type='checkbox' id='provide_sum_pat_flag_".attr($result['pid'])."_".attr($result['id'])."' onclick='provide_sum_pat(\"".htmlspecialchars($result['pid'], ENT_QUOTES)."\",\"".htmlspecialchars($result['id'], ENT_QUOTES)."\")'>" . htmlspecialchars(xl('Yes'), ENT_NOQUOTES) . "</td>";
392 echo "</tr>";
396 </tbody>
397 </table>
398 </div> <!-- end of search results -->
399 <?php } else { ?>
400 <div class='text'>
401 <?php echo htmlspecialchars(xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES); ?>
402 </div>
403 <?php } ?>
405 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
407 </form>
409 </body>
411 </html>