Direct Messaging update: add CCR transmit, more meaningful attachment filenames
[openemr.git] / interface / patient_file / report / patient_report.php
blob1575c08c24514ea636160f2d51309111ac137022
1 <?php
3 include_once("../../globals.php");
4 include_once("$srcdir/lists.inc");
5 include_once("$srcdir/acl.inc");
6 include_once("$srcdir/forms.inc");
8 // get various authorization levels
9 $auth_notes_a = acl_check('encounters', 'notes_a');
10 $auth_notes = acl_check('encounters', 'notes');
11 $auth_coding_a = acl_check('encounters', 'coding_a');
12 $auth_coding = acl_check('encounters', 'coding');
13 $auth_relaxed = acl_check('encounters', 'relaxed');
14 $auth_med = acl_check('patients' , 'med');
15 $auth_demo = acl_check('patients' , 'demo');
18 <html>
19 <head>
20 <?php html_header_show();?>
22 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
23 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
24 <script type="text/javascript" src="../../../library/textformat.js"></script>
25 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
26 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
27 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
29 <!-- include jQuery support -->
30 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script>
32 <script language='JavaScript'>
34 function checkAll(check) {
35 var f = document.forms['report_form'];
36 for (var i = 0; i < f.elements.length; ++i) {
37 if (f.elements[i].type == 'checkbox') f.elements[i].checked = check;
39 return false;
42 function show_date_fun(){
43 if(document.getElementById('show_date').checked == true){
44 document.getElementById('date_div').style.display = '';
45 }else{
46 document.getElementById('date_div').style.display = 'none';
48 return;
51 </script>
53 </head>
55 <body class="body_top">
56 <div id="patient_reports"> <!-- large outer DIV -->
58 <?php if ( $GLOBALS['activate_ccr_ccd_report'] ) { // show CCR/CCD reporting options ?>
59 <div id="ccr_report">
61 <form name='ccr_form' id='ccr_form' method='post' action='../../../ccr/createCCR.php'>
62 <span class='title'><?php xl('Continuity of Care Record (CCR)','e'); ?></span>&nbsp;&nbsp;
63 <br/>
64 <span class='text'>(<?php xl('Pop ups need to be enabled to see these reports','e'); ?>)</span>
65 <br/>
66 <br/>
67 <input type='hidden' name='ccrAction'>
68 <input type='hidden' name='raw'>
69 <input type="checkbox" name="show_date" id="show_date" onchange="show_date_fun();" ><span class='text'><?php xl('Use Date Range','e'); ?>
70 <br>
71 <div id="date_div" style="display:none" >
72 <br>
73 <table border="0" cellpadding="0" cellspacing="0" >
74 <tr>
75 <td>
76 <span class='bold'><?php xl('Start Date','e');?>: </span>
77 </td>
78 <td>
79 <input type='text' size='10' name='Start' id='Start'
80 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
81 title='<?php xl('yyyy-mm-dd','e'); ?>' />
82 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
83 id='img_start' border='0' alt='[?]' style='cursor:pointer'
84 title='<?php xl('Click here to choose a date','e'); ?>' >
85 <script LANGUAGE="JavaScript">
86 Calendar.setup({inputField:"Start", ifFormat:"%Y-%m-%d", button:"img_start"});
87 </script>
88 </td>
89 <td>
90 &nbsp;
91 <span class='bold'><?php xl('End Date','e');?>: </span>
92 </td>
93 <td>
94 <input type='text' size='10' name='End' id='End'
95 onkeyup='datekeyup(this,mypcc)' onblur='dateblur(this,mypcc)'
96 title='<?php xl('yyyy-mm-dd','e'); ?>' />
97 <img src='../../pic/show_calendar.gif' align='absbottom' width='24' height='22'
98 id='img_end' border='0' alt='[?]' style='cursor:pointer'
99 title='<?php xl('Click here to choose a date','e'); ?>' >
100 <script LANGUAGE="JavaScript">
101 Calendar.setup({inputField:"End", ifFormat:"%Y-%m-%d", button:"img_end"});
102 </script>
103 </td>
104 </tr>
105 </table>
106 </div>
107 <br>
108 <input type="button" class="generateCCR" value="<?php xl('View/Print','e'); ?>" />
109 <!-- <input type="button" class="generateCCR_download_h" value="<?php echo xl('Download')." (Hybrid)"; ?>" /> -->
110 <input type="button" class="generateCCR_download_p" value="<?php echo xl('Download'); ?>" />
111 <!-- <input type="button" class="generateCCR_raw" value="<?php xl('Raw Report','e'); ?>" /> -->
112 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?>
113 <input type="button" class="viewCCR_send_dialog" value="<?php echo htmlspecialchars( xl('Transmit', ENT_QUOTES)); ?>" />
114 <br>
115 <div id="ccr_send_dialog" style="display:none" >
116 <br>
117 <table border="0" cellpadding="0" cellspacing="0" >
118 <tr>
119 <td>
120 <span class='bold'><?php echo htmlspecialchars( xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES);?>: </span>
121 <input type="text" size="64" name="ccr_send_to" id="ccr_send_to" value="">
122 <input type="hidden" name="ccr_sent_by" id="ccr_sent_by" value="user">
123 <input type="button" class="viewCCR_transmit" value="<?php echo htmlspecialchars( xl('Send', ENT_QUOTES)); ?>" />
124 <div id="ccr_send_result" style="display:none" >
125 <span class="text" id="ccr_send_message"></span>
126 </div>
127 </td>
128 </tr>
129 </table>
130 </div>
131 <?php } ?>
132 <hr/>
133 <span class='title'><?php xl('Continuity of Care Document (CCD)','e'); ?></span>&nbsp;&nbsp;
134 <br/>
135 <span class='text'>(<?php xl('Pop ups need to be enabled to see these reports','e'); ?>)</span>
136 <br/>
137 <br/>
138 <input type="button" class="viewCCD" value="<?php xl('View/Print','e'); ?>" />
139 <input type="button" class="viewCCD_download" value="<?php echo htmlspecialchars( xl('Download', ENT_QUOTES)); ?>" />
140 <!-- <input type="button" class="viewCCD_raw" value="<?php xl('Raw Report','e'); ?>" /> -->
141 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?>
142 <input type="button" class="viewCCD_send_dialog" value="<?php echo htmlspecialchars( xl('Transmit', ENT_QUOTES)); ?>" />
143 <br>
144 <div id="ccd_send_dialog" style="display:none" >
145 <br>
146 <table border="0" cellpadding="0" cellspacing="0" >
147 <tr>
148 <td>
149 <span class='bold'><?php echo htmlspecialchars( xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES);?>: </span>
150 <input type="text" size="64" name="ccd_send_to" id="ccd_send_to" value="">
151 <input type="hidden" name="ccd_sent_by" id="ccd_sent_by" value="user">
152 <input type="button" class="viewCCD_transmit" value="<?php echo htmlspecialchars( xl('Send', ENT_QUOTES)); ?>" />
153 <div id="ccd_send_result" style="display:none" >
154 <span class="text" id="ccd_send_message"></span>
155 </div>
156 </td>
157 </tr>
158 </table>
159 </div>
160 <?php } ?>
162 </form>
163 <hr/>
164 <hr/>
166 </div>
167 <?php } // end CCR/CCD reporting options ?>
169 <form name='report_form' id="report_form" method='post' action='custom_report.php'>
172 <span class='title'><?php xl('Patient Report','e'); ?></span>&nbsp;&nbsp;
174 <!--
175 <a class="link_submit" href="full_report.php" onclick="top.restoreSession()">
176 [<?php xl('View Comprehensive Patient Report','e'); ?>]</a>
178 <a class="link_submit" href="#" onclick="return checkAll(true)"><?php xl('Check All','e'); ?></a>
180 <a class="link_submit" href="#" onclick="return checkAll(false)"><?php xl('Clear All','e'); ?></a>
183 <table class="includes">
184 <tr>
185 <td class='text'>
186 <input type='checkbox' name='include_demographics' id='include_demographics' value="demographics" checked><?php xl('Demographics','e'); ?><br>
187 <?php if (acl_check('patients', 'med')): ?>
188 <input type='checkbox' name='include_history' id='include_history' value="history"><?php xl(' History','e'); ?><br>
189 <?php endif; ?>
190 <!--
191 <input type='checkbox' name='include_employer' id='include_employer' value="employer"><?php xl('Employer','e'); ?><br>
193 <input type='checkbox' name='include_insurance' id='include_insurance' value="insurance"><?php xl('Insurance','e'); ?><br>
194 <input type='checkbox' name='include_billing' id='include_billing' value="billing"
195 <?php if (!$GLOBALS['simplified_demographics']) echo 'checked'; ?>><?php xl('Billing','e'); ?><br>
196 </td>
197 <td class='text'>
198 <!--
199 <input type='checkbox' name='include_allergies' id='include_allergies' value="allergies">Allergies<br>
200 <input type='checkbox' name='include_medications' id='include_medications' value="medications">Medications<br>
202 <input type='checkbox' name='include_immunizations' id='include_immunizations' value="immunizations"><?php xl('Immunizations','e'); ?><br>
203 <!--
204 <input type='checkbox' name='include_medical_problems' id='include_medical_problems' value="medical_problems">Medical Problems<br>
206 <input type='checkbox' name='include_notes' id='include_notes' value="notes"><?php xl('Patient Notes','e'); ?><br>
207 <input type='checkbox' name='include_transactions' id='include_transactions' value="transactions"><?php xl('Transactions','e'); ?><br>
208 <input type='checkbox' name='include_batchcom' id='include_batchcom' value="batchcom"><?php xl('Communications','e'); ?><br>
209 </td>
210 </tr>
211 </table>
213 <br>
214 <input type="button" class="genreport" value="<?php xl('Generate Report','e'); ?>" />&nbsp;
215 <input type="button" class="genpdfrep" value="<?php xl('Download PDF','e'); ?>" />
216 <input type='hidden' name='pdf' value='0'>
217 <br>
219 <!-- old ccr button position -->
220 <hr/>
222 <table class="issues_encounters_forms">
223 <tr>
225 <!-- Issues -->
226 <td class='text'>
227 <div class="issues">
228 <span class='bold'><?php xl('Issues','e'); ?>:</span>
229 <br>
230 <br>
232 <?php if (! acl_check('patients', 'med')): ?>
233 <br>(Issues not authorized)
235 <?php else: ?>
236 <table>
238 <?php
239 // get issues
240 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
241 "ORDER BY type, begdate");
242 $lasttype = "";
243 while ($prow = sqlFetchArray($pres)) {
244 if ($lasttype != $prow['type']) {
245 $lasttype = $prow['type'];
247 /****
248 $disptype = $lasttype;
249 switch ($lasttype) {
250 case "allergy" : $disptype = "Allergies" ; break;
251 case "problem" :
252 case "medical_problem": $disptype = "Medical Problems"; break;
253 case "medication" : $disptype = "Medications" ; break;
254 case "surgery" : $disptype = "Surgeries" ; break;
256 ****/
257 $disptype = $ISSUE_TYPES[$lasttype][0];
259 echo " <tr>\n";
260 echo " <td colspan='4' class='bold'><b>$disptype</b></td>\n";
261 echo " </tr>\n";
263 $rowid = $prow['id'];
264 $disptitle = trim($prow['title']) ? $prow['title'] : "[Missing Title]";
266 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
267 "pid = '$pid' AND list_id = '$rowid'");
269 echo " <tr class='text'>\n";
270 echo " <td>&nbsp;</td>\n";
271 echo " <td>";
272 echo "<input type='checkbox' name='issue_$rowid' id='issue_$rowid' class='issuecheckbox' value='/";
273 while ($ierow = sqlFetchArray($ieres)) {
274 echo $ierow['encounter'] . "/";
276 echo "' />$disptitle</td>\n";
277 echo " <td>" . $prow['begdate'];
279 if ($prow['enddate']) { echo " - " . $prow['enddate']; }
280 else { echo " Active"; }
282 echo "</td>\n";
283 echo "</tr>\n";
286 </table>
288 <?php endif; // end of Issues output ?>
290 </div> <!-- end issues DIV -->
291 </td>
293 <!-- Encounters and Forms -->
295 <td class='text'>
296 <div class='encounters'>
297 <span class='bold'><?php xl('Encounters &amp; Forms','e'); ?>:</span>
298 <br><br>
300 <?php if (!($auth_notes_a || $auth_notes || $auth_coding_a || $auth_coding || $auth_med || $auth_relaxed)): ?>
301 (Encounters not authorized)
302 <?php else: ?>
304 <?php
306 $isfirst = 1;
307 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
308 "forms.formdir, forms.date AS fdate, form_encounter.date " .
309 ",form_encounter.reason ".
310 "FROM forms, form_encounter WHERE " .
311 "forms.pid = '$pid' AND form_encounter.pid = '$pid' AND " .
312 "form_encounter.encounter = forms.encounter " .
313 " AND forms.deleted=0 ". // --JRM--
314 "ORDER BY form_encounter.date DESC, fdate ASC");
315 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
316 $html_strings = array();
317 $registry_form_name = array();
318 while($result2 = sqlFetchArray($res2)) {
319 array_push($registry_form_name,trim($result2['name']));
321 while($result = sqlFetchArray($res)) {
322 if ($result{"form_name"} == "New Patient Encounter") {
323 if ($isfirst == 0) {
324 foreach($registry_form_name as $var) {
325 if ($toprint = $html_strings[$var]) {
326 foreach($toprint as $var) {print $var;}
329 $html_strings = array();
330 echo "</div>\n"; // end DIV encounter_forms
331 echo "</div>\n\n"; //end DIV encounter_data
332 echo "<br>";
334 $isfirst = 0;
335 echo "<div class='encounter_data'>\n";
336 echo "<input type=checkbox ".
337 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
338 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
339 " value='" . $result{"encounter"} . "'" .
340 " class='encounter'".
341 " >";
343 // show encounter reason, not just 'New Encounter'
344 // trim to a reasonable length for display purposes --cfapress
345 $maxReasonLength = 20;
346 if (strlen($result["reason"]) > $maxReasonLength) {
347 $result['reason'] = substr($result['reason'], 0, $maxReasonLength) . " ... ";
350 echo $result{"reason"}.
351 " (" . date("Y-m-d",strtotime($result{"date"})) .
352 ")\n";
353 echo "<div class='encounter_forms'>\n";
355 else {
356 $form_name = trim($result{"form_name"});
357 //if form name is not in registry, look for the closest match by
358 // finding a registry name which is at the start of the form name.
359 //this is to allow for forms to put additional helpful information
360 //in the database in the same string as their form name after the name
361 $form_name_found_flag = 0;
362 foreach($registry_form_name as $var) {if ($var == $form_name) {$form_name_found_flag = 1;}}
363 // if the form does not match precisely with any names in the registry, now see if any front partial matches
364 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
365 if (!$form_name_found_flag) { foreach($registry_form_name as $var) {if (strpos($form_name,$var) == 0) {$form_name = $var;}}}
367 if (!is_array($html_strings[$form_name])) {$html_strings[$form_name] = array();}
368 array_push($html_strings[$form_name], "<input type='checkbox' ".
369 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
370 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
371 " value='" . $result{"encounter"} . "'" .
372 " class='encounter_form' ".
373 ">" . xl_form_title($result{"form_name"}) . "<br>\n");
376 foreach($registry_form_name as $var) {
377 if ($toprint = $html_strings[$var]) {
378 foreach($toprint as $var) {print $var;}
383 <?php endif; ?>
385 </div> <!-- end encounters DIV -->
386 </td>
387 </tr>
388 </table>
389 <input type="button" class="genreport" value="<?php xl('Generate Report','e'); ?>" />&nbsp;
390 <input type="button" class="genpdfrep" value="<?php xl('Download PDF','e'); ?>" />
392 <hr/>
394 <span class="bold"><?php xl('Documents','e'); ?></span>:<br>
395 <ul>
396 <?php
397 // show available documents
398 $db = $GLOBALS['adodb']['db'];
399 $sql = "SELECT d.id, d.url, c.name FROM documents AS d " .
400 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
401 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
402 "d.foreign_id = " . $db->qstr($pid);
403 $result = $db->Execute($sql);
404 if ($db->ErrorMsg()) echo $db->ErrorMsg();
405 while ($result && !$result->EOF) {
406 echo "<li class='bold'>";
407 echo '<input type="checkbox" name="documents[]" value="' .
408 $result->fields['id'] . '">';
409 echo '&nbsp;&nbsp;<i>' . xl_document_category($result->fields['name']) . "</i>";
410 echo '&nbsp;&nbsp;' . xl('Name') . ': <i>' . basename($result->fields['url']) . "</i>";
411 echo '</li>';
412 $result->MoveNext();
415 </ul>
416 </form>
418 <input type="button" class="genreport" value="<?php xl('Generate Report','e'); ?>" />&nbsp;
419 <input type="button" class="genpdfrep" value="<?php xl('Download PDF','e'); ?>" />
421 </div> <!-- close patient_reports DIV -->
422 </body>
424 <script language="javascript">
426 // jQuery stuff to make the page a little easier to use
427 $(document).ready(function(){
428 $(".genreport").click(function() { top.restoreSession(); document.report_form.pdf.value = 0; $("#report_form").submit(); });
429 $(".genpdfrep").click(function() { top.restoreSession(); document.report_form.pdf.value = 1; $("#report_form").submit(); });
430 $("#genfullreport").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
431 //$("#printform").click(function() { PrintForm(); });
432 $(".issuecheckbox").click(function() { issueClick(this); });
434 // check/uncheck all Forms of an encounter
435 $(".encounter").click(function() { SelectForms($(this)); });
437 $(".generateCCR").click(
438 function() {
439 if(document.getElementById('show_date').checked == true){
440 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
441 alert('<?php echo addslashes( xl('Please select a start date and end date')) ?>');
442 return false;
445 var ccrAction = document.getElementsByName('ccrAction');
446 ccrAction[0].value = 'generate';
447 var raw = document.getElementsByName('raw');
448 raw[0].value = 'no';
449 top.restoreSession();
450 ccr_form.setAttribute("target", "_blank");
451 $("#ccr_form").submit();
452 ccr_form.setAttribute("target", "");
454 $(".generateCCR_raw").click(
455 function() {
456 var ccrAction = document.getElementsByName('ccrAction');
457 ccrAction[0].value = 'generate';
458 var raw = document.getElementsByName('raw');
459 raw[0].value = 'yes';
460 top.restoreSession();
461 ccr_form.setAttribute("target", "_blank");
462 $("#ccr_form").submit();
463 ccr_form.setAttribute("target", "");
465 $(".generateCCR_download_h").click(
466 function() {
467 var ccrAction = document.getElementsByName('ccrAction');
468 ccrAction[0].value = 'generate';
469 var raw = document.getElementsByName('raw');
470 raw[0].value = 'hybrid';
471 top.restoreSession();
472 $("#ccr_form").submit();
474 $(".generateCCR_download_p").click(
475 function() {
476 if(document.getElementById('show_date').checked == true){
477 if(document.getElementById('Start').value == '' || document.getElementById('End').value == ''){
478 alert('<?php echo addslashes( xl('Please select a start date and end date')) ?>');
479 return false;
482 var ccrAction = document.getElementsByName('ccrAction');
483 ccrAction[0].value = 'generate';
484 var raw = document.getElementsByName('raw');
485 raw[0].value = 'pure';
486 top.restoreSession();
487 $("#ccr_form").submit();
489 $(".viewCCD").click(
490 function() {
491 var ccrAction = document.getElementsByName('ccrAction');
492 ccrAction[0].value = 'viewccd';
493 var raw = document.getElementsByName('raw');
494 raw[0].value = 'no';
495 top.restoreSession();
496 ccr_form.setAttribute("target", "_blank");
497 $("#ccr_form").submit();
498 ccr_form.setAttribute("target", "");
500 $(".viewCCD_raw").click(
501 function() {
502 var ccrAction = document.getElementsByName('ccrAction');
503 ccrAction[0].value = 'viewccd';
504 var raw = document.getElementsByName('raw');
505 raw[0].value = 'yes';
506 top.restoreSession();
507 ccr_form.setAttribute("target", "_blank");
508 $("#ccr_form").submit();
509 ccr_form.setAttribute("target", "");
511 $(".viewCCD_download").click(
512 function() {
513 var ccrAction = document.getElementsByName('ccrAction');
514 ccrAction[0].value = 'viewccd';
515 var raw = document.getElementsByName('raw');
516 raw[0].value = 'pure';
517 $("#ccr_form").submit();
519 <?php if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?>
520 $(".viewCCR_send_dialog").click(
521 function() {
522 $("#ccr_send_dialog").toggle();
524 $(".viewCCR_transmit").click(
525 function() {
526 $(".viewCCR_transmit").attr('disabled','disabled');
527 var ccrAction = document.getElementsByName('ccrAction');
528 ccrAction[0].value = 'generate';
529 var ccrRecipient = $("#ccr_send_to").val();
530 var raw = document.getElementsByName('raw');
531 raw[0].value = 'send '+ccrRecipient;
532 if(ccrRecipient=="") {
533 $("#ccr_send_message").html("<?php
534 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
535 $("#ccr_send_result").show();
536 } else {
537 $(".viewCCR_transmit").attr('disabled','disabled');
538 $("#ccr_send_message").html("<?php
539 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
540 $("#ccr_send_result").show();
541 var action=$("#ccr_form").attr('action');
542 $.post(action, {ccrAction:'generate',raw:'send '+ccrRecipient,requested_by:'user'},
543 function(data) {
544 if(data=="SUCCESS") {
545 $("#ccr_send_message").html("<?php
546 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
547 ?> "+ccrRecipient);
548 $("#ccr_send_to").val("");
549 } else {
550 $("#ccr_send_message").html(data);
552 $(".viewCCR_transmit").removeAttr('disabled');
556 <?php }
557 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?>
558 $(".viewCCD_send_dialog").click(
559 function() {
560 $("#ccd_send_dialog").toggle();
562 $(".viewCCD_transmit").click(
563 function() {
564 $(".viewCCD_transmit").attr('disabled','disabled');
565 var ccrAction = document.getElementsByName('ccrAction');
566 ccrAction[0].value = 'viewccd';
567 var ccdRecipient = $("#ccd_send_to").val();
568 var raw = document.getElementsByName('raw');
569 raw[0].value = 'send '+ccdRecipient;
570 if(ccdRecipient=="") {
571 $("#ccd_send_message").html("<?php
572 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
573 $("#ccd_send_result").show();
574 } else {
575 $(".viewCCD_transmit").attr('disabled','disabled');
576 $("#ccd_send_message").html("<?php
577 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
578 $("#ccd_send_result").show();
579 var action=$("#ccr_form").attr('action');
580 $.post(action, {ccrAction:'viewccd',raw:'send '+ccdRecipient,requested_by:'user'},
581 function(data) {
582 if(data=="SUCCESS") {
583 $("#ccd_send_message").html("<?php
584 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
585 ?> "+ccdRecipient);
586 $("#ccd_send_to").val("");
587 } else {
588 $("#ccd_send_message").html(data);
590 $(".viewCCD_transmit").removeAttr('disabled');
594 <?php } ?>
598 // select/deselect the Forms related to the selected Encounter
599 // (it ain't pretty code folks)
600 var SelectForms = function (selectedEncounter) {
601 if ($(selectedEncounter).attr("checked")) {
602 $(selectedEncounter).parent().children().each(function(i, obj) {
603 $(this).children().each(function(i, obj) {
604 $(this).attr("checked", "checked");
608 else {
609 $(selectedEncounter).parent().children().each(function(i, obj) {
610 $(this).children().each(function(i, obj) {
611 $(this).removeAttr("checked");
617 // When an issue is checked, auto-check all the related encounters and forms
618 function issueClick(issue) {
619 // do nothing when unchecked
620 if (! $(issue).attr("checked")) return;
622 $("#report_form :checkbox").each(function(i, obj) {
623 if ($(issue).val().indexOf('/' + $(this).val() + '/') >= 0) {
624 $(this).attr("checked", "checked");
630 </script>
632 </html>