4 * Copyright (C) 2016-2017 Jerry Padgett <sjpadgett@gmail.com>
6 * LICENSE: This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * @author Jerry Padgett <sjpadgett@gmail.com>
21 * @link http://www.open-emr.org
26 //landing page definition -- where to go if something goes wrong
27 $landingpage = "../index.php?site=".$_SESSION['site_id'];
30 // kick out if patient not authenticated
31 if (isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite_two'])) {
32 $pid = $_SESSION['pid'];
33 $user = $_SESSION['sessionUser'];
36 header('Location: '.$landingpage.'&w');
43 require_once('../../interface/globals.php');
44 require_once("$srcdir/lists.inc");
45 require_once("$srcdir/acl.inc");
46 require_once("$srcdir/forms.inc");
47 require_once("$srcdir/patient.inc");
48 require_once("$srcdir/formatting.inc.php");
50 // get various authorization levels
51 $auth_notes_a = true; //acl_check('encounters', 'notes_a');
52 $auth_notes = true; //acl_check('encounters', 'notes');
53 $auth_coding_a = true; //acl_check('encounters', 'coding_a');
54 $auth_coding = true; //acl_check('encounters', 'coding');
55 $auth_relaxed = true; //acl_check('encounters', 'relaxed');
56 $auth_med = true; //acl_check('patients' , 'med');
57 $auth_demo = true; //acl_check('patients' , 'demo');
60 if ($GLOBALS['gbl_portal_cms_enable']) {
61 $ptdata = getPatientData($pid, 'cmsportal_login');
62 $cmsportal = $ptdata['cmsportal_login'] !== '';
68 <script type
="text/javascript" src
="../library/textformat.js?v=<?php echo $v_js_includes; ?>"></script
>
71 input
[type
="checkbox"], input
[type
="radio"] {
75 /*=============================================================
77 * seen in the patient reports screens
78 *============================================================*/
82 #patient_reports .issues {
85 #patient_reports .issues table {
86 margin
: 10px
0px
10px
0px
;
88 #patient_reports .issues td {
91 #patient_reports .encounters td {
94 #patient_reports .encounter_forms {
95 margin
: 5px
15px
5px
15px
;
100 #patient_reports ul {
104 /*=============================================================
106 * seen as the patient report (portal_custom_report.php)
107 *============================================================*/
112 border
: 2px dotted black
;
114 #report_custom .billing {
120 margin
: 0px
0px
5px
0px
;
123 #report_custom .immunizations {
127 #report_custom .notes {
131 #report_custom .transactions {
135 #report_custom .communications {
139 #report_custom .documents {
143 #report_custom .demographics {
147 #report_custom .insurance {
151 #report_custom .history {
155 #report_custom .issue {
158 #report_custom .issue_type {
160 padding
: 5px
0px
5px
0px
;
162 #report_custom .issue_diag {
163 margin
: 0px
20px
0px
20px
;
165 #report_custom .encounter {
167 border
-top
: 2px dotted black
;
168 padding
: 10px
5px
10px
5px
;
171 #report_custom .encounter h1 {
176 #report_custom .encounter_form {
179 border
-top
: 1px solid gray
;
182 #addressbook_list tr.evenrow {
183 background
-color
: #ddddff;
186 #addressbook_list tr.oddrow {
187 background
-color
: #ffffff;
191 background
-color
: #ffffff !important;
198 function checkAll(check
) {
199 var f
= document
.forms
['report_form'];
200 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
201 if (f
.elements
[i
].type
== 'checkbox') f
.elements
[i
].checked
= check
;
206 function show_date_fun(){
207 if(document
.getElementById('show_date').checked
== true){
208 document
.getElementById('date_div').style
.display
= '';
210 document
.getElementById('date_div').style
.display
= 'none';
214 var mypcc
= '<?php echo $GLOBALS['phone_country_code
']; ?>';
217 <body
class="body_top">
218 <div id
="patient_reports"> <!-- large outer DIV
-->
220 <?php
if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options ?>
221 <div id
="ccr_report">
223 <form name
='ccr_form' id
='ccr_form' method
='post' action
="../ccr/createCCR.php?portal_auth_two=1">
224 <span
class='title'><?php
echo xlt('Continuity of Care Record (CCR)'); ?
></span
> 
; 
;
226 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
229 <input type
='hidden' name
='ccrAction'>
230 <input type
='hidden' name
='raw'>
231 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
echo xlt('Use Date Range'); ?
></span
>
233 <div id
="date_div" style
="display:none" >
235 <table border
="0" cellpadding
="0" cellspacing
="0" >
238 <span
class='bold'><?php
echo xlt('Start Date');?
>: </span
>
241 <input type
='text' size
='10' name
='Start' id
='Start'
243 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
247 <span
class='bold'><?php
echo xlt('End Date');?
>: </span
>
250 <input type
='text' size
='10' name
='End' id
='End'
252 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
259 <!-- <button data
-target
="#reportdialog" data
-toggle
="modal" class="btn btn-default">
260 <?php
//echo xla('Generate Report'); ?></button> -->
261 <input type
="button" class="generateCCR" value
="<?php echo xla('Generate Report'); ?>" />
262 <!-- <input type
="button" class="generateCCR_download_h" value
="<?php echo xl('Download')." (Hybrid
)"; ?>" /> -->
263 <input type
="button" class="generateCCR_download_p" value
="<?php echo xlt('Download'); ?>" />
264 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
265 <input type
="button" class="viewCCR_send_dialog" value
="<?php echo xlt('Transmit'); ?>" />
267 <div id
="ccr_send_dialog" style
="display:none" >
269 <table border
="0" cellpadding
="0" cellspacing
="0" >
272 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
273 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="">
274 <input type
="hidden" name
="ccr_sent_by" id
="ccr_sent_by" value
="user">
275 <input type
="button" class="viewCCR_transmit" value
="<?php echo xlt('Send'); ?>" />
276 <div id
="ccr_send_result" style
="display:none" >
277 <span
class="text" id
="ccr_send_message"></span
>
285 <span
class='title'><?php
echo xlt('Continuity of Care Document (CCD)'); ?
></span
> 
; 
;
287 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
290 <input type
="button" class="viewCCD" value
="<?php echo xla('Generate Report'); ?>" />
291 <input type
="button" class="viewCCD_download" value
="<?php echo xlt('Download'); ?>" />
292 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
293 <input type
="button" class="viewCCD_send_dialog" value
="<?php echo xlt('Transmit'); ?>" />
295 <div id
="ccd_send_dialog" style
="display:none" >
297 <table border
="0" cellpadding
="0" cellspacing
="0" >
300 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
301 <input type
="text" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="">
302 <input type
="hidden" name
="ccd_sent_by" id
="ccd_sent_by" value
="user">
303 <input type
="button" class="viewCCD_transmit" value
="<?php echo xlt('Send'); ?>" />
304 <div id
="ccd_send_result" style
="display:none" >
305 <span
class="text" id
="ccd_send_message"></span
>
318 <?php
} // end CCR/CCD reporting options ?>
320 <form name
='report_form' id
="report_form" method
='post' action
='./report/portal_custom_report.php'>
322 <span
class='panel-heading'><?php
echo xlt('Patient Report'); ?
></span
> 
; 
;
323 <a
class="link_submit" href
="#" onclick
="return checkAll(true)"><?php
echo xlt('Check All'); ?
></a
>
325 <a
class="link_submit" href
="#" onclick
="return checkAll(false)"><?php
echo xlt('Clear All'); ?
></a
>
328 <table
class="table includes">
331 <input type
='checkbox' name
='include_demographics' id
='include_demographics' value
="demographics" checked
><?php
echo xlt('Demographics'); ?
><br
>
332 <input type
='checkbox' name
='include_history' id
='include_history' value
="history"><?php
echo xlt('History'); ?
><br
>
333 <input type
='checkbox' name
='include_insurance' id
='include_insurance' value
="insurance"><?php
echo xlt('Insurance'); ?
><br
>
334 <input type
='checkbox' name
='include_billing' id
='include_billing' value
="billing"
335 <?php
if (!$GLOBALS['simplified_demographics']) {
337 } ?
>><?php
echo xlt('Billing'); ?
><br
>
341 <input type
='checkbox' name
='include_allergies' id
='include_allergies' value
="allergies">Allergies
<br
>
342 <input type
='checkbox' name
='include_medications' id
='include_medications' value
="medications">Medications
<br
>
344 <input type
='checkbox' name
='include_immunizations' id
='include_immunizations' value
="immunizations"><?php
echo xlt('Immunizations'); ?
><br
>
346 <input type
='checkbox' name
='include_medical_problems' id
='include_medical_problems' value
="medical_problems">Medical Problems
<br
>
348 <input type
='checkbox' name
='include_notes' id
='include_notes' value
="notes"><?php
echo xlt('Patient Notes'); ?
><br
>
349 <input type
='checkbox' name
='include_transactions' id
='include_transactions' value
="transactions"><?php
echo xlt('Transactions'); ?
><br
>
350 <input type
='checkbox' name
='include_batchcom' id
='include_batchcom' value
="batchcom"><?php
echo xlt('Communications'); ?
><br
>
355 <input type
='hidden' name
='pdf' value
='0'>
358 <!-- old ccr button position
-->
360 <table
class="issues_encounters_forms table">
366 <span
class='bold'><?php
echo xlt('Issues'); ?
>:</span
>
374 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
375 "ORDER BY type, begdate");
377 while ($prow = sqlFetchArray($pres)) {
378 if ($lasttype != $prow['type']) {
379 $lasttype = $prow['type'];
382 $disptype = $lasttype;
384 case "allergy" : $disptype = "Allergies" ; break;
386 case "medical_problem": $disptype = "Medical Problems"; break;
387 case "medication" : $disptype = "Medications" ; break;
388 case "surgery" : $disptype = "Surgeries" ; break;
391 $disptype = $ISSUE_TYPES[$lasttype][0];
394 echo " <td colspan='4' class='bold'><b>$disptype</b></td>\n";
398 $rowid = $prow['id'];
399 $disptitle = trim($prow['title']) ?
$prow['title'] : "[Missing Title]";
401 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
402 "pid = '$pid' AND list_id = '$rowid'");
404 echo " <tr class='text'>\n";
405 echo " <td> </td>\n";
407 echo "<input type='checkbox' name='issue_$rowid' id='issue_$rowid' class='issuecheckbox' value='/";
408 while ($ierow = sqlFetchArray($ieres)) {
409 echo $ierow['encounter'] . "/";
412 echo "' />$disptitle</td>\n";
413 echo " <td>" . $prow['begdate'];
415 if ($prow['enddate']) {
416 echo " - " . $prow['enddate'];
427 <?php
//endif; // end of Issues output ?>
429 </div
> <!-- end issues DIV
-->
432 <!-- Encounters
and Forms
-->
435 <div
class='encounters'>
436 <span
class='bold'><?php
echo xlt('Encounters & Forms'); ?
>:</span
>
439 <?php
if (!($auth_notes_a ||
$auth_notes ||
$auth_coding_a ||
$auth_coding ||
$auth_med ||
$auth_relaxed)) : ?
>
440 (Encounters not authorized
)
446 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
447 "forms.formdir, forms.date AS fdate, form_encounter.date " .
448 ",form_encounter.reason ".
449 "FROM forms, form_encounter WHERE " .
450 "forms.pid = '$pid' AND form_encounter.pid = '$pid' AND " .
451 "form_encounter.encounter = forms.encounter " .
452 " AND forms.deleted=0 ". // --JRM--
453 "ORDER BY form_encounter.date DESC, fdate ASC");
454 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
455 $html_strings = array();
456 $registry_form_name = array();
457 while ($result2 = sqlFetchArray($res2)) {
458 array_push($registry_form_name, trim($result2['name']));
461 while ($result = sqlFetchArray($res)) {
462 if ($result{"form_name"} == "New Patient Encounter") {
464 foreach ($registry_form_name as $var) {
465 if ($toprint = $html_strings[$var]) {
466 foreach ($toprint as $var) {
472 $html_strings = array();
473 echo "</div>\n"; // end DIV encounter_forms
474 echo "</div>\n\n"; //end DIV encounter_data
479 echo "<div class='encounter_data'>\n";
480 echo "<input type=checkbox ".
481 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
482 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
483 " value='" . $result{"encounter"} . "'" .
484 " class='encounter'".
487 // show encounter reason, not just 'New Encounter'
488 // trim to a reasonable length for display purposes --cfapress
489 $maxReasonLength = 20;
490 if (strlen($result["reason"]) > $maxReasonLength) {
491 $result['reason'] = substr($result['reason'], 0, $maxReasonLength) . " ... ";
494 echo $result{"reason"}.
495 " (" . date("Y-m-d", strtotime($result{"date"})) .
497 echo "<div class='encounter_forms'>\n";
499 $form_name = trim($result{"form_name"});
500 //if form name is not in registry, look for the closest match by
501 // finding a registry name which is at the start of the form name.
502 //this is to allow for forms to put additional helpful information
503 //in the database in the same string as their form name after the name
504 $form_name_found_flag = 0;
505 foreach ($registry_form_name as $var) {
506 if ($var == $form_name) {
507 $form_name_found_flag = 1;
511 // if the form does not match precisely with any names in the registry, now see if any front partial matches
512 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
513 if (!$form_name_found_flag) {
514 foreach ($registry_form_name as $var) {
515 if (strpos($form_name, $var) == 0) {
521 if (!is_array($html_strings[$form_name])) {
522 $html_strings[$form_name] = array();
525 array_push($html_strings[$form_name], "<input type='checkbox' ".
526 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
527 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
528 " value='" . $result{"encounter"} . "'" .
529 " class='encounter_form' ".
530 ">" . xl_form_title($result{"form_name"}) . "<br>\n");
534 foreach ($registry_form_name as $var) {
535 if ($toprint = $html_strings[$var]) {
536 foreach ($toprint as $var) {
545 </div
> <!-- end encounters DIV
-->
550 <!-- Procedure Orders
-->
552 <table border
="0" cellpadding
="0" cellspacing
="0" >
554 <td
class='bold'><?php
echo xlt('Procedures'); ?
> 
; 
;</td
>
555 <td
class='text'><?php
echo xlt('Order Date'); ?
> 
; 
;</td
>
556 <td
class='text'><?php
echo xlt('Encounter Date'); ?
> 
; 
;</td
>
557 <td
class='text'><?php
echo xlt('Order Descriptions'); ?
></td
>
561 "SELECT po.procedure_order_id, po.date_ordered, fe.date " .
562 "FROM procedure_order AS po " .
563 "LEFT JOIN forms AS f ON f.pid = po.patient_id AND f.formdir = 'procedure_order' AND " .
564 "f.form_id = po.procedure_order_id AND f.deleted = 0 " .
565 "LEFT JOIN form_encounter AS fe ON fe.pid = f.pid AND fe.encounter = f.encounter " .
566 "WHERE po.patient_id = ? " .
567 "ORDER BY po.date_ordered DESC, po.procedure_order_id DESC",
570 while ($row = sqlFetchArray($res)) {
571 $poid = $row['procedure_order_id'];
573 echo " <td align='center' class='text'>" .
574 "<input type='checkbox' name='procedures[]' value='$poid' /> </td>\n";
575 echo " <td class='text'>" . text(oeFormatShortDate($row['date_ordered'])) . " </td>\n";
576 echo " <td class='text'>" . text(oeFormatShortDate($row['date'])) . " </td>\n";
577 echo " <td class='text'>";
578 $opres = sqlStatement(
579 "SELECT procedure_code, procedure_name FROM procedure_order_code " .
580 "WHERE procedure_order_id = ? ORDER BY procedure_order_seq",
583 while ($oprow = sqlFetchArray($opres)) {
584 $tmp = $oprow['procedure_name'];
586 $tmp = $oprow['procedure_code'];
589 echo text($tmp) . "<br />";
599 <span
class="bold"><?php
echo xlt('Documents'); ?
></span
>:<br
>
602 // show available documents
603 $db = $GLOBALS['adodb']['db'];
604 $sql = "SELECT d.id, d.url, c.name FROM documents AS d " .
605 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
606 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
607 "d.foreign_id = " . $db->qstr($pid);
608 $result = $db->Execute($sql);
609 if ($db->ErrorMsg()) {
610 echo $db->ErrorMsg();
613 while ($result && !$result->EOF
) {
614 echo "<li class='bold'>";
615 echo '<input type="checkbox" name="documents[]" value="' .
616 $result->fields
['id'] . '">';
617 echo ' <i>' . xl_document_category($result->fields
['name']) . "</i>";
618 echo ' ' . xl('Name') . ': <i>' . basename($result->fields
['url']) . "</i>";
626 <input type
="button" class="genreport" value
="<?php echo xlt('Generate Report'); ?>" /> 
;
627 <input type
="button" class="genpdfrep" value
="<?php echo xlt('Download PDF'); ?>" /> 
;
628 <?php
if ($cmsportal) { ?
>
629 <input type
="button" class="genportal" value
="<?php echo xlt('Send to Portal'); ?>" />
632 </div
> <!-- close patient_reports DIV
-->
636 // jQuery stuff to make the page a little easier to use
637 initReport
= function(){
638 $
(".genreport").click(function() {
639 document
.report_form
.pdf
.value
= 0;
641 /*$("#report_form").submit();*/
643 $
(".genpdfrep").click(function() { document
.report_form
.pdf
.value
= 1; $
("#report_form").submit(); });
644 $
(".genportal").click(function() { document
.report_form
.pdf
.value
= 2; $
("#report_form").submit(); });
645 $
("#genfullreport").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
646 //$("#printform").click(function() { PrintForm(); });
647 $
(".issuecheckbox").click(function() { issueClick(this
); });
649 // check/uncheck all Forms of an encounter
650 $
(".encounter").click(function() { SelectForms($
(this
)); });
652 var title
= 'CCR Report';
655 { text
: 'Close', close
: true, style
: 'danger' },
656 { text
: 'Print', close
: false, style
: 'success', click
: showCCR
}
659 size
: eModal
.size
.lg
,
662 url
: '../ccr/createCCR.php',
663 data
:{'portal_auth_two':'1','ccrAction':'generate','raw':'yes'}
668 .then(function () { });
670 function showCustom(){
671 var formval
= $
( "#report_form" ).serializeArray();
672 var title
= 'Custom Reports';
675 { text
: 'Close', close
: true, style
: 'danger' },
676 //{ text: 'Print', close: false, style: 'success', click: showCustom }
679 size
: eModal
.size
.lg
,
682 url
: './report/portal_custom_report.php',
688 .then(function () { });
690 $
(".generateCCR").click(
692 if(document
.getElementById('show_date').checked
== true){
693 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
694 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
698 var ccrAction
= document
.getElementsByName('ccrAction');
699 ccrAction
[0].value
= 'generate';
700 var raw
= document
.getElementsByName('raw');
703 ccr_form
.setAttribute("target", "_blank");
704 $
("#ccr_form").submit();
707 ccr_form
.setAttribute("target", "");
709 $
(".generateCCR_raw").click(
711 var ccrAction
= document
.getElementsByName('ccrAction');
712 ccrAction
[0].value
= 'generate';
713 var raw
= document
.getElementsByName('raw');
714 raw
[0].value
= 'yes';
716 ccr_form
.setAttribute("target", "_blank");
717 $
("#ccr_form").submit();
718 ccr_form
.setAttribute("target", "");
720 $
(".generateCCR_download_h").click(
722 var ccrAction
= document
.getElementsByName('ccrAction');
723 ccrAction
[0].value
= 'generate';
724 var raw
= document
.getElementsByName('raw');
725 raw
[0].value
= 'hybrid';
727 $
("#ccr_form").submit();
729 $
(".generateCCR_download_p").click(
731 if(document
.getElementById('show_date').checked
== true){
732 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
733 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
737 var ccrAction
= document
.getElementsByName('ccrAction');
738 ccrAction
[0].value
= 'generate';
739 var raw
= document
.getElementsByName('raw');
740 raw
[0].value
= 'pure';
742 $
("#ccr_form").submit();
746 var ccrAction
= document
.getElementsByName('ccrAction');
747 ccrAction
[0].value
= 'viewccd';
748 var raw
= document
.getElementsByName('raw');
751 ccr_form
.setAttribute("target", "_blank");
752 $
("#ccr_form").submit();
753 ccr_form
.setAttribute("target", "");
755 $
(".viewCCD_raw").click(
757 var ccrAction
= document
.getElementsByName('ccrAction');
758 ccrAction
[0].value
= 'viewccd';
759 var raw
= document
.getElementsByName('raw');
760 raw
[0].value
= 'yes';
762 ccr_form
.setAttribute("target", "_blank");
763 $
("#ccr_form").submit();
764 ccr_form
.setAttribute("target", "");
766 $
(".viewCCD_download").click(
768 var ccrAction
= document
.getElementsByName('ccrAction');
769 ccrAction
[0].value
= 'viewccd';
770 var raw
= document
.getElementsByName('raw');
771 raw
[0].value
= 'pure';
772 $
("#ccr_form").submit();
774 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
775 $
(".viewCCR_send_dialog").click(
777 $
("#ccr_send_dialog").toggle();
779 $
(".viewCCR_transmit").click(
781 $
(".viewCCR_transmit").attr('disabled','disabled');
782 var ccrAction
= document
.getElementsByName('ccrAction');
783 ccrAction
[0].value
= 'generate';
784 var ccrRecipient
= $
("#ccr_send_to").val();
785 var raw
= document
.getElementsByName('raw');
786 raw
[0].value
= 'send '+ccrRecipient
;
787 if(ccrRecipient
=="") {
788 $
("#ccr_send_message").html("<?php
789 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
790 $
("#ccr_send_result").show();
792 $
(".viewCCR_transmit").attr('disabled','disabled');
793 $
("#ccr_send_message").html("<?php
794 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
795 $
("#ccr_send_result").show();
796 var action
=$
("#ccr_form").attr('action');
797 $
.post(action
, {ccrAction
:'generate',raw
:'send '+ccrRecipient
,requested_by
:'user'},
799 if(data
=="SUCCESS") {
800 $
("#ccr_send_message").html("<?php
801 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
803 $
("#ccr_send_to").val("");
805 $
("#ccr_send_message").html(data
);
807 $
(".viewCCR_transmit").removeAttr('disabled');
813 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
814 $
(".viewCCD_send_dialog").click(
816 $
("#ccd_send_dialog").toggle();
818 $
(".viewCCD_transmit").click(
820 $
(".viewCCD_transmit").attr('disabled','disabled');
821 var ccrAction
= document
.getElementsByName('ccrAction');
822 ccrAction
[0].value
= 'viewccd';
823 var ccdRecipient
= $
("#ccd_send_to").val();
824 var raw
= document
.getElementsByName('raw');
825 raw
[0].value
= 'send '+ccdRecipient
;
826 if(ccdRecipient
=="") {
827 $
("#ccd_send_message").html("<?php
828 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
829 $
("#ccd_send_result").show();
831 $
(".viewCCD_transmit").attr('disabled','disabled');
832 $
("#ccd_send_message").html("<?php
833 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
834 $
("#ccd_send_result").show();
835 var action
=$
("#ccr_form").attr('action');
836 $
.post(action
, {ccrAction
:'viewccd',raw
:'send '+ccdRecipient
,requested_by
:'user'},
838 if(data
=="SUCCESS") {
839 $
("#ccd_send_message").html("<?php
840 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
842 $
("#ccd_send_to").val("");
844 $
("#ccd_send_message").html(data
);
846 $
(".viewCCD_transmit").removeAttr('disabled');
854 $
( document
).ready(function(){
857 $
('.datepicker').datetimepicker({
858 <?php
$datetimepicker_timepicker = false; ?
>
859 <?php
$datetimepicker_formatInput = false; ?
>
860 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
861 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
865 // select/deselect the Forms related to the selected Encounter
866 // (it ain't pretty code folks)
867 var SelectForms
= function (selectedEncounter
) {
868 if ($
(selectedEncounter
).attr("checked")) {
869 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
870 $
(this
).children().each(function(i
, obj
) {
871 $
(this
).attr("checked", "checked");
876 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
877 $
(this
).children().each(function(i
, obj
) {
878 $
(this
).removeAttr("checked");
884 // When an issue is checked, auto-check all the related encounters and forms
885 function issueClick(issue
) {
886 // do nothing when unchecked
887 if (! $
(issue
).attr("checked")) return;
889 $
("#report_form :checkbox").each(function(i
, obj
) {
890 if ($
(issue
).val().indexOf('/' + $
(this
).val() +
'/') >= 0) {
891 $
(this
).attr("checked", "checked");