added new datepicker to amendments gui
[openemr.git] / interface / reports / amc_tracking.php
blob6c6643fa55d02551404ff88c41fa4ea651e7591a
1 <?php
2 /**
4 * Copyright (C) 2011-2017 Brady Miller <brady@sparmy.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@sparmy.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/formatting.inc.php");
33 require_once "$srcdir/options.inc.php";
34 require_once "$srcdir/amc.php";
36 // Collect form parameters (set defaults if empty)
37 $begin_date = (isset($_POST['form_begin_date'])) ? trim($_POST['form_begin_date']) : "";
38 $end_date = (isset($_POST['form_end_date'])) ? trim($_POST['form_end_date']) : "";
39 $rule = (isset($_POST['form_rule'])) ? trim($_POST['form_rule']) : "";
40 $provider = trim($_POST['form_provider']);
44 <html>
46 <head>
47 <?php html_header_show();?>
49 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
50 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
52 <title><?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></title>
54 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
55 <script type="text/javascript" src="../../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script>
56 <script type="text/javascript" src="../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
57 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
58 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
60 <script LANGUAGE="JavaScript">
62 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
64 $(document).ready(function() {
65 var win = top.printLogSetup ? top : opener.top;
66 win.printLogSetup(document.getElementById('printbutton'));
68 $('.datepicker').datetimepicker({
69 <?php $datetimepicker_timepicker = true; ?>
70 <?php $datetimepicker_formatInput = false; ?>
71 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
72 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
73 });
74 });
76 function send_sum(patient_id,transaction_id) {
77 if ( $('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
78 var mode = "add";
80 else {
81 var mode = "remove";
83 top.restoreSession();
84 $.post( "../../library/ajax/amc_misc_data.php",
85 { amc_id: "send_sum_amc",
86 complete: true,
87 mode: mode,
88 patient_id: patient_id,
89 object_category: "transactions",
90 object_id: transaction_id
95 function send_sum_elec(patient_id,transaction_id) {
96 if ( $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
97 if ( !$('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
98 $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).removeAttr("checked");
99 alert("<?php echo xls('Can not set this unless the Summary of Care Sent toggle is set.'); ?>");
100 return false;
102 var mode = "add";
104 else {
105 var mode = "remove";
107 top.restoreSession();
108 $.post( "../../library/ajax/amc_misc_data.php",
109 { amc_id: "send_sum_elec_amc",
110 complete: true,
111 mode: mode,
112 patient_id: patient_id,
113 object_category: "transactions",
114 object_id: transaction_id
119 function provide_rec_pat(patient_id,date_created) {
120 if ( $('#provide_rec_pat_flag_' + patient_id ).attr('checked') ) {
121 var mode = "complete_safe";
123 else {
124 var mode = "uncomplete_safe";
126 top.restoreSession();
127 $.post( "../../library/ajax/amc_misc_data.php",
128 { amc_id: "provide_rec_pat_amc",
129 complete: true,
130 mode: mode,
131 date_created: date_created,
132 patient_id: patient_id
137 function provide_sum_pat(patient_id,encounter_id) {
138 if ( $('#provide_sum_pat_flag_' + patient_id + '_' + encounter_id).attr('checked') ) {
139 var mode = "add";
141 else {
142 var mode = "remove";
144 top.restoreSession();
145 $.post( "../../library/ajax/amc_misc_data.php",
146 { amc_id: "provide_sum_pat_amc",
147 complete: true,
148 mode: mode,
149 patient_id: patient_id,
150 object_category: "form_encounter",
151 object_id: encounter_id
156 </script>
158 <style type="text/css">
160 /* specifically include & exclude from printing */
161 @media print {
162 #report_parameters {
163 visibility: hidden;
164 display: none;
166 #report_parameters_daterange {
167 visibility: visible;
168 display: inline;
170 #report_results table {
171 margin-top: 0px;
175 /* specifically exclude some from the screen */
176 @media screen {
177 #report_parameters_daterange {
178 visibility: hidden;
179 display: none;
183 </style>
184 </head>
186 <body class="body_top">
188 <!-- Required for the popup date selectors -->
189 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
191 <span class='title'><?php echo htmlspecialchars( xl('Report'), ENT_NOQUOTES); ?> -
193 <?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></span>
195 <form method='post' name='theform' id='theform' action='amc_tracking.php' onsubmit='return top.restoreSession()'>
197 <div id="report_parameters">
199 <table>
200 <tr>
201 <td width='470px'>
202 <div style='float:left'>
204 <table class='text'>
206 <tr>
207 <td class='label'>
208 <?php echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES); ?>:
209 </td>
210 <td>
211 <input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo htmlspecialchars( $begin_date, ENT_QUOTES); ?>'
212 class='datepicker'
213 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
214 </td>
215 </tr>
217 <tr>
218 <td class='label'>
219 <?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES); ?>:
220 </td>
221 <td>
222 <input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo htmlspecialchars( $end_date, ENT_QUOTES); ?>'
223 class='datepicker'
224 title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
225 </td>
226 </tr>
228 <tr>
229 <td class='label'>
230 <?php echo htmlspecialchars( xl('Rule'), ENT_NOQUOTES); ?>:
231 </td>
232 <td>
233 <select name='form_rule'>
234 <option value='send_sum_amc' <?php if ($rule == "send_sum_amc") echo "selected"; ?>>
235 <?php echo htmlspecialchars( xl('Send Summaries with Referrals'), ENT_NOQUOTES); ?></option>
236 <option value='provide_rec_pat_amc' <?php if ($rule == "provide_rec_pat_amc") echo "selected"; ?>>
237 <?php echo htmlspecialchars( xl('Patient Requested Medical Records'), ENT_NOQUOTES); ?></option>
238 <option value='provide_sum_pat_amc' <?php if ($rule == "provide_sum_pat_amc") echo "selected"; ?>>
239 <?php echo htmlspecialchars( xl('Provide Records to Patient for Visit'), ENT_NOQUOTES); ?></option>
240 </select>
241 </td>
242 </tr>
244 <tr>
245 <td class='label'>
246 <?php echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES); ?>:
247 </td>
248 <td>
249 <?php
251 // Build a drop-down list of providers.
254 $query = "SELECT id, lname, fname FROM users WHERE ".
255 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
257 $ures = sqlStatement($query);
259 echo " <select name='form_provider'>\n";
260 echo " <option value=''>-- " . htmlspecialchars( xl('All'), ENT_NOQUOTES) . " --\n";
262 while ($urow = sqlFetchArray($ures)) {
263 $provid = $urow['id'];
264 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES)."'";
265 if ($provid == $_POST['form_provider']) echo " selected";
266 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES) . "\n";
269 echo " </select>\n";
272 </td>
273 </tr>
274 </table>
276 </div>
278 </td>
279 <td align='left' valign='middle' height="100%">
280 <table style='border-left:1px solid; width:100%; height:100%' >
281 <tr>
282 <td>
283 <div style='margin-left:15px'>
284 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
285 <span>
286 <?php echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES); ?>
287 </span>
288 </a>
289 <?php if ($_POST['form_refresh']) { ?>
290 <a href='#' class='css_button' id='printbutton'>
291 <span>
292 <?php echo htmlspecialchars( xl('Print'), ENT_NOQUOTES); ?>
293 </span>
294 </a>
295 <?php } ?>
296 </div>
297 </td>
298 </tr>
299 </table>
300 </td>
301 </tr>
302 </table>
304 </div> <!-- end of search parameters -->
306 <br>
308 <?php
309 if ($_POST['form_refresh']) {
313 <div id="report_results">
314 <table>
316 <thead>
317 <th>
318 <?php echo htmlspecialchars( xl('Patient Name'), ENT_NOQUOTES); ?>
319 </th>
321 <th>
322 <?php echo htmlspecialchars( xl('Patient ID'), ENT_NOQUOTES); ?>
323 </th>
325 <th>
326 <?php
327 if ($rule == "send_sum_amc") {
328 echo htmlspecialchars( xl('Referral Date'), ENT_NOQUOTES);
330 else if ($rule == "provide_rec_pat_amc") {
331 echo htmlspecialchars( xl('Record Request Date'), ENT_NOQUOTES);
333 else { // $rule == "provide_sum_pat_amc"
334 echo htmlspecialchars( xl('Encounter Date'), ENT_NOQUOTES);
337 </th>
339 <th>
340 <?php
341 if ($rule == "send_sum_amc") {
342 echo htmlspecialchars( xl('Referral ID'), ENT_NOQUOTES);
344 else if ($rule == "provide_rec_pat_amc") {
345 echo "&nbsp";
347 else { // $rule == "provide_sum_pat_amc"
348 echo htmlspecialchars( xl('Encounter ID'), ENT_NOQUOTES);
351 </th>
353 <th>
354 <?php
355 if ($rule == "provide_rec_pat_amc") {
356 echo htmlspecialchars( xl('Medical Records Sent'), ENT_NOQUOTES);
358 else if ($rule == "send_sum_amc") {
359 echo htmlspecialchars( xl('Summary of Care Sent'), ENT_NOQUOTES);
361 else { // $rule == "provide_sum_pat_amc"
362 echo htmlspecialchars( xl('Medical Summary Given'), ENT_NOQUOTES);
365 </th>
366 <?php
367 if ($rule == "send_sum_amc") {
368 echo "<th>";
369 echo htmlspecialchars( xl('Summary of Care Sent Electronically'), ENT_NOQUOTES);
370 echo "<th>";
374 </thead>
375 <tbody> <!-- added for better print-ability -->
376 <?php
378 // Send the request for information
379 $resultsArray = amcTrackingRequest($rule,$begin_date,$end_date,$provider);
383 <?php
384 foreach ($resultsArray as $result) {
385 echo "<tr bgcolor='" . $bgcolor ."'>";
386 echo "<td>" . htmlspecialchars($result['lname'].",".$result['fname'], ENT_NOQUOTES) . "</td>";
387 echo "<td>" . htmlspecialchars($result['pid'],ENT_NOQUOTES) . "</td>";
388 echo "<td>" . htmlspecialchars($result['date'],ENT_NOQUOTES) . "</td>";
389 if ($rule == "send_sum_amc" || $rule == "provide_sum_pat_amc") {
390 echo "<td>" . htmlspecialchars($result['id'],ENT_NOQUOTES) . "</td>";
392 else { //$rule == "provide_rec_pat_amc"
393 echo "&nbsp";
396 if ($rule == "send_sum_amc") {
397 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>";
398 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>";
400 else if ($rule == "provide_rec_pat_amc") {
401 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>";
403 else { //$rule == "provide_sum_pat_amc"
404 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>";
406 echo "</tr>";
410 </tbody>
411 </table>
412 </div> <!-- end of search results -->
413 <?php } else { ?>
414 <div class='text'>
415 <?php echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES); ?>
416 </div>
417 <?php } ?>
419 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
421 </form>
423 </body>
425 </html>