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
>
69 <script src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js" type
="text/javascript"></script
>
70 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script
>
72 <link rel
="stylesheet" href
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
75 input
[type
="checkbox"], input
[type
="radio"] {
79 /*=============================================================
81 * seen in the patient reports screens
82 *============================================================*/
86 #patient_reports .issues {
89 #patient_reports .issues table {
90 margin
: 10px
0px
10px
0px
;
92 #patient_reports .issues td {
95 #patient_reports .encounters td {
98 #patient_reports .encounter_forms {
99 margin
: 5px
15px
5px
15px
;
101 #patient_reports td {
104 #patient_reports ul {
108 /*=============================================================
110 * seen as the patient report (portal_custom_report.php)
111 *============================================================*/
116 border
: 2px dotted black
;
118 #report_custom .billing {
124 margin
: 0px
0px
5px
0px
;
127 #report_custom .immunizations {
131 #report_custom .notes {
135 #report_custom .transactions {
139 #report_custom .communications {
143 #report_custom .documents {
147 #report_custom .demographics {
151 #report_custom .insurance {
155 #report_custom .history {
159 #report_custom .issue {
162 #report_custom .issue_type {
164 padding
: 5px
0px
5px
0px
;
166 #report_custom .issue_diag {
167 margin
: 0px
20px
0px
20px
;
169 #report_custom .encounter {
171 border
-top
: 2px dotted black
;
172 padding
: 10px
5px
10px
5px
;
175 #report_custom .encounter h1 {
180 #report_custom .encounter_form {
183 border
-top
: 1px solid gray
;
186 #addressbook_list tr.evenrow {
187 background
-color
: #ddddff;
190 #addressbook_list tr.oddrow {
191 background
-color
: #ffffff;
195 background
-color
: #ffffff !important;
202 function checkAll(check
) {
203 var f
= document
.forms
['report_form'];
204 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
205 if (f
.elements
[i
].type
== 'checkbox') f
.elements
[i
].checked
= check
;
210 function show_date_fun(){
211 if(document
.getElementById('show_date').checked
== true){
212 document
.getElementById('date_div').style
.display
= '';
214 document
.getElementById('date_div').style
.display
= 'none';
218 var mypcc
= '<?php echo $GLOBALS['phone_country_code
']; ?>';
221 <body
class="body_top">
222 <div id
="patient_reports"> <!-- large outer DIV
-->
224 <?php
if ($GLOBALS['activate_ccr_ccd_report']) { // show CCR/CCD reporting options ?>
225 <div id
="ccr_report">
227 <form name
='ccr_form' id
='ccr_form' method
='post' action
="../ccr/createCCR.php?portal_auth_two=1">
228 <span
class='title'><?php
echo xlt('Continuity of Care Record (CCR)'); ?
></span
> 
; 
;
230 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
233 <input type
='hidden' name
='ccrAction'>
234 <input type
='hidden' name
='raw'>
235 <input type
="checkbox" name
="show_date" id
="show_date" onchange
="show_date_fun();" ><span
class='text'><?php
echo xlt('Use Date Range'); ?
></span
>
237 <div id
="date_div" style
="display:none" >
239 <table border
="0" cellpadding
="0" cellspacing
="0" >
242 <span
class='bold'><?php
echo xlt('Start Date');?
>: </span
>
245 <input type
='text' size
='10' name
='Start' id
='Start'
247 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
251 <span
class='bold'><?php
echo xlt('End Date');?
>: </span
>
254 <input type
='text' size
='10' name
='End' id
='End'
256 title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />
263 <!-- <button data
-target
="#reportdialog" data
-toggle
="modal" class="btn btn-default">
264 <?php
//echo xla('Generate Report'); ?></button> -->
265 <input type
="button" class="generateCCR" value
="<?php echo xla('Generate Report'); ?>" />
266 <!-- <input type
="button" class="generateCCR_download_h" value
="<?php echo xl('Download')." (Hybrid
)"; ?>" /> -->
267 <input type
="button" class="generateCCR_download_p" value
="<?php echo xlt('Download'); ?>" />
268 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
269 <input type
="button" class="viewCCR_send_dialog" value
="<?php echo xlt('Transmit'); ?>" />
271 <div id
="ccr_send_dialog" style
="display:none" >
273 <table border
="0" cellpadding
="0" cellspacing
="0" >
276 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
277 <input type
="text" size
="64" name
="ccr_send_to" id
="ccr_send_to" value
="">
278 <input type
="hidden" name
="ccr_sent_by" id
="ccr_sent_by" value
="user">
279 <input type
="button" class="viewCCR_transmit" value
="<?php echo xlt('Send'); ?>" />
280 <div id
="ccr_send_result" style
="display:none" >
281 <span
class="text" id
="ccr_send_message"></span
>
289 <span
class='title'><?php
echo xlt('Continuity of Care Document (CCD)'); ?
></span
> 
; 
;
291 <span
class='text'>(<?php
echo xlt('Pop ups need to be enabled to see these reports'); ?
>)</span
>
294 <input type
="button" class="viewCCD" value
="<?php echo xla('Generate Report'); ?>" />
295 <input type
="button" class="viewCCD_download" value
="<?php echo xlt('Download'); ?>" />
296 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
297 <input type
="button" class="viewCCD_send_dialog" value
="<?php echo xlt('Transmit'); ?>" />
299 <div id
="ccd_send_dialog" style
="display:none" >
301 <table border
="0" cellpadding
="0" cellspacing
="0" >
304 <span
class='bold'><?php
echo xlt('Enter Recipient\'s Direct Address');?
>: </span
>
305 <input type
="text" size
="64" name
="ccd_send_to" id
="ccd_send_to" value
="">
306 <input type
="hidden" name
="ccd_sent_by" id
="ccd_sent_by" value
="user">
307 <input type
="button" class="viewCCD_transmit" value
="<?php echo xlt('Send'); ?>" />
308 <div id
="ccd_send_result" style
="display:none" >
309 <span
class="text" id
="ccd_send_message"></span
>
322 <?php
} // end CCR/CCD reporting options ?>
324 <form name
='report_form' id
="report_form" method
='post' action
='./report/portal_custom_report.php'>
326 <span
class='panel-heading'><?php
echo xlt('Patient Report'); ?
></span
> 
; 
;
327 <a
class="link_submit" href
="#" onclick
="return checkAll(true)"><?php
echo xlt('Check All'); ?
></a
>
329 <a
class="link_submit" href
="#" onclick
="return checkAll(false)"><?php
echo xlt('Clear All'); ?
></a
>
332 <table
class="table includes">
335 <input type
='checkbox' name
='include_demographics' id
='include_demographics' value
="demographics" checked
><?php
echo xlt('Demographics'); ?
><br
>
336 <input type
='checkbox' name
='include_history' id
='include_history' value
="history"><?php
echo xlt('History'); ?
><br
>
337 <input type
='checkbox' name
='include_insurance' id
='include_insurance' value
="insurance"><?php
echo xlt('Insurance'); ?
><br
>
338 <input type
='checkbox' name
='include_billing' id
='include_billing' value
="billing"
339 <?php
if (!$GLOBALS['simplified_demographics']) {
341 } ?
>><?php
echo xlt('Billing'); ?
><br
>
345 <input type
='checkbox' name
='include_allergies' id
='include_allergies' value
="allergies">Allergies
<br
>
346 <input type
='checkbox' name
='include_medications' id
='include_medications' value
="medications">Medications
<br
>
348 <input type
='checkbox' name
='include_immunizations' id
='include_immunizations' value
="immunizations"><?php
echo xlt('Immunizations'); ?
><br
>
350 <input type
='checkbox' name
='include_medical_problems' id
='include_medical_problems' value
="medical_problems">Medical Problems
<br
>
352 <input type
='checkbox' name
='include_notes' id
='include_notes' value
="notes"><?php
echo xlt('Patient Notes'); ?
><br
>
353 <input type
='checkbox' name
='include_transactions' id
='include_transactions' value
="transactions"><?php
echo xlt('Transactions'); ?
><br
>
354 <input type
='checkbox' name
='include_batchcom' id
='include_batchcom' value
="batchcom"><?php
echo xlt('Communications'); ?
><br
>
359 <input type
='hidden' name
='pdf' value
='0'>
362 <!-- old ccr button position
-->
364 <table
class="issues_encounters_forms table">
370 <span
class='bold'><?php
echo xlt('Issues'); ?
>:</span
>
378 $pres = sqlStatement("SELECT * FROM lists WHERE pid = $pid " .
379 "ORDER BY type, begdate");
381 while ($prow = sqlFetchArray($pres)) {
382 if ($lasttype != $prow['type']) {
383 $lasttype = $prow['type'];
386 $disptype = $lasttype;
388 case "allergy" : $disptype = "Allergies" ; break;
390 case "medical_problem": $disptype = "Medical Problems"; break;
391 case "medication" : $disptype = "Medications" ; break;
392 case "surgery" : $disptype = "Surgeries" ; break;
395 $disptype = $ISSUE_TYPES[$lasttype][0];
398 echo " <td colspan='4' class='bold'><b>$disptype</b></td>\n";
402 $rowid = $prow['id'];
403 $disptitle = trim($prow['title']) ?
$prow['title'] : "[Missing Title]";
405 $ieres = sqlStatement("SELECT encounter FROM issue_encounter WHERE " .
406 "pid = '$pid' AND list_id = '$rowid'");
408 echo " <tr class='text'>\n";
409 echo " <td> </td>\n";
411 echo "<input type='checkbox' name='issue_$rowid' id='issue_$rowid' class='issuecheckbox' value='/";
412 while ($ierow = sqlFetchArray($ieres)) {
413 echo $ierow['encounter'] . "/";
416 echo "' />$disptitle</td>\n";
417 echo " <td>" . $prow['begdate'];
419 if ($prow['enddate']) {
420 echo " - " . $prow['enddate'];
431 <?php
//endif; // end of Issues output ?>
433 </div
> <!-- end issues DIV
-->
436 <!-- Encounters
and Forms
-->
439 <div
class='encounters'>
440 <span
class='bold'><?php
echo xlt('Encounters & Forms'); ?
>:</span
>
443 <?php
if (!($auth_notes_a ||
$auth_notes ||
$auth_coding_a ||
$auth_coding ||
$auth_med ||
$auth_relaxed)) : ?
>
444 (Encounters not authorized
)
450 $res = sqlStatement("SELECT forms.encounter, forms.form_id, forms.form_name, " .
451 "forms.formdir, forms.date AS fdate, form_encounter.date " .
452 ",form_encounter.reason ".
453 "FROM forms, form_encounter WHERE " .
454 "forms.pid = '$pid' AND form_encounter.pid = '$pid' AND " .
455 "form_encounter.encounter = forms.encounter " .
456 " AND forms.deleted=0 ". // --JRM--
457 "ORDER BY form_encounter.date DESC, fdate ASC");
458 $res2 = sqlStatement("SELECT name FROM registry ORDER BY priority");
459 $html_strings = array();
460 $registry_form_name = array();
461 while ($result2 = sqlFetchArray($res2)) {
462 array_push($registry_form_name, trim($result2['name']));
465 while ($result = sqlFetchArray($res)) {
466 if ($result{"form_name"} == "New Patient Encounter") {
468 foreach ($registry_form_name as $var) {
469 if ($toprint = $html_strings[$var]) {
470 foreach ($toprint as $var) {
476 $html_strings = array();
477 echo "</div>\n"; // end DIV encounter_forms
478 echo "</div>\n\n"; //end DIV encounter_data
483 echo "<div class='encounter_data'>\n";
484 echo "<input type=checkbox ".
485 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
486 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
487 " value='" . $result{"encounter"} . "'" .
488 " class='encounter'".
491 // show encounter reason, not just 'New Encounter'
492 // trim to a reasonable length for display purposes --cfapress
493 $maxReasonLength = 20;
494 if (strlen($result["reason"]) > $maxReasonLength) {
495 $result['reason'] = substr($result['reason'], 0, $maxReasonLength) . " ... ";
498 echo $result{"reason"}.
499 " (" . date("Y-m-d", strtotime($result{"date"})) .
501 echo "<div class='encounter_forms'>\n";
503 $form_name = trim($result{"form_name"});
504 //if form name is not in registry, look for the closest match by
505 // finding a registry name which is at the start of the form name.
506 //this is to allow for forms to put additional helpful information
507 //in the database in the same string as their form name after the name
508 $form_name_found_flag = 0;
509 foreach ($registry_form_name as $var) {
510 if ($var == $form_name) {
511 $form_name_found_flag = 1;
515 // if the form does not match precisely with any names in the registry, now see if any front partial matches
516 // and change $form_name appropriately so it will print above in $toprint = $html_strings[$var]
517 if (!$form_name_found_flag) {
518 foreach ($registry_form_name as $var) {
519 if (strpos($form_name, $var) == 0) {
525 if (!is_array($html_strings[$form_name])) {
526 $html_strings[$form_name] = array();
529 array_push($html_strings[$form_name], "<input type='checkbox' ".
530 " name='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
531 " id='" . $result{"formdir"} . "_" . $result{"form_id"} . "'".
532 " value='" . $result{"encounter"} . "'" .
533 " class='encounter_form' ".
534 ">" . xl_form_title($result{"form_name"}) . "<br>\n");
538 foreach ($registry_form_name as $var) {
539 if ($toprint = $html_strings[$var]) {
540 foreach ($toprint as $var) {
549 </div
> <!-- end encounters DIV
-->
554 <!-- Procedure Orders
-->
556 <table border
="0" cellpadding
="0" cellspacing
="0" >
558 <td
class='bold'><?php
echo xlt('Procedures'); ?
> 
; 
;</td
>
559 <td
class='text'><?php
echo xlt('Order Date'); ?
> 
; 
;</td
>
560 <td
class='text'><?php
echo xlt('Encounter Date'); ?
> 
; 
;</td
>
561 <td
class='text'><?php
echo xlt('Order Descriptions'); ?
></td
>
565 "SELECT po.procedure_order_id, po.date_ordered, fe.date " .
566 "FROM procedure_order AS po " .
567 "LEFT JOIN forms AS f ON f.pid = po.patient_id AND f.formdir = 'procedure_order' AND " .
568 "f.form_id = po.procedure_order_id AND f.deleted = 0 " .
569 "LEFT JOIN form_encounter AS fe ON fe.pid = f.pid AND fe.encounter = f.encounter " .
570 "WHERE po.patient_id = ? " .
571 "ORDER BY po.date_ordered DESC, po.procedure_order_id DESC",
574 while ($row = sqlFetchArray($res)) {
575 $poid = $row['procedure_order_id'];
577 echo " <td align='center' class='text'>" .
578 "<input type='checkbox' name='procedures[]' value='$poid' /> </td>\n";
579 echo " <td class='text'>" . oeFormatShortDate($row['date_ordered']) . " </td>\n";
580 echo " <td class='text'>" . oeFormatShortDate($row['date']) . " </td>\n";
581 echo " <td class='text'>";
582 $opres = sqlStatement(
583 "SELECT procedure_code, procedure_name FROM procedure_order_code " .
584 "WHERE procedure_order_id = ? ORDER BY procedure_order_seq",
587 while ($oprow = sqlFetchArray($opres)) {
588 $tmp = $oprow['procedure_name'];
590 $tmp = $oprow['procedure_code'];
593 echo text($tmp) . "<br />";
603 <span
class="bold"><?php
echo xlt('Documents'); ?
></span
>:<br
>
606 // show available documents
607 $db = $GLOBALS['adodb']['db'];
608 $sql = "SELECT d.id, d.url, c.name FROM documents AS d " .
609 "LEFT JOIN categories_to_documents AS ctd ON d.id=ctd.document_id " .
610 "LEFT JOIN categories AS c ON c.id = ctd.category_id WHERE " .
611 "d.foreign_id = " . $db->qstr($pid);
612 $result = $db->Execute($sql);
613 if ($db->ErrorMsg()) {
614 echo $db->ErrorMsg();
617 while ($result && !$result->EOF
) {
618 echo "<li class='bold'>";
619 echo '<input type="checkbox" name="documents[]" value="' .
620 $result->fields
['id'] . '">';
621 echo ' <i>' . xl_document_category($result->fields
['name']) . "</i>";
622 echo ' ' . xl('Name') . ': <i>' . basename($result->fields
['url']) . "</i>";
630 <input type
="button" class="genreport" value
="<?php echo xlt('Generate Report'); ?>" /> 
;
631 <input type
="button" class="genpdfrep" value
="<?php echo xlt('Download PDF'); ?>" /> 
;
632 <?php
if ($cmsportal) { ?
>
633 <input type
="button" class="genportal" value
="<?php echo xlt('Send to Portal'); ?>" />
636 </div
> <!-- close patient_reports DIV
-->
640 // jQuery stuff to make the page a little easier to use
641 initReport
= function(){
642 $
(".genreport").click(function() {
643 document
.report_form
.pdf
.value
= 0;
645 /*$("#report_form").submit();*/
647 $
(".genpdfrep").click(function() { document
.report_form
.pdf
.value
= 1; $
("#report_form").submit(); });
648 $
(".genportal").click(function() { document
.report_form
.pdf
.value
= 2; $
("#report_form").submit(); });
649 $
("#genfullreport").click(function() { location
.href
='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
650 //$("#printform").click(function() { PrintForm(); });
651 $
(".issuecheckbox").click(function() { issueClick(this
); });
653 // check/uncheck all Forms of an encounter
654 $
(".encounter").click(function() { SelectForms($
(this
)); });
656 var title
= 'CCR Report';
659 { text
: 'Close', close
: true, style
: 'danger' },
660 { text
: 'Print', close
: false, style
: 'success', click
: showCCR
}
663 size
: eModal
.size
.lg
,
666 url
: '../ccr/createCCR.php',
667 data
:{'portal_auth_two':'1','ccrAction':'generate','raw':'yes'}
672 .then(function () { });
674 function showCustom(){
675 var formval
= $
( "#report_form" ).serializeArray();
676 var title
= 'Custom Reports';
679 { text
: 'Close', close
: true, style
: 'danger' },
680 //{ text: 'Print', close: false, style: 'success', click: showCustom }
683 size
: eModal
.size
.lg
,
686 url
: './report/portal_custom_report.php',
692 .then(function () { });
694 $
(".generateCCR").click(
696 if(document
.getElementById('show_date').checked
== true){
697 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
698 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
702 var ccrAction
= document
.getElementsByName('ccrAction');
703 ccrAction
[0].value
= 'generate';
704 var raw
= document
.getElementsByName('raw');
707 ccr_form
.setAttribute("target", "_blank");
708 $
("#ccr_form").submit();
711 ccr_form
.setAttribute("target", "");
713 $
(".generateCCR_raw").click(
715 var ccrAction
= document
.getElementsByName('ccrAction');
716 ccrAction
[0].value
= 'generate';
717 var raw
= document
.getElementsByName('raw');
718 raw
[0].value
= 'yes';
720 ccr_form
.setAttribute("target", "_blank");
721 $
("#ccr_form").submit();
722 ccr_form
.setAttribute("target", "");
724 $
(".generateCCR_download_h").click(
726 var ccrAction
= document
.getElementsByName('ccrAction');
727 ccrAction
[0].value
= 'generate';
728 var raw
= document
.getElementsByName('raw');
729 raw
[0].value
= 'hybrid';
731 $
("#ccr_form").submit();
733 $
(".generateCCR_download_p").click(
735 if(document
.getElementById('show_date').checked
== true){
736 if(document
.getElementById('Start').value
== '' || document
.getElementById('End').value
== ''){
737 alert('<?php echo addslashes(xl('Please select a start date
and end date
')) ?>');
741 var ccrAction
= document
.getElementsByName('ccrAction');
742 ccrAction
[0].value
= 'generate';
743 var raw
= document
.getElementsByName('raw');
744 raw
[0].value
= 'pure';
746 $
("#ccr_form").submit();
750 var ccrAction
= document
.getElementsByName('ccrAction');
751 ccrAction
[0].value
= 'viewccd';
752 var raw
= document
.getElementsByName('raw');
755 ccr_form
.setAttribute("target", "_blank");
756 $
("#ccr_form").submit();
757 ccr_form
.setAttribute("target", "");
759 $
(".viewCCD_raw").click(
761 var ccrAction
= document
.getElementsByName('ccrAction');
762 ccrAction
[0].value
= 'viewccd';
763 var raw
= document
.getElementsByName('raw');
764 raw
[0].value
= 'yes';
766 ccr_form
.setAttribute("target", "_blank");
767 $
("#ccr_form").submit();
768 ccr_form
.setAttribute("target", "");
770 $
(".viewCCD_download").click(
772 var ccrAction
= document
.getElementsByName('ccrAction');
773 ccrAction
[0].value
= 'viewccd';
774 var raw
= document
.getElementsByName('raw');
775 raw
[0].value
= 'pure';
776 $
("#ccr_form").submit();
778 <?php
if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccr_enable']==true) { ?
>
779 $
(".viewCCR_send_dialog").click(
781 $
("#ccr_send_dialog").toggle();
783 $
(".viewCCR_transmit").click(
785 $
(".viewCCR_transmit").attr('disabled','disabled');
786 var ccrAction
= document
.getElementsByName('ccrAction');
787 ccrAction
[0].value
= 'generate';
788 var ccrRecipient
= $
("#ccr_send_to").val();
789 var raw
= document
.getElementsByName('raw');
790 raw
[0].value
= 'send '+ccrRecipient
;
791 if(ccrRecipient
=="") {
792 $
("#ccr_send_message").html("<?php
793 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
794 $
("#ccr_send_result").show();
796 $
(".viewCCR_transmit").attr('disabled','disabled');
797 $
("#ccr_send_message").html("<?php
798 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
799 $
("#ccr_send_result").show();
800 var action
=$
("#ccr_form").attr('action');
801 $
.post(action
, {ccrAction
:'generate',raw
:'send '+ccrRecipient
,requested_by
:'user'},
803 if(data
=="SUCCESS") {
804 $
("#ccr_send_message").html("<?php
805 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
807 $
("#ccr_send_to").val("");
809 $
("#ccr_send_message").html(data
);
811 $
(".viewCCR_transmit").removeAttr('disabled');
817 if ($GLOBALS['phimail_enable']==true && $GLOBALS['phimail_ccd_enable']==true) { ?
>
818 $
(".viewCCD_send_dialog").click(
820 $
("#ccd_send_dialog").toggle();
822 $
(".viewCCD_transmit").click(
824 $
(".viewCCD_transmit").attr('disabled','disabled');
825 var ccrAction
= document
.getElementsByName('ccrAction');
826 ccrAction
[0].value
= 'viewccd';
827 var ccdRecipient
= $
("#ccd_send_to").val();
828 var raw
= document
.getElementsByName('raw');
829 raw
[0].value
= 'send '+ccdRecipient
;
830 if(ccdRecipient
=="") {
831 $
("#ccd_send_message").html("<?php
832 echo htmlspecialchars(xl('Please enter a valid Direct Address above.'), ENT_QUOTES);?>");
833 $
("#ccd_send_result").show();
835 $
(".viewCCD_transmit").attr('disabled','disabled');
836 $
("#ccd_send_message").html("<?php
837 echo htmlspecialchars(xl('Working... this may take a minute.'), ENT_QUOTES);?>");
838 $
("#ccd_send_result").show();
839 var action
=$
("#ccr_form").attr('action');
840 $
.post(action
, {ccrAction
:'viewccd',raw
:'send '+ccdRecipient
,requested_by
:'user'},
842 if(data
=="SUCCESS") {
843 $
("#ccd_send_message").html("<?php
844 echo htmlspecialchars(xl('Your message was submitted for delivery to'), ENT_QUOTES);
846 $
("#ccd_send_to").val("");
848 $
("#ccd_send_message").html(data
);
850 $
(".viewCCD_transmit").removeAttr('disabled');
858 $
( document
).ready(function(){
861 $
('.datepicker').datetimepicker({
862 <?php
$datetimepicker_timepicker = false; ?
>
863 <?php
$datetimepicker_formatInput = false; ?
>
864 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
865 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
869 // select/deselect the Forms related to the selected Encounter
870 // (it ain't pretty code folks)
871 var SelectForms
= function (selectedEncounter
) {
872 if ($
(selectedEncounter
).attr("checked")) {
873 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
874 $
(this
).children().each(function(i
, obj
) {
875 $
(this
).attr("checked", "checked");
880 $
(selectedEncounter
).parent().children().each(function(i
, obj
) {
881 $
(this
).children().each(function(i
, obj
) {
882 $
(this
).removeAttr("checked");
888 // When an issue is checked, auto-check all the related encounters and forms
889 function issueClick(issue
) {
890 // do nothing when unchecked
891 if (! $
(issue
).attr("checked")) return;
893 $
("#report_form :checkbox").each(function(i
, obj
) {
894 if ($
(issue
).val().indexOf('/' + $
(this
).val() +
'/') >= 0) {
895 $
(this
).attr("checked", "checked");