removal of overlib_mini.js and calendar.js (#640)
[openemr.git] / interface / reports / amc_tracking.php
blobf832b3d13bcfe87766fbdc990015e7b16c968b67
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
22 //SANITIZE ALL ESCAPES
23 $sanitize_all_escapes=true;
26 //STOP FAKE REGISTER GLOBALS
27 $fake_register_globals=false;
30 require_once("../globals.php");
31 require_once("../../library/patient.inc");
32 require_once "$srcdir/options.inc.php";
33 require_once "$srcdir/amc.php";
35 // Collect form parameters (set defaults if empty)
36 $begin_date = (isset($_POST['form_begin_date'])) ? trim($_POST['form_begin_date']) : "";
37 $end_date = (isset($_POST['form_end_date'])) ? trim($_POST['form_end_date']) : "";
38 $rule = (isset($_POST['form_rule'])) ? trim($_POST['form_rule']) : "";
39 $provider = trim($_POST['form_provider']);
43 <html>
45 <head>
46 <?php html_header_show();?>
48 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
49 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
51 <title><?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></title>
53 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
54 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
55 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
56 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
58 <script LANGUAGE="JavaScript">
60 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
62 $(document).ready(function() {
63 var win = top.printLogSetup ? top : opener.top;
64 win.printLogSetup(document.getElementById('printbutton'));
66 $('.datepicker').datetimepicker({
67 <?php $datetimepicker_timepicker = true; ?>
68 <?php $datetimepicker_showseconds = true; ?>
69 <?php $datetimepicker_formatInput = false; ?>
70 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
71 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
72 });
73 });
75 function send_sum(patient_id,transaction_id) {
76 if ( $('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
77 var mode = "add";
79 else {
80 var mode = "remove";
82 top.restoreSession();
83 $.post( "../../library/ajax/amc_misc_data.php",
84 { amc_id: "send_sum_amc",
85 complete: true,
86 mode: mode,
87 patient_id: patient_id,
88 object_category: "transactions",
89 object_id: transaction_id
94 function send_sum_elec(patient_id,transaction_id) {
95 if ( $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
96 if ( !$('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
97 $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).removeAttr("checked");
98 alert("<?php echo xls('Can not set this unless the Summary of Care Sent toggle is set.'); ?>");
99 return false;
101 var mode = "add";
103 else {
104 var mode = "remove";
106 top.restoreSession();
107 $.post( "../../library/ajax/amc_misc_data.php",
108 { amc_id: "send_sum_elec_amc",
109 complete: true,
110 mode: mode,
111 patient_id: patient_id,
112 object_category: "transactions",
113 object_id: transaction_id
118 function provide_rec_pat(patient_id,date_created) {
119 if ( $('#provide_rec_pat_flag_' + patient_id ).attr('checked') ) {
120 var mode = "complete_safe";
122 else {
123 var mode = "uncomplete_safe";
125 top.restoreSession();
126 $.post( "../../library/ajax/amc_misc_data.php",
127 { amc_id: "provide_rec_pat_amc",
128 complete: true,
129 mode: mode,
130 date_created: date_created,
131 patient_id: patient_id
136 function provide_sum_pat(patient_id,encounter_id) {
137 if ( $('#provide_sum_pat_flag_' + patient_id + '_' + encounter_id).attr('checked') ) {
138 var mode = "add";
140 else {
141 var mode = "remove";
143 top.restoreSession();
144 $.post( "../../library/ajax/amc_misc_data.php",
145 { amc_id: "provide_sum_pat_amc",
146 complete: true,
147 mode: mode,
148 patient_id: patient_id,
149 object_category: "form_encounter",
150 object_id: encounter_id
155 </script>
157 <style type="text/css">
159 /* specifically include & exclude from printing */
160 @media print {
161 #report_parameters {
162 visibility: hidden;
163 display: none;
165 #report_parameters_daterange {
166 visibility: visible;
167 display: inline;
169 #report_results table {
170 margin-top: 0px;
174 /* specifically exclude some from the screen */
175 @media screen {
176 #report_parameters_daterange {
177 visibility: hidden;
178 display: none;
182 </style>
183 </head>
185 <body class="body_top">
187 <!-- Required for the popup date selectors -->
188 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
190 <span class='title'><?php echo htmlspecialchars( xl('Report'), ENT_NOQUOTES); ?> -
192 <?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></span>
194 <form method='post' name='theform' id='theform' action='amc_tracking.php' onsubmit='return top.restoreSession()'>
196 <div id="report_parameters">
198 <table>
199 <tr>
200 <td width='470px'>
201 <div style='float:left'>
203 <table class='text'>
205 <tr>
206 <td class='label_custom'>
207 <?php echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES); ?>:
208 </td>
209 <td>
210 <input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo htmlspecialchars( $begin_date, ENT_QUOTES); ?>'
211 class='datepicker'
212 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
213 </td>
214 </tr>
216 <tr>
217 <td class='label_custom'>
218 <?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES); ?>:
219 </td>
220 <td>
221 <input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo htmlspecialchars( $end_date, ENT_QUOTES); ?>'
222 class='datepicker'
223 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
224 </td>
225 </tr>
227 <tr>
228 <td class='label_custom'>
229 <?php echo htmlspecialchars( xl('Rule'), ENT_NOQUOTES); ?>:
230 </td>
231 <td>
232 <select name='form_rule'>
233 <option value='send_sum_amc' <?php if ($rule == "send_sum_amc") echo "selected"; ?>>
234 <?php echo htmlspecialchars( xl('Send Summaries with Referrals'), ENT_NOQUOTES); ?></option>
235 <option value='provide_rec_pat_amc' <?php if ($rule == "provide_rec_pat_amc") echo "selected"; ?>>
236 <?php echo htmlspecialchars( xl('Patient Requested Medical Records'), ENT_NOQUOTES); ?></option>
237 <option value='provide_sum_pat_amc' <?php if ($rule == "provide_sum_pat_amc") echo "selected"; ?>>
238 <?php echo htmlspecialchars( xl('Provide Records to Patient for Visit'), ENT_NOQUOTES); ?></option>
239 </select>
240 </td>
241 </tr>
243 <tr>
244 <td class='label_custom'>
245 <?php echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES); ?>:
246 </td>
247 <td>
248 <?php
250 // Build a drop-down list of providers.
253 $query = "SELECT id, lname, fname FROM users WHERE ".
254 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
256 $ures = sqlStatement($query);
258 echo " <select name='form_provider'>\n";
259 echo " <option value=''>-- " . htmlspecialchars( xl('All'), ENT_NOQUOTES) . " --\n";
261 while ($urow = sqlFetchArray($ures)) {
262 $provid = $urow['id'];
263 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES)."'";
264 if ($provid == $_POST['form_provider']) echo " selected";
265 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES) . "\n";
268 echo " </select>\n";
271 </td>
272 </tr>
273 </table>
275 </div>
277 </td>
278 <td align='left' valign='middle' height="100%">
279 <table style='border-left:1px solid; width:100%; height:100%' >
280 <tr>
281 <td>
282 <div style='margin-left:15px'>
283 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
284 <span>
285 <?php echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES); ?>
286 </span>
287 </a>
288 <?php if ($_POST['form_refresh']) { ?>
289 <a href='#' class='css_button' id='printbutton'>
290 <span>
291 <?php echo htmlspecialchars( xl('Print'), ENT_NOQUOTES); ?>
292 </span>
293 </a>
294 <?php } ?>
295 </div>
296 </td>
297 </tr>
298 </table>
299 </td>
300 </tr>
301 </table>
303 </div> <!-- end of search parameters -->
305 <br>
307 <?php
308 if ($_POST['form_refresh']) {
312 <div id="report_results">
313 <table>
315 <thead>
316 <th>
317 <?php echo htmlspecialchars( xl('Patient Name'), ENT_NOQUOTES); ?>
318 </th>
320 <th>
321 <?php echo htmlspecialchars( xl('Patient ID'), ENT_NOQUOTES); ?>
322 </th>
324 <th>
325 <?php
326 if ($rule == "send_sum_amc") {
327 echo htmlspecialchars( xl('Referral Date'), ENT_NOQUOTES);
329 else if ($rule == "provide_rec_pat_amc") {
330 echo htmlspecialchars( xl('Record Request Date'), ENT_NOQUOTES);
332 else { // $rule == "provide_sum_pat_amc"
333 echo htmlspecialchars( xl('Encounter Date'), ENT_NOQUOTES);
336 </th>
338 <th>
339 <?php
340 if ($rule == "send_sum_amc") {
341 echo htmlspecialchars( xl('Referral ID'), ENT_NOQUOTES);
343 else if ($rule == "provide_rec_pat_amc") {
344 echo "&nbsp";
346 else { // $rule == "provide_sum_pat_amc"
347 echo htmlspecialchars( xl('Encounter ID'), ENT_NOQUOTES);
350 </th>
352 <th>
353 <?php
354 if ($rule == "provide_rec_pat_amc") {
355 echo htmlspecialchars( xl('Medical Records Sent'), ENT_NOQUOTES);
357 else if ($rule == "send_sum_amc") {
358 echo htmlspecialchars( xl('Summary of Care Sent'), ENT_NOQUOTES);
360 else { // $rule == "provide_sum_pat_amc"
361 echo htmlspecialchars( xl('Medical Summary Given'), ENT_NOQUOTES);
364 </th>
365 <?php
366 if ($rule == "send_sum_amc") {
367 echo "<th>";
368 echo htmlspecialchars( xl('Summary of Care Sent Electronically'), ENT_NOQUOTES);
369 echo "<th>";
373 </thead>
374 <tbody> <!-- added for better print-ability -->
375 <?php
377 // Send the request for information
378 $resultsArray = amcTrackingRequest($rule,$begin_date,$end_date,$provider);
382 <?php
383 foreach ($resultsArray as $result) {
384 echo "<tr bgcolor='" . $bgcolor ."'>";
385 echo "<td>" . htmlspecialchars($result['lname'].",".$result['fname'], ENT_NOQUOTES) . "</td>";
386 echo "<td>" . htmlspecialchars($result['pid'],ENT_NOQUOTES) . "</td>";
387 echo "<td>" . htmlspecialchars($result['date'],ENT_NOQUOTES) . "</td>";
388 if ($rule == "send_sum_amc" || $rule == "provide_sum_pat_amc") {
389 echo "<td>" . htmlspecialchars($result['id'],ENT_NOQUOTES) . "</td>";
391 else { //$rule == "provide_rec_pat_amc"
392 echo "&nbsp";
395 if ($rule == "send_sum_amc") {
396 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>";
397 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>";
399 else if ($rule == "provide_rec_pat_amc") {
400 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>";
402 else { //$rule == "provide_sum_pat_amc"
403 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>";
405 echo "</tr>";
409 </tbody>
410 </table>
411 </div> <!-- end of search results -->
412 <?php } else { ?>
413 <div class='text'>
414 <?php echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES); ?>
415 </div>
416 <?php } ?>
418 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
420 </form>
422 </body>
424 </html>