full tab fixes to stop scroll of tab and not show bottom border of active tab (#407)
[openemr.git] / interface / reports / amc_tracking.php
blob8d79788a8383784214a3de8a79cf3ebf520f644a
1 <?php
2 // Copyright (C) 2011 Brady Miller <brady@sparmy.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 //SANITIZE ALL ESCAPES
10 $sanitize_all_escapes=true;
13 //STOP FAKE REGISTER GLOBALS
14 $fake_register_globals=false;
17 require_once("../globals.php");
18 require_once("../../library/patient.inc");
19 require_once("$srcdir/formatting.inc.php");
20 require_once "$srcdir/options.inc.php";
21 require_once "$srcdir/formdata.inc.php";
22 require_once "$srcdir/amc.php";
24 // Collect form parameters (set defaults if empty)
25 $begin_date = (isset($_POST['form_begin_date'])) ? trim($_POST['form_begin_date']) : "";
26 $end_date = (isset($_POST['form_end_date'])) ? trim($_POST['form_end_date']) : "";
27 $rule = (isset($_POST['form_rule'])) ? trim($_POST['form_rule']) : "";
28 $provider = trim($_POST['form_provider']);
32 <html>
34 <head>
35 <?php html_header_show();?>
37 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
39 <title><?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></title>
41 <script type="text/javascript" src="../../library/overlib_mini.js"></script>
42 <script type="text/javascript" src="../../library/textformat.js"></script>
43 <script type="text/javascript" src="../../library/dialog.js"></script>
44 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
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'));
53 });
55 function send_sum(patient_id,transaction_id) {
56 if ( $('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
57 var mode = "add";
59 else {
60 var mode = "remove";
62 top.restoreSession();
63 $.post( "../../library/ajax/amc_misc_data.php",
64 { amc_id: "send_sum_amc",
65 complete: true,
66 mode: mode,
67 patient_id: patient_id,
68 object_category: "transactions",
69 object_id: transaction_id
74 function send_sum_elec(patient_id,transaction_id) {
75 if ( $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
76 if ( !$('#send_sum_flag_' + patient_id + '_' + transaction_id).attr('checked') ) {
77 $('#send_sum_elec_flag_' + patient_id + '_' + transaction_id).removeAttr("checked");
78 alert("<?php echo xls('Can not set this unless the Summary of Care Sent toggle is set.'); ?>");
79 return false;
81 var mode = "add";
83 else {
84 var mode = "remove";
86 top.restoreSession();
87 $.post( "../../library/ajax/amc_misc_data.php",
88 { amc_id: "send_sum_elec_amc",
89 complete: true,
90 mode: mode,
91 patient_id: patient_id,
92 object_category: "transactions",
93 object_id: transaction_id
98 function provide_rec_pat(patient_id,date_created) {
99 if ( $('#provide_rec_pat_flag_' + patient_id ).attr('checked') ) {
100 var mode = "complete_safe";
102 else {
103 var mode = "uncomplete_safe";
105 top.restoreSession();
106 $.post( "../../library/ajax/amc_misc_data.php",
107 { amc_id: "provide_rec_pat_amc",
108 complete: true,
109 mode: mode,
110 date_created: date_created,
111 patient_id: patient_id
116 function provide_sum_pat(patient_id,encounter_id) {
117 if ( $('#provide_sum_pat_flag_' + patient_id + '_' + encounter_id).attr('checked') ) {
118 var mode = "add";
120 else {
121 var mode = "remove";
123 top.restoreSession();
124 $.post( "../../library/ajax/amc_misc_data.php",
125 { amc_id: "provide_sum_pat_amc",
126 complete: true,
127 mode: mode,
128 patient_id: patient_id,
129 object_category: "form_encounter",
130 object_id: encounter_id
135 </script>
137 <style type="text/css">
139 /* specifically include & exclude from printing */
140 @media print {
141 #report_parameters {
142 visibility: hidden;
143 display: none;
145 #report_parameters_daterange {
146 visibility: visible;
147 display: inline;
149 #report_results table {
150 margin-top: 0px;
154 /* specifically exclude some from the screen */
155 @media screen {
156 #report_parameters_daterange {
157 visibility: hidden;
158 display: none;
162 </style>
163 </head>
165 <body class="body_top">
167 <!-- Required for the popup date selectors -->
168 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
170 <span class='title'><?php echo htmlspecialchars( xl('Report'), ENT_NOQUOTES); ?> -
172 <?php echo htmlspecialchars( xl('Automated Measure Calculations (AMC) Tracking'), ENT_NOQUOTES); ?></span>
174 <form method='post' name='theform' id='theform' action='amc_tracking.php' onsubmit='return top.restoreSession()'>
176 <div id="report_parameters">
178 <table>
179 <tr>
180 <td width='470px'>
181 <div style='float:left'>
183 <table class='text'>
185 <tr>
186 <td class='label'>
187 <?php echo htmlspecialchars( xl('Begin Date'), ENT_NOQUOTES); ?>:
188 </td>
189 <td>
190 <input type='text' name='form_begin_date' id="form_begin_date" size='20' value='<?php echo htmlspecialchars( $begin_date, ENT_QUOTES); ?>'
191 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
192 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
193 id='img_begin_date' border='0' alt='[?]' style='cursor:pointer'
194 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
195 </td>
196 </tr>
198 <tr>
199 <td class='label'>
200 <?php echo htmlspecialchars( xl('End Date'), ENT_NOQUOTES); ?>:
201 </td>
202 <td>
203 <input type='text' name='form_end_date' id="form_end_date" size='20' value='<?php echo htmlspecialchars( $end_date, ENT_QUOTES); ?>'
204 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)' title='<?php echo htmlspecialchars( xl('yyyy-mm-dd hh:mm:ss'), ENT_QUOTES); ?>'>
205 <img src='../pic/show_calendar.gif' align='absbottom' width='24' height='22'
206 id='img_end_date' border='0' alt='[?]' style='cursor:pointer'
207 title='<?php echo htmlspecialchars( xl('Click here to choose a date'), ENT_QUOTES); ?>'>
208 </td>
209 </tr>
211 <tr>
212 <td class='label'>
213 <?php echo htmlspecialchars( xl('Rule'), ENT_NOQUOTES); ?>:
214 </td>
215 <td>
216 <select name='form_rule'>
217 <option value='send_sum_amc' <?php if ($rule == "send_sum_amc") echo "selected"; ?>>
218 <?php echo htmlspecialchars( xl('Send Summaries with Referrals'), ENT_NOQUOTES); ?></option>
219 <option value='provide_rec_pat_amc' <?php if ($rule == "provide_rec_pat_amc") echo "selected"; ?>>
220 <?php echo htmlspecialchars( xl('Patient Requested Medical Records'), ENT_NOQUOTES); ?></option>
221 <option value='provide_sum_pat_amc' <?php if ($rule == "provide_sum_pat_amc") echo "selected"; ?>>
222 <?php echo htmlspecialchars( xl('Provide Records to Patient for Visit'), ENT_NOQUOTES); ?></option>
223 </select>
224 </td>
225 </tr>
227 <tr>
228 <td class='label'>
229 <?php echo htmlspecialchars( xl('Provider'), ENT_NOQUOTES); ?>:
230 </td>
231 <td>
232 <?php
234 // Build a drop-down list of providers.
237 $query = "SELECT id, lname, fname FROM users WHERE ".
238 "authorized = 1 $provider_facility_filter ORDER BY lname, fname"; //(CHEMED) facility filter
240 $ures = sqlStatement($query);
242 echo " <select name='form_provider'>\n";
243 echo " <option value=''>-- " . htmlspecialchars( xl('All'), ENT_NOQUOTES) . " --\n";
245 while ($urow = sqlFetchArray($ures)) {
246 $provid = $urow['id'];
247 echo " <option value='".htmlspecialchars( $provid, ENT_QUOTES)."'";
248 if ($provid == $_POST['form_provider']) echo " selected";
249 echo ">" . htmlspecialchars( $urow['lname'] . ", " . $urow['fname'], ENT_NOQUOTES) . "\n";
252 echo " </select>\n";
255 </td>
256 </tr>
257 </table>
259 </div>
261 </td>
262 <td align='left' valign='middle' height="100%">
263 <table style='border-left:1px solid; width:100%; height:100%' >
264 <tr>
265 <td>
266 <div style='margin-left:15px'>
267 <a href='#' class='css_button' onclick='$("#form_refresh").attr("value","true"); top.restoreSession(); $("#theform").submit();'>
268 <span>
269 <?php echo htmlspecialchars( xl('Submit'), ENT_NOQUOTES); ?>
270 </span>
271 </a>
272 <?php if ($_POST['form_refresh']) { ?>
273 <a href='#' class='css_button' id='printbutton'>
274 <span>
275 <?php echo htmlspecialchars( xl('Print'), ENT_NOQUOTES); ?>
276 </span>
277 </a>
278 <?php } ?>
279 </div>
280 </td>
281 </tr>
282 </table>
283 </td>
284 </tr>
285 </table>
287 </div> <!-- end of search parameters -->
289 <br>
291 <?php
292 if ($_POST['form_refresh']) {
296 <div id="report_results">
297 <table>
299 <thead>
300 <th>
301 <?php echo htmlspecialchars( xl('Patient Name'), ENT_NOQUOTES); ?>
302 </th>
304 <th>
305 <?php echo htmlspecialchars( xl('Patient ID'), ENT_NOQUOTES); ?>
306 </th>
308 <th>
309 <?php
310 if ($rule == "send_sum_amc") {
311 echo htmlspecialchars( xl('Referral Date'), ENT_NOQUOTES);
313 else if ($rule == "provide_rec_pat_amc") {
314 echo htmlspecialchars( xl('Record Request Date'), ENT_NOQUOTES);
316 else { // $rule == "provide_sum_pat_amc"
317 echo htmlspecialchars( xl('Encounter Date'), ENT_NOQUOTES);
320 </th>
322 <th>
323 <?php
324 if ($rule == "send_sum_amc") {
325 echo htmlspecialchars( xl('Referral ID'), ENT_NOQUOTES);
327 else if ($rule == "provide_rec_pat_amc") {
328 echo "&nbsp";
330 else { // $rule == "provide_sum_pat_amc"
331 echo htmlspecialchars( xl('Encounter ID'), ENT_NOQUOTES);
334 </th>
336 <th>
337 <?php
338 if ($rule == "provide_rec_pat_amc") {
339 echo htmlspecialchars( xl('Medical Records Sent'), ENT_NOQUOTES);
341 else if ($rule == "send_sum_amc") {
342 echo htmlspecialchars( xl('Summary of Care Sent'), ENT_NOQUOTES);
344 else { // $rule == "provide_sum_pat_amc"
345 echo htmlspecialchars( xl('Medical Summary Given'), ENT_NOQUOTES);
348 </th>
349 <?php
350 if ($rule == "send_sum_amc") {
351 echo "<th>";
352 echo htmlspecialchars( xl('Summary of Care Sent Electronically'), ENT_NOQUOTES);
353 echo "<th>";
357 </thead>
358 <tbody> <!-- added for better print-ability -->
359 <?php
361 // Send the request for information
362 $resultsArray = amcTrackingRequest($rule,$begin_date,$end_date,$provider);
366 <?php
367 foreach ($resultsArray as $result) {
368 echo "<tr bgcolor='" . $bgcolor ."'>";
369 echo "<td>" . htmlspecialchars($result['lname'].",".$result['fname'], ENT_NOQUOTES) . "</td>";
370 echo "<td>" . htmlspecialchars($result['pid'],ENT_NOQUOTES) . "</td>";
371 echo "<td>" . htmlspecialchars($result['date'],ENT_NOQUOTES) . "</td>";
372 if ($rule == "send_sum_amc" || $rule == "provide_sum_pat_amc") {
373 echo "<td>" . htmlspecialchars($result['id'],ENT_NOQUOTES) . "</td>";
375 else { //$rule == "provide_rec_pat_amc"
376 echo "&nbsp";
379 if ($rule == "send_sum_amc") {
380 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>";
381 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>";
383 else if ($rule == "provide_rec_pat_amc") {
384 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>";
386 else { //$rule == "provide_sum_pat_amc"
387 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>";
389 echo "</tr>";
393 </tbody>
394 </table>
395 </div> <!-- end of search results -->
396 <?php } else { ?>
397 <div class='text'>
398 <?php echo htmlspecialchars( xl('Please input search criteria above, and click Submit to view results.'), ENT_NOQUOTES); ?>
399 </div>
400 <?php } ?>
402 <input type='hidden' name='form_refresh' id='form_refresh' value=''/>
404 </form>
406 </body>
408 <!-- stuff for the popup calendar -->
409 <style type="text/css">@import url(../../library/dynarch_calendar.css);</style>
410 <script type="text/javascript" src="../../library/dynarch_calendar.js"></script>
411 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
412 <script type="text/javascript" src="../../library/dynarch_calendar_setup.js"></script>
413 <script language="Javascript">
414 Calendar.setup({inputField:"form_begin_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_begin_date", showsTime:'true'});
415 Calendar.setup({inputField:"form_end_date", ifFormat:"%Y-%m-%d %H:%M:%S", button:"img_end_date", showsTime:'true'});
417 </script>
419 </html>