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");
9 // get various authorization levels
10 $auth_notes_a = acl_check('encounters', 'notes_a');
11 $auth_notes = acl_check('encounters', 'notes');
12 $auth_coding_a = acl_check('encounters', 'coding_a');
13 $auth_coding = acl_check('encounters', 'coding');
14 $auth_relaxed = acl_check('encounters', 'relaxed');
15 $auth_med = acl_check('patients', 'med');
16 $auth_demo = acl_check('patients', 'demo');
19 if ($GLOBALS['gbl_portal_cms_enable']) {
20 $ptdata = getPatientData($pid, 'cmsportal_login');
21 $cmsportal = $ptdata['cmsportal_login'] !== '';
26 <?php
html_header_show();?
>
28 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
29 <style type
="text/css">@import
url(../../../library
/dynarch_calendar
.css
);</style
>
30 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
31 <script type
="text/javascript" src
="../../../library/dynarch_calendar.js"></script
>
32 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
33 <script type
="text/javascript" src
="../../../library/dynarch_calendar_setup.js"></script
>
35 <!-- include jQuery support
-->
36 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
38 <script language
='JavaScript'>
40 function checkAll(check
) {
41 var f
= document
.forms
['report_form'];
42 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
43 if (f
.elements
[i
].type
== 'checkbox') f
.elements
[i
].checked
= check
;
48 function show_date_fun(){
49 if(document
.getElementById('show_date').checked
== true){
50 document
.getElementById('date_div').style
.display
= '';
52 document
.getElementById('date_div').style
.display
= 'none';
61 <body
class="body_top">
62 <div id
="patient_reports"> <!-- large outer DIV
-->
65 <span
class='title'><?php
echo xlt('Patient Reports'); ?
></span
>
68 <?php
if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options ?>
71 <form name
='ccr_form' id
='ccr_form' method
='post' action
='../../../ccr/createCCR.php'>
72 <span
class='title'><?php
xl('Continuity of Care Record (CCR)', 'e'); ?
></span
> 
; 
;
74 <span
class='text'>(<?php
xl('Pop ups need to be enabled to see these reports', 'e'); ?
>)</span
>
77 <input type
='hidden' name
='ccrAction'>
78 <input type
='hidden' name
='raw'>
79 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
xl('Use Date Range', 'e'); ?
>
81 <div id
="date_div" style
="display:none" >
83 <table border
="0" cellpadding
="0" cellspacing
="0" >
86 <span
class='bold'><?php
xl('Start Date', 'e');?
>: </span
>
89 <input type
='text' size
='10' name
='Start' id
='Start'
90 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
91 title
='<?php xl('yyyy
-mm
-dd
', 'e
'); ?>' />
92 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
93 id
='img_start' border
='0' alt
='[?]' style
='cursor:pointer'
94 title
='<?php xl('Click here to choose a date
', 'e
'); ?>' >
95 <script LANGUAGE
="JavaScript">
96 Calendar
.setup({inputField
:"Start", ifFormat
:"%Y-%m-%d", button
:"img_start"});
101 <span
class='bold'><?php
xl('End Date', 'e');?
>: </span
>
104 <input type
='text' size
='10' name
='End' id
='End'
105 onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)'
106 title
='<?php xl('yyyy
-mm
-dd
', 'e
'); ?>' />
107 <img src
='../../pic/show_calendar.gif' align
='absbottom' width
='24' height
='22'
108 id
='img_end' border
='0' alt
='[?]' style
='cursor:pointer'
109 title
='<?php xl('Click here to choose a date
', 'e
'); ?>' >
110 <script LANGUAGE
="JavaScript">
111 Calendar
.setup({inputField
:"End", ifFormat
:"%Y-%m-%d", button
:"img_end"});
118 <input type
="button" class="generateCCR" value
="<?php echo xla('Generate Report'); ?>" />
119 <!-- <input type
="button" class="generateCCR_download_h" value
="<?php echo xl('Download')." (Hybrid
)"; ?>" /> -->
120 <input type
="button" class="generateCCR_download_p" value
="<?php echo xl('Download'); ?>" />
121 <!-- <input type
="button" class="generateCCR_raw" value
="<?php xl('Raw Report', 'e'); ?>" /> -->
122 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
123 <input type
="button" class="viewCCR_send_dialog" value
="<?php echo htmlspecialchars(xl('Transmit', ENT_QUOTES)); ?>" />
125 <div id
="ccr_send_dialog" style
="display:none" >
127 <table border
="0" cellpadding
="0" cellspacing
="0" >
130 <span
class='bold'><?php
echo htmlspecialchars(xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES
);?
>: </span
>
131 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="">
132 <input type
="hidden" name
="ccr_sent_by" id
="ccr_sent_by" value
="user">
133 <input type
="button" class="viewCCR_transmit" value
="<?php echo htmlspecialchars(xl('Send', ENT_QUOTES)); ?>" />
134 <div id
="ccr_send_result" style
="display:none" >
135 <span
class="text" id
="ccr_send_message"></span
>
143 <span
class='title'><?php
xl('Continuity of Care Document (CCD)', 'e'); ?
></span
> 
; 
;
145 <span
class='text'>(<?php
xl('Pop ups need to be enabled to see these reports', 'e'); ?
>)</span
>
148 <input type
="button" class="viewCCD" value
="<?php echo xla('Generate Report'); ?>" />
149 <input type
="button" class="viewCCD_download" value
="<?php echo htmlspecialchars(xl('Download', ENT_QUOTES)); ?>" />
150 <!-- <input type
="button" class="viewCCD_raw" value
="<?php xl('Raw Report', 'e'); ?>" /> -->
151 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
152 <input type
="button" class="viewCCD_send_dialog" value
="<?php echo htmlspecialchars(xl('Transmit', ENT_QUOTES)); ?>" />
154 <div id
="ccd_send_dialog" style
="display:none" >
156 <table border
="0" cellpadding
="0" cellspacing
="0" >
159 <span
class='bold'><?php
echo htmlspecialchars(xl('Enter Recipient\'s Direct Address'), ENT_NOQUOTES
);?
>: </span
>
160 <input type
="text" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="">
161 <input type
="hidden" name
="ccd_sent_by" id
="ccd_sent_by" value
="user">
162 <input type
="button" class="viewCCD_transmit" value
="<?php echo htmlspecialchars(xl('Send', ENT_QUOTES)); ?>" />
163 <div id
="ccd_send_result" style
="display:none" >
164 <span
class="text" id
="ccd_send_message"></span
>
177 <?php
} // end CCR/CCD reporting options ?>
179 <form name
='report_form' id
="report_form" method
='post' action
='custom_report.php'>
182 <span
class='title'><?php
xl('Patient Report', 'e'); ?
></span
> 
; 
;
185 <a
class="link_submit" href
="full_report.php" onclick
="top.restoreSession()">
186 [<?php
xl('View Comprehensive Patient Report', 'e'); ?
>]</a
>
188 <a
class="link_submit" href
="#" onclick
="return checkAll(true)"><?php
xl('Check All', 'e'); ?
></a
>
190 <a
class="link_submit" href
="#" onclick
="return checkAll(false)"><?php
xl('Clear All', 'e'); ?
></a
>
193 <table
class="includes">
196 <input type
='checkbox' name
='include_demographics' id
='include_demographics' value
="demographics" checked
><?php
xl('Demographics', 'e'); ?
><br
>
197 <?php
if (acl_check('patients', 'med')) : ?
>
198 <input type
='checkbox' name
='include_history' id
='include_history' value
="history"><?php
xl('History', 'e'); ?
><br
>
201 <input type
='checkbox' name
='include_employer' id
='include_employer' value
="employer"><?php
xl('Employer', 'e'); ?
><br
>
203 <input type
='checkbox' name
='include_insurance' id
='include_insurance' value
="insurance"><?php
xl('Insurance', 'e'); ?
><br
>
204 <input type
='checkbox' name
='include_billing' id
='include_billing' value
="billing"
205 <?php
if (!$GLOBALS['simplified_demographics']) {
207 } ?
>><?php
xl('Billing', 'e'); ?
><br
>
211 <input type
='checkbox' name
='include_allergies' id
='include_allergies' value
="allergies">Allergies
<br
>
212 <input type
='checkbox' name
='include_medications' id
='include_medications' value
="medications">Medications
<br
>
214 <input type
='checkbox' name
='include_immunizations' id
='include_immunizations' value
="immunizations"><?php
xl('Immunizations', 'e'); ?
><br
>
216 <input type
='checkbox' name
='include_medical_problems' id
='include_medical_problems' value
="medical_problems">Medical Problems
<br
>
218 <input type
='checkbox' name
='include_notes' id
='include_notes' value
="notes"><?php
xl('Patient Notes', 'e'); ?
><br
>
219 <input type
='checkbox' name
='include_transactions' id
='include_transactions' value
="transactions"><?php
xl('Transactions', 'e'); ?
><br
>
220 <input type
='checkbox' name
='include_batchcom' id
='include_batchcom' value
="batchcom"><?php
xl('Communications', 'e'); ?
><br
>
223 <input type
='checkbox' name
='include_recurring_days' id
='include_recurring_days' value
="recurring_days" ><?php
echo xlt('Recurrent Appointments'); ?
><br
>
229 <input type
="button" class="genreport" value
="<?php xl('Generate Report', 'e'); ?>" /> 
;
230 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF', 'e'); ?>" /> 
;
231 <?php
if ($cmsportal) { ?
>
232 <input type
="button" class="genportal" value
="<?php xl('Send to Portal', 'e'); ?>" />
234 <input type
='hidden' name
='pdf' value
='0'>
237 <!-- old ccr button position
-->
240 <table
class="issues_encounters_forms">
246 <span
class='bold'><?php
xl('Issues', 'e'); ?
>:</span
>
250 <?php
if (! acl_check('patients', 'med')) : ?
>
251 <br
>(Issues not authorized
)
258 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
259 "ORDER BY type, begdate");
261 while ($prow = sqlFetchArray($pres)) {
262 if ($lasttype != $prow['type']) {
263 $lasttype = $prow['type'];
266 $disptype = $lasttype;
268 case "allergy" : $disptype = "Allergies" ; break;
270 case "medical_problem": $disptype = "Medical Problems"; break;
271 case "medication" : $disptype = "Medications" ; break;
272 case "surgery" : $disptype = "Surgeries" ; break;
275 $disptype = $ISSUE_TYPES[$lasttype][0];
278 echo " <td colspan='4' class='bold'><b>$disptype</b></td>\n";
282 $rowid = $prow['id'];
283 $disptitle = trim($prow['title']) ?
$prow['title'] : "[Missing Title]";
285 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
286 "pid = '$pid' AND list_id = '$rowid'");
288 echo " <tr class='text'>\n";
289 echo " <td> </td>\n";
291 echo "<input type='checkbox' name='issue_$rowid' id='issue_$rowid' class='issuecheckbox' value='/";
292 while ($ierow = sqlFetchArray($ieres)) {
293 echo $ierow['encounter'] . "/";
296 echo "' />$disptitle</td>\n";
297 echo " <td>" . $prow['begdate'];
299 if ($prow['enddate']) {
300 echo " - " . $prow['enddate'];
311 <?php
endif; // end of Issues output ?>
313 </div
> <!-- end issues DIV
-->
316 <!-- Encounters
and Forms
-->
319 <div
class='encounters'>
320 <span
class='bold'><?php
xl('Encounters & Forms', 'e'); ?
>:</span
>
323 <?php
if (!($auth_notes_a ||
$auth_notes ||
$auth_coding_a ||
$auth_coding ||
$auth_med ||
$auth_relaxed)) : ?
>
324 (Encounters not authorized
)
330 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
331 "forms.formdir, forms.date AS fdate, form_encounter.date " .
332 ",form_encounter.reason ".
333 "FROM forms, form_encounter WHERE " .
334 "forms.pid = '$pid' AND form_encounter.pid = '$pid' AND " .
335 "form_encounter.encounter = forms.encounter " .
336 " AND forms.deleted=0 ". // --JRM--
337 "ORDER BY form_encounter.date DESC, fdate ASC");
338 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
339 $html_strings = array();
340 $registry_form_name = array();
341 while ($result2 = sqlFetchArray($res2)) {
342 array_push($registry_form_name, trim($result2['name']));
345 while ($result = sqlFetchArray($res)) {
346 if ($result{"form_name"} == "New Patient Encounter") {
348 foreach ($registry_form_name as $var) {
349 if ($toprint = $html_strings[$var]) {
350 foreach ($toprint as $var) {
356 $html_strings = array();
357 echo "</div>\n"; // end DIV encounter_forms
358 echo "</div>\n\n"; //end DIV encounter_data
363 echo "<div class='encounter_data'>\n";
364 echo "<input type=checkbox ".
365 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
366 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
367 " value='" . $result{"encounter"} . "'" .
368 " class='encounter'".
371 // show encounter reason, not just 'New Encounter'
372 // trim to a reasonable length for display purposes --cfapress
373 $maxReasonLength = 20;
374 if (strlen($result["reason"]) > $maxReasonLength) {
375 // The default encoding for this mb_substr() call is set near top of globals.php
376 $result['reason'] = mb_substr($result['reason'], 0, $maxReasonLength) . " ... ";
379 echo $result{"reason"}.
380 " (" . date("Y-m-d", strtotime($result{"date"})) .
382 echo "<div class='encounter_forms'>\n";
384 $form_name = trim($result{"form_name"});
385 //if form name is not in registry, look for the closest match by
386 // finding a registry name which is at the start of the form name.
387 //this is to allow for forms to put additional helpful information
388 //in the database in the same string as their form name after the name
389 $form_name_found_flag = 0;
390 foreach ($registry_form_name as $var) {
391 if ($var == $form_name) {
392 $form_name_found_flag = 1;
396 // if the form does not match precisely with any names in the registry, now see if any front partial matches
397 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
398 if (!$form_name_found_flag) {
399 foreach ($registry_form_name as $var) {
400 if (strpos($form_name, $var) == 0) {
406 if (!is_array($html_strings[$form_name])) {
407 $html_strings[$form_name] = array();
410 array_push($html_strings[$form_name], "<input type='checkbox' ".
411 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
412 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
413 " value='" . $result{"encounter"} . "'" .
414 " class='encounter_form' ".
415 ">" . xl_form_title($result{"form_name"}) . "<br>\n");
419 foreach ($registry_form_name as $var) {
420 if ($toprint = $html_strings[$var]) {
421 foreach ($toprint as $var) {
430 </div
> <!-- end encounters DIV
-->
434 <input type
="button" class="genreport" value
="<?php xl('Generate Report', 'e'); ?>" /> 
;
435 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF', 'e'); ?>" /> 
;
436 <?php
if ($cmsportal) { ?
>
437 <input type
="button" class="genportal" value
="<?php xl('Send to Portal', 'e'); ?>" />
440 <!-- Procedure Orders
-->
442 <table border
="0" cellpadding
="0" cellspacing
="0" >
444 <td
class='bold'><?php
echo xlt('Procedures'); ?
> 
; 
;</td
>
445 <td
class='text'><?php
echo xlt('Order Date'); ?
> 
; 
;</td
>
446 <td
class='text'><?php
echo xlt('Encounter Date'); ?
> 
; 
;</td
>
447 <td
class='text'><?php
echo xlt('Order Descriptions'); ?
></td
>
451 "SELECT po.procedure_order_id, po.date_ordered, fe.date " .
452 "FROM procedure_order AS po " .
453 "LEFT JOIN forms AS f ON f.pid = po.patient_id AND f.formdir = 'procedure_order' AND " .
454 "f.form_id = po.procedure_order_id AND f.deleted = 0 " .
455 "LEFT JOIN form_encounter AS fe ON fe.pid = f.pid AND fe.encounter = f.encounter " .
456 "WHERE po.patient_id = ? " .
457 "ORDER BY po.date_ordered DESC, po.procedure_order_id DESC",
460 while ($row = sqlFetchArray($res)) {
461 $poid = $row['procedure_order_id'];
463 echo " <td align='center' class='text'>" .
464 "<input type='checkbox' name='procedures[]' value='$poid' /> </td>\n";
465 echo " <td class='text'>" . oeFormatShortDate($row['date_ordered']) . " </td>\n";
466 echo " <td class='text'>" . oeFormatShortDate($row['date']) . " </td>\n";
467 echo " <td class='text'>";
468 $opres = sqlStatement(
469 "SELECT procedure_code, procedure_name FROM procedure_order_code " .
470 "WHERE procedure_order_id = ? ORDER BY procedure_order_seq",
473 while ($oprow = sqlFetchArray($opres)) {
474 $tmp = $oprow['procedure_name'];
476 $tmp = $oprow['procedure_code'];
479 echo text($tmp) . "<br />";
487 <input type
="button" class="genreport" value
="<?php xl('Generate Report', 'e'); ?>" /> 
;
488 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF', 'e'); ?>" />
491 <span
class="bold"><?php
xl('Documents', 'e'); ?
></span
>:<br
>
494 // show available documents
495 $db = $GLOBALS['adodb']['db'];
496 $sql = "SELECT d.id, d.url, c.name, c.aco_spec FROM documents AS d " .
497 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
498 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
499 "d.foreign_id = " . $db->qstr($pid);
500 $result = $db->Execute($sql);
501 if ($db->ErrorMsg()) {
502 echo $db->ErrorMsg();
505 while ($result && !$result->EOF
) {
506 if (empty($result->fields
['aco_spec']) ||
acl_check_aco_spec($result->fields
['aco_spec'])) {
507 echo "<li class='bold'>";
508 echo '<input type="checkbox" name="documents[]" value="' .
509 $result->fields
['id'] . '">';
510 echo ' <i>' . xl_document_category($result->fields
['name']) . "</i>";
511 echo ' ' . xl('Name') . ': <i>' . basename($result->fields
['url']) . "</i>";
521 <input type
="button" class="genreport" value
="<?php xl('Generate Report', 'e'); ?>" /> 
;
522 <input type
="button" class="genpdfrep" value
="<?php xl('Download PDF', 'e'); ?>" /> 
;
523 <?php
if ($cmsportal) { ?
>
524 <input type
="button" class="genportal" value
="<?php xl('Send to Portal', 'e'); ?>" />
527 </div
> <!-- close patient_reports DIV
-->
530 <script language
="javascript">
532 // jQuery stuff to make the page a little easier to use
533 $
(document
).ready(function(){
534 $
(".genreport").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 0; $
("#report_form").submit(); });
535 $
(".genpdfrep").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 1; $
("#report_form").submit(); });
536 $
(".genportal").click(function() { top
.restoreSession(); document
.report_form
.pdf
.value
= 2; $
("#report_form").submit(); });
537 $
("#genfullreport").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
538 //$("#printform").click(function() { PrintForm(); });
539 $
(".issuecheckbox").click(function() { issueClick(this
); });
541 // check/uncheck all Forms of an encounter
542 $
(".encounter").click(function() { SelectForms($
(this
)); });
544 $
(".generateCCR").click(
546 if(document
.getElementById('show_date').checked
== true){
547 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
548 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
552 var ccrAction
= document
.getElementsByName('ccrAction');
553 ccrAction
[0].value
= 'generate';
554 var raw
= document
.getElementsByName('raw');
556 top
.restoreSession();
557 ccr_form
.setAttribute("target", "_blank");
558 $
("#ccr_form").submit();
559 ccr_form
.setAttribute("target", "");
561 $
(".generateCCR_raw").click(
563 var ccrAction
= document
.getElementsByName('ccrAction');
564 ccrAction
[0].value
= 'generate';
565 var raw
= document
.getElementsByName('raw');
566 raw
[0].value
= 'yes';
567 top
.restoreSession();
568 ccr_form
.setAttribute("target", "_blank");
569 $
("#ccr_form").submit();
570 ccr_form
.setAttribute("target", "");
572 $
(".generateCCR_download_h").click(
574 var ccrAction
= document
.getElementsByName('ccrAction');
575 ccrAction
[0].value
= 'generate';
576 var raw
= document
.getElementsByName('raw');
577 raw
[0].value
= 'hybrid';
578 top
.restoreSession();
579 $
("#ccr_form").submit();
581 $
(".generateCCR_download_p").click(
583 if(document
.getElementById('show_date').checked
== true){
584 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
585 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
589 var ccrAction
= document
.getElementsByName('ccrAction');
590 ccrAction
[0].value
= 'generate';
591 var raw
= document
.getElementsByName('raw');
592 raw
[0].value
= 'pure';
593 top
.restoreSession();
594 $
("#ccr_form").submit();
598 var ccrAction
= document
.getElementsByName('ccrAction');
599 ccrAction
[0].value
= 'viewccd';
600 var raw
= document
.getElementsByName('raw');
602 top
.restoreSession();
603 ccr_form
.setAttribute("target", "_blank");
604 $
("#ccr_form").submit();
605 ccr_form
.setAttribute("target", "");
607 $
(".viewCCD_raw").click(
609 var ccrAction
= document
.getElementsByName('ccrAction');
610 ccrAction
[0].value
= 'viewccd';
611 var raw
= document
.getElementsByName('raw');
612 raw
[0].value
= 'yes';
613 top
.restoreSession();
614 ccr_form
.setAttribute("target", "_blank");
615 $
("#ccr_form").submit();
616 ccr_form
.setAttribute("target", "");
618 $
(".viewCCD_download").click(
620 var ccrAction
= document
.getElementsByName('ccrAction');
621 ccrAction
[0].value
= 'viewccd';
622 var raw
= document
.getElementsByName('raw');
623 raw
[0].value
= 'pure';
624 $
("#ccr_form").submit();
626 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
627 $
(".viewCCR_send_dialog").click(
629 $
("#ccr_send_dialog").toggle();
631 $
(".viewCCR_transmit").click(
633 $
(".viewCCR_transmit").attr('disabled','disabled');
634 var ccrAction
= document
.getElementsByName('ccrAction');
635 ccrAction
[0].value
= 'generate';
636 var ccrRecipient
= $
("#ccr_send_to").val();
637 var raw
= document
.getElementsByName('raw');
638 raw
[0].value
= 'send '+ccrRecipient
;
639 if(ccrRecipient
=="") {
640 $
("#ccr_send_message").html("<?php
641 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
642 $
("#ccr_send_result").show();
644 $
(".viewCCR_transmit").attr('disabled','disabled');
645 $
("#ccr_send_message").html("<?php
646 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
647 $
("#ccr_send_result").show();
648 var action
=$
("#ccr_form").attr('action');
649 $
.post(action
, {ccrAction
:'generate',raw
:'send '+ccrRecipient
,requested_by
:'user'},
651 if(data
=="SUCCESS") {
652 $
("#ccr_send_message").html("<?php
653 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
655 $
("#ccr_send_to").val("");
657 $
("#ccr_send_message").html(data
);
659 $
(".viewCCR_transmit").removeAttr('disabled');
665 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
666 $
(".viewCCD_send_dialog").click(
668 $
("#ccd_send_dialog").toggle();
670 $
(".viewCCD_transmit").click(
672 $
(".viewCCD_transmit").attr('disabled','disabled');
673 var ccrAction
= document
.getElementsByName('ccrAction');
674 ccrAction
[0].value
= 'viewccd';
675 var ccdRecipient
= $
("#ccd_send_to").val();
676 var raw
= document
.getElementsByName('raw');
677 raw
[0].value
= 'send '+ccdRecipient
;
678 if(ccdRecipient
=="") {
679 $
("#ccd_send_message").html("<?php
680 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
681 $
("#ccd_send_result").show();
683 $
(".viewCCD_transmit").attr('disabled','disabled');
684 $
("#ccd_send_message").html("<?php
685 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
686 $
("#ccd_send_result").show();
687 var action
=$
("#ccr_form").attr('action');
688 $
.post(action
, {ccrAction
:'viewccd',raw
:'send '+ccdRecipient
,requested_by
:'user'},
690 if(data
=="SUCCESS") {
691 $
("#ccd_send_message").html("<?php
692 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
694 $
("#ccd_send_to").val("");
696 $
("#ccd_send_message").html(data
);
698 $
(".viewCCD_transmit").removeAttr('disabled');
706 // select/deselect the Forms related to the selected Encounter
707 // (it ain't pretty code folks)
708 var SelectForms
= function (selectedEncounter
) {
709 if ($
(selectedEncounter
).attr("checked")) {
710 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
711 $
(this
).children().each(function(i
, obj
) {
712 $
(this
).attr("checked", "checked");
717 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
718 $
(this
).children().each(function(i
, obj
) {
719 $
(this
).removeAttr("checked");
725 // When an issue is checked, auto-check all the related encounters and forms
726 function issueClick(issue
) {
727 // do nothing when unchecked
728 if (! $
(issue
).attr("checked")) return;
730 $
("#report_form :checkbox").each(function(i
, obj
) {
731 if ($
(issue
).val().indexOf('/' + $
(this
).val() +
'/') >= 0) {
732 $
(this
).attr("checked", "checked");