3 require_once("../../globals.php");
4 require_once("$srcdir/lists.inc");
5 require_once("$srcdir/acl.inc");
6 require_once("$srcdir/forms.inc");
7 require_once("$srcdir/patient.inc");
8 require_once("$srcdir/formatting.inc.php");
10 // get various authorization levels
11 $auth_notes_a = acl_check('encounters', 'notes_a');
12 $auth_notes = acl_check('encounters', 'notes');
13 $auth_coding_a = acl_check('encounters', 'coding_a');
14 $auth_coding = acl_check('encounters', 'coding');
15 $auth_relaxed = acl_check('encounters', 'relaxed');
16 $auth_med = acl_check('patients' , 'med');
17 $auth_demo = acl_check('patients' , 'demo');
20 if ($GLOBALS['gbl_portal_cms_enable']) {
21 $ptdata = getPatientData($pid, 'cmsportal_login');
22 $cmsportal = $ptdata['cmsportal_login'] !== '';
27 <?php
html_header_show();?
>
29 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
30 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
31 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
32 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
33 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
34 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
36 <!-- include jQuery support
-->
37 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script
>
39 <script language
='JavaScript'>
41 function checkAll(check
) {
42 var f
= document
.forms
['report_form'];
43 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
44 if (f
.elements
[i
].type
== 'checkbox') f
.elements
[i
].checked
= check
;
49 function show_date_fun(){
50 if(document
.getElementById('show_date').checked
== true){
51 document
.getElementById('date_div').style
.display
= '';
53 document
.getElementById('date_div').style
.display
= 'none';
62 <body
class="body_top">
63 <div id
="patient_reports"> <!-- large outer DIV
-->
66 <span
class='title'><?php
echo xlt('Patient Reports'); ?
></span
>
69 <?php
if ( $GLOBALS['activate_ccr_ccd_report'] ) { // show CCR/CCD reporting options ?>
72 <form name
='ccr_form' id
='ccr_form' method
='post' action
='../../../ccr/createCCR.php'>
73 <span
class='title'><?php
xl('Continuity of Care Record (CCR)','e'); ?
></span
> 
; 
;
75 <span
class='text'>(<?php
xl('Pop ups need to be enabled to see these reports','e'); ?
>)</span
>
78 <input type
='hidden' name
='ccrAction'>
79 <input type
='hidden' name
='raw'>
80 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
xl('Use Date Range','e'); ?
>
82 <div id
="date_div" style
="display:none" >
84 <table border
="0" cellpadding
="0" cellspacing
="0" >
87 <span
class='bold'><?php
xl('Start Date','e');?
>: </span
>
90 <input type
='text' size
='10' name
='Start' id
='Start'
91 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
92 title
='<?php xl('yyyy
-mm
-dd
','e
'); ?>' />
93 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
94 id
='img_start' border
='0' alt
='[?]' style
='cursor:pointer'
95 title
='<?php xl('Click here to choose a date
','e
'); ?>' >
96 <script LANGUAGE
="JavaScript">
97 Calendar
.setup({inputField
:"Start", ifFormat
:"%Y-%m-%d", button
:"img_start"});
102 <span
class='bold'><?php
xl('End Date','e');?
>: </span
>
105 <input type
='text' size
='10' name
='End' id
='End'
106 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
107 title
='<?php xl('yyyy
-mm
-dd
','e
'); ?>' />
108 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
109 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
110 title
='<?php xl('Click here to choose a date
','e
'); ?>' >
111 <script LANGUAGE
="JavaScript">
112 Calendar
.setup({inputField
:"End", ifFormat
:"%Y-%m-%d", button
:"img_end"});
119 <input type
="button" class="generateCCR" value
="<?php echo xla('Generate Report'); ?>" />
120 <!-- <input type
="button" class="generateCCR_download_h" value
="<?php echo xl('Download')." (Hybrid
)"; ?>" /> -->
121 <input type
="button" class="generateCCR_download_p" value
="<?php echo xl('Download'); ?>" />
122 <!-- <input type
="button" class="generateCCR_raw" value
="<?php xl('Raw Report','e'); ?>" /> -->
123 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
124 <input type
="button" class="viewCCR_send_dialog" value
="<?php echo htmlspecialchars( xl('Transmit', ENT_QUOTES)); ?>" />
126 <div id
="ccr_send_dialog" style
="display:none" >
128 <table border
="0" cellpadding
="0" cellspacing
="0" >
131 <span
class='bold'><?php
echo htmlspecialchars( xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES
);?
>: </span
>
132 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="">
133 <input type
="hidden" name
="ccr_sent_by" id
="ccr_sent_by" value
="user">
134 <input type
="button" class="viewCCR_transmit" value
="<?php echo htmlspecialchars( xl('Send', ENT_QUOTES)); ?>" />
135 <div id
="ccr_send_result" style
="display:none" >
136 <span
class="text" id
="ccr_send_message"></span
>
144 <span
class='title'><?php
xl('Continuity of Care Document (CCD)','e'); ?
></span
> 
; 
;
146 <span
class='text'>(<?php
xl('Pop ups need to be enabled to see these reports','e'); ?
>)</span
>
149 <input type
="button" class="viewCCD" value
="<?php echo xla('Generate Report'); ?>" />
150 <input type
="button" class="viewCCD_download" value
="<?php echo htmlspecialchars( xl('Download', ENT_QUOTES)); ?>" />
151 <!-- <input type
="button" class="viewCCD_raw" value
="<?php xl('Raw Report','e'); ?>" /> -->
152 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
153 <input type
="button" class="viewCCD_send_dialog" value
="<?php echo htmlspecialchars( xl('Transmit', ENT_QUOTES)); ?>" />
155 <div id
="ccd_send_dialog" style
="display:none" >
157 <table border
="0" cellpadding
="0" cellspacing
="0" >
160 <span
class='bold'><?php
echo htmlspecialchars( xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES
);?
>: </span
>
161 <input type
="text" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="">
162 <input type
="hidden" name
="ccd_sent_by" id
="ccd_sent_by" value
="user">
163 <input type
="button" class="viewCCD_transmit" value
="<?php echo htmlspecialchars( xl('Send', ENT_QUOTES)); ?>" />
164 <div id
="ccd_send_result" style
="display:none" >
165 <span
class="text" id
="ccd_send_message"></span
>
178 <?php
} // end CCR/CCD reporting options ?>
180 <form name
='report_form' id
="report_form" method
='post' action
='custom_report.php'>
183 <span
class='title'><?php
xl('Patient Report','e'); ?
></span
> 
; 
;
186 <a
class="link_submit" href
="full_report.php" onclick
="top.restoreSession()">
187 [<?php
xl('View Comprehensive Patient Report','e'); ?
>]</a
>
189 <a
class="link_submit" href
="#" onclick
="return checkAll(true)"><?php
xl('Check All','e'); ?
></a
>
191 <a
class="link_submit" href
="#" onclick
="return checkAll(false)"><?php
xl('Clear All','e'); ?
></a
>
194 <table
class="includes">
197 <input type
='checkbox' name
='include_demographics' id
='include_demographics' value
="demographics" checked
><?php
xl('Demographics','e'); ?
><br
>
198 <?php
if (acl_check('patients', 'med')): ?
>
199 <input type
='checkbox' name
='include_history' id
='include_history' value
="history"><?php
xl('History','e'); ?
><br
>
202 <input type
='checkbox' name
='include_employer' id
='include_employer' value
="employer"><?php
xl('Employer','e'); ?
><br
>
204 <input type
='checkbox' name
='include_insurance' id
='include_insurance' value
="insurance"><?php
xl('Insurance','e'); ?
><br
>
205 <input type
='checkbox' name
='include_billing' id
='include_billing' value
="billing"
206 <?php
if (!$GLOBALS['simplified_demographics']) echo 'checked'; ?
>><?php
xl('Billing','e'); ?
><br
>
210 <input type
='checkbox' name
='include_allergies' id
='include_allergies' value
="allergies">Allergies
<br
>
211 <input type
='checkbox' name
='include_medications' id
='include_medications' value
="medications">Medications
<br
>
213 <input type
='checkbox' name
='include_immunizations' id
='include_immunizations' value
="immunizations"><?php
xl('Immunizations','e'); ?
><br
>
215 <input type
='checkbox' name
='include_medical_problems' id
='include_medical_problems' value
="medical_problems">Medical Problems
<br
>
217 <input type
='checkbox' name
='include_notes' id
='include_notes' value
="notes"><?php
xl('Patient Notes','e'); ?
><br
>
218 <input type
='checkbox' name
='include_transactions' id
='include_transactions' value
="transactions"><?php
xl('Transactions','e'); ?
><br
>
219 <input type
='checkbox' name
='include_batchcom' id
='include_batchcom' value
="batchcom"><?php
xl('Communications','e'); ?
><br
>
222 <input type
='checkbox' name
='include_recurring_days' id
='include_recurring_days' value
="recurring_days" ><?php
echo xlt('Recurrent Appointments'); ?
><br
>
228 <input type
="button" class="genreport" value
="<?php xl('Generate Report','e'); ?>" /> 
;
229 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF','e'); ?>" /> 
;
230 <?php
if ($cmsportal) { ?
>
231 <input type
="button" class="genportal" value
="<?php xl('Send to Portal','e'); ?>" />
233 <input type
='hidden' name
='pdf' value
='0'>
236 <!-- old ccr button position
-->
239 <table
class="issues_encounters_forms">
245 <span
class='bold'><?php
xl('Issues','e'); ?
>:</span
>
249 <?php
if (! acl_check('patients', 'med')): ?
>
250 <br
>(Issues not authorized
)
257 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
258 "ORDER BY type, begdate");
260 while ($prow = sqlFetchArray($pres)) {
261 if ($lasttype != $prow['type']) {
262 $lasttype = $prow['type'];
265 $disptype = $lasttype;
267 case "allergy" : $disptype = "Allergies" ; break;
269 case "medical_problem": $disptype = "Medical Problems"; break;
270 case "medication" : $disptype = "Medications" ; break;
271 case "surgery" : $disptype = "Surgeries" ; break;
274 $disptype = $ISSUE_TYPES[$lasttype][0];
277 echo " <td colspan='4' class='bold'><b>$disptype</b></td>\n";
280 $rowid = $prow['id'];
281 $disptitle = trim($prow['title']) ?
$prow['title'] : "[Missing Title]";
283 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
284 "pid = '$pid' AND list_id = '$rowid'");
286 echo " <tr class='text'>\n";
287 echo " <td> </td>\n";
289 echo "<input type='checkbox' name='issue_$rowid' id='issue_$rowid' class='issuecheckbox' value='/";
290 while ($ierow = sqlFetchArray($ieres)) {
291 echo $ierow['encounter'] . "/";
293 echo "' />$disptitle</td>\n";
294 echo " <td>" . $prow['begdate'];
296 if ($prow['enddate']) { echo " - " . $prow['enddate']; }
297 else { echo " Active"; }
305 <?php
endif; // end of Issues output ?>
307 </div
> <!-- end issues DIV
-->
310 <!-- Encounters
and Forms
-->
313 <div
class='encounters'>
314 <span
class='bold'><?php
xl('Encounters & Forms','e'); ?
>:</span
>
317 <?php
if (!($auth_notes_a ||
$auth_notes ||
$auth_coding_a ||
$auth_coding ||
$auth_med ||
$auth_relaxed)): ?
>
318 (Encounters not authorized
)
324 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
325 "forms.formdir, forms.date AS fdate, form_encounter.date " .
326 ",form_encounter.reason ".
327 "FROM forms, form_encounter WHERE " .
328 "forms.pid = '$pid' AND form_encounter.pid = '$pid' AND " .
329 "form_encounter.encounter = forms.encounter " .
330 " AND forms.deleted=0 ". // --JRM--
331 "ORDER BY form_encounter.date DESC, fdate ASC");
332 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
333 $html_strings = array();
334 $registry_form_name = array();
335 while($result2 = sqlFetchArray($res2)) {
336 array_push($registry_form_name,trim($result2['name']));
338 while($result = sqlFetchArray($res)) {
339 if ($result{"form_name"} == "New Patient Encounter") {
341 foreach($registry_form_name as $var) {
342 if ($toprint = $html_strings[$var]) {
343 foreach($toprint as $var) {print $var;}
346 $html_strings = array();
347 echo "</div>\n"; // end DIV encounter_forms
348 echo "</div>\n\n"; //end DIV encounter_data
352 echo "<div class='encounter_data'>\n";
353 echo "<input type=checkbox ".
354 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
355 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
356 " value='" . $result{"encounter"} . "'" .
357 " class='encounter'".
360 // show encounter reason, not just 'New Encounter'
361 // trim to a reasonable length for display purposes --cfapress
362 $maxReasonLength = 20;
363 if (strlen($result["reason"]) > $maxReasonLength) {
364 // The default encoding for this mb_substr() call is set near top of globals.php
365 $result['reason'] = mb_substr($result['reason'], 0, $maxReasonLength) . " ... ";
368 echo $result{"reason"}.
369 " (" . date("Y-m-d",strtotime($result{"date"})) .
371 echo "<div class='encounter_forms'>\n";
374 $form_name = trim($result{"form_name"});
375 //if form name is not in registry, look for the closest match by
376 // finding a registry name which is at the start of the form name.
377 //this is to allow for forms to put additional helpful information
378 //in the database in the same string as their form name after the name
379 $form_name_found_flag = 0;
380 foreach($registry_form_name as $var) {if ($var == $form_name) {$form_name_found_flag = 1;}}
381 // if the form does not match precisely with any names in the registry, now see if any front partial matches
382 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
383 if (!$form_name_found_flag) { foreach($registry_form_name as $var) {if (strpos($form_name,$var) == 0) {$form_name = $var;}}}
385 if (!is_array($html_strings[$form_name])) {$html_strings[$form_name] = array();}
386 array_push($html_strings[$form_name], "<input type='checkbox' ".
387 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
388 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
389 " value='" . $result{"encounter"} . "'" .
390 " class='encounter_form' ".
391 ">" . xl_form_title($result{"form_name"}) . "<br>\n");
394 foreach($registry_form_name as $var) {
395 if ($toprint = $html_strings[$var]) {
396 foreach($toprint as $var) {print $var;}
403 </div
> <!-- end encounters DIV
-->
407 <input type
="button" class="genreport" value
="<?php xl('Generate Report','e'); ?>" /> 
;
408 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF','e'); ?>" /> 
;
409 <?php
if ($cmsportal) { ?
>
410 <input type
="button" class="genportal" value
="<?php xl('Send to Portal','e'); ?>" />
413 <!-- Procedure Orders
-->
415 <table border
="0" cellpadding
="0" cellspacing
="0" >
417 <td
class='bold'><?php
echo xlt('Procedures'); ?
> 
; 
;</td
>
418 <td
class='text'><?php
echo xlt('Order Date'); ?
> 
; 
;</td
>
419 <td
class='text'><?php
echo xlt('Encounter Date'); ?
> 
; 
;</td
>
420 <td
class='text'><?php
echo xlt('Order Descriptions'); ?
></td
>
423 $res = sqlStatement("SELECT po.procedure_order_id, po.date_ordered, fe.date " .
424 "FROM procedure_order AS po " .
425 "LEFT JOIN forms AS f ON f.pid = po.patient_id AND f.formdir = 'procedure_order' AND " .
426 "f.form_id = po.procedure_order_id AND f.deleted = 0 " .
427 "LEFT JOIN form_encounter AS fe ON fe.pid = f.pid AND fe.encounter = f.encounter " .
428 "WHERE po.patient_id = ? " .
429 "ORDER BY po.date_ordered DESC, po.procedure_order_id DESC",
431 while($row = sqlFetchArray($res)) {
432 $poid = $row['procedure_order_id'];
434 echo " <td align='center' class='text'>" .
435 "<input type='checkbox' name='procedures[]' value='$poid' /> </td>\n";
436 echo " <td class='text'>" . oeFormatShortDate($row['date_ordered']) . " </td>\n";
437 echo " <td class='text'>" . oeFormatShortDate($row['date']) . " </td>\n";
438 echo " <td class='text'>";
439 $opres = sqlStatement("SELECT procedure_code, procedure_name FROM procedure_order_code " .
440 "WHERE procedure_order_id = ? ORDER BY procedure_order_seq",
442 while($oprow = sqlFetchArray($opres)) {
443 $tmp = $oprow['procedure_name'];
444 if (empty($tmp)) $tmp = $oprow['procedure_code'];
445 echo text($tmp) . "<br />";
452 <input type
="button" class="genreport" value
="<?php xl('Generate Report','e'); ?>" /> 
;
453 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF','e'); ?>" />
456 <span
class="bold"><?php
xl('Documents','e'); ?
></span
>:<br
>
459 // show available documents
460 $db = $GLOBALS['adodb']['db'];
461 $sql = "SELECT d.id, d.url, c.name FROM documents AS d " .
462 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
463 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
464 "d.foreign_id = " . $db->qstr($pid);
465 $result = $db->Execute($sql);
466 if ($db->ErrorMsg()) echo $db->ErrorMsg();
467 while ($result && !$result->EOF
) {
468 echo "<li class='bold'>";
469 echo '<input type="checkbox" name="documents[]" value="' .
470 $result->fields
['id'] . '">';
471 echo ' <i>' . xl_document_category($result->fields
['name']) . "</i>";
472 echo ' ' . xl('Name') . ': <i>' . basename($result->fields
['url']) . "</i>";
480 <input type
="button" class="genreport" value
="<?php xl('Generate Report','e'); ?>" /> 
;
481 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF','e'); ?>" /> 
;
482 <?php
if ($cmsportal) { ?
>
483 <input type
="button" class="genportal" value
="<?php xl('Send to Portal','e'); ?>" />
486 </div
> <!-- close patient_reports DIV
-->
489 <script language
="javascript">
491 // jQuery stuff to make the page a little easier to use
492 $
(document
).ready(function(){
493 $
(".genreport").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 0; $
("#report_form").submit(); });
494 $
(".genpdfrep").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 1; $
("#report_form").submit(); });
495 $
(".genportal").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 2; $
("#report_form").submit(); });
496 $
("#genfullreport").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
497 //$("#printform").click(function() { PrintForm(); });
498 $
(".issuecheckbox").click(function() { issueClick(this
); });
500 // check/uncheck all Forms of an encounter
501 $
(".encounter").click(function() { SelectForms($
(this
)); });
503 $
(".generateCCR").click(
505 if(document
.getElementById('show_date').checked
== true){
506 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
507 alert('<?php echo addslashes( xl('Please select a start date
and end date
')) ?>');
511 var ccrAction
= document
.getElementsByName('ccrAction');
512 ccrAction
[0].value
= 'generate';
513 var raw
= document
.getElementsByName('raw');
515 top
.restoreSession();
516 ccr_form
.setAttribute("target", "_blank");
517 $
("#ccr_form").submit();
518 ccr_form
.setAttribute("target", "");
520 $
(".generateCCR_raw").click(
522 var ccrAction
= document
.getElementsByName('ccrAction');
523 ccrAction
[0].value
= 'generate';
524 var raw
= document
.getElementsByName('raw');
525 raw
[0].value
= 'yes';
526 top
.restoreSession();
527 ccr_form
.setAttribute("target", "_blank");
528 $
("#ccr_form").submit();
529 ccr_form
.setAttribute("target", "");
531 $
(".generateCCR_download_h").click(
533 var ccrAction
= document
.getElementsByName('ccrAction');
534 ccrAction
[0].value
= 'generate';
535 var raw
= document
.getElementsByName('raw');
536 raw
[0].value
= 'hybrid';
537 top
.restoreSession();
538 $
("#ccr_form").submit();
540 $
(".generateCCR_download_p").click(
542 if(document
.getElementById('show_date').checked
== true){
543 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
544 alert('<?php echo addslashes( xl('Please select a start date
and end date
')) ?>');
548 var ccrAction
= document
.getElementsByName('ccrAction');
549 ccrAction
[0].value
= 'generate';
550 var raw
= document
.getElementsByName('raw');
551 raw
[0].value
= 'pure';
552 top
.restoreSession();
553 $
("#ccr_form").submit();
557 var ccrAction
= document
.getElementsByName('ccrAction');
558 ccrAction
[0].value
= 'viewccd';
559 var raw
= document
.getElementsByName('raw');
561 top
.restoreSession();
562 ccr_form
.setAttribute("target", "_blank");
563 $
("#ccr_form").submit();
564 ccr_form
.setAttribute("target", "");
566 $
(".viewCCD_raw").click(
568 var ccrAction
= document
.getElementsByName('ccrAction');
569 ccrAction
[0].value
= 'viewccd';
570 var raw
= document
.getElementsByName('raw');
571 raw
[0].value
= 'yes';
572 top
.restoreSession();
573 ccr_form
.setAttribute("target", "_blank");
574 $
("#ccr_form").submit();
575 ccr_form
.setAttribute("target", "");
577 $
(".viewCCD_download").click(
579 var ccrAction
= document
.getElementsByName('ccrAction');
580 ccrAction
[0].value
= 'viewccd';
581 var raw
= document
.getElementsByName('raw');
582 raw
[0].value
= 'pure';
583 $
("#ccr_form").submit();
585 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
586 $
(".viewCCR_send_dialog").click(
588 $
("#ccr_send_dialog").toggle();
590 $
(".viewCCR_transmit").click(
592 $
(".viewCCR_transmit").attr('disabled','disabled');
593 var ccrAction
= document
.getElementsByName('ccrAction');
594 ccrAction
[0].value
= 'generate';
595 var ccrRecipient
= $
("#ccr_send_to").val();
596 var raw
= document
.getElementsByName('raw');
597 raw
[0].value
= 'send '+ccrRecipient
;
598 if(ccrRecipient
=="") {
599 $
("#ccr_send_message").html("<?php
600 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
601 $
("#ccr_send_result").show();
603 $
(".viewCCR_transmit").attr('disabled','disabled');
604 $
("#ccr_send_message").html("<?php
605 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
606 $
("#ccr_send_result").show();
607 var action
=$
("#ccr_form").attr('action');
608 $
.post(action
, {ccrAction
:'generate',raw
:'send '+ccrRecipient
,requested_by
:'user'},
610 if(data
=="SUCCESS") {
611 $
("#ccr_send_message").html("<?php
612 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
614 $
("#ccr_send_to").val("");
616 $
("#ccr_send_message").html(data
);
618 $
(".viewCCR_transmit").removeAttr('disabled');
623 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
624 $
(".viewCCD_send_dialog").click(
626 $
("#ccd_send_dialog").toggle();
628 $
(".viewCCD_transmit").click(
630 $
(".viewCCD_transmit").attr('disabled','disabled');
631 var ccrAction
= document
.getElementsByName('ccrAction');
632 ccrAction
[0].value
= 'viewccd';
633 var ccdRecipient
= $
("#ccd_send_to").val();
634 var raw
= document
.getElementsByName('raw');
635 raw
[0].value
= 'send '+ccdRecipient
;
636 if(ccdRecipient
=="") {
637 $
("#ccd_send_message").html("<?php
638 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
639 $
("#ccd_send_result").show();
641 $
(".viewCCD_transmit").attr('disabled','disabled');
642 $
("#ccd_send_message").html("<?php
643 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
644 $
("#ccd_send_result").show();
645 var action
=$
("#ccr_form").attr('action');
646 $
.post(action
, {ccrAction
:'viewccd',raw
:'send '+ccdRecipient
,requested_by
:'user'},
648 if(data
=="SUCCESS") {
649 $
("#ccd_send_message").html("<?php
650 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
652 $
("#ccd_send_to").val("");
654 $
("#ccd_send_message").html(data
);
656 $
(".viewCCD_transmit").removeAttr('disabled');
664 // select/deselect the Forms related to the selected Encounter
665 // (it ain't pretty code folks)
666 var SelectForms
= function (selectedEncounter
) {
667 if ($
(selectedEncounter
).attr("checked")) {
668 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
669 $
(this
).children().each(function(i
, obj
) {
670 $
(this
).attr("checked", "checked");
675 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
676 $
(this
).children().each(function(i
, obj
) {
677 $
(this
).removeAttr("checked");
683 // When an issue is checked, auto-check all the related encounters and forms
684 function issueClick(issue
) {
685 // do nothing when unchecked
686 if (! $
(issue
).attr("checked")) return;
688 $
("#report_form :checkbox").each(function(i
, obj
) {
689 if ($
(issue
).val().indexOf('/' + $
(this
).val() +
'/') >= 0) {
690 $
(this
).attr("checked", "checked");