update selected facility pos code when facility is changed in encounter.
[openemr.git] / interface / forms / newpatient / common.php
blob62aaca52cc65abacefb2113951a2d3b1103c248e
1 <?php
2 /**
3 * Common script for the encounter form (new and view) scripts.
5 * LICENSE: This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
16 * @package OpenEMR
17 * @author Brady Miller <brady.g.miller@gmail.com>
18 * @link http://www.open-emr.org
21 require_once("$srcdir/options.inc.php");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/lists.inc");
25 use OpenEMR\Core\Header;
26 use OpenEMR\Services\FacilityService;
28 $facilityService = new FacilityService();
30 if ($GLOBALS['enable_group_therapy']) {
31 require_once("$srcdir/group.inc");
34 $months = array("01","02","03","04","05","06","07","08","09","10","11","12");
35 $days = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14",
36 "15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31");
37 $thisyear = date("Y");
38 $years = array($thisyear-1, $thisyear, $thisyear+1, $thisyear+2);
40 if ($viewmode) {
41 $id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : '';
42 $result = sqlQuery("SELECT * FROM form_encounter WHERE id = ?", array($id));
43 $encounter = $result['encounter'];
44 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
45 echo "<body>\n<html>\n";
46 echo "<p>" . xlt('You are not authorized to see this encounter.') . "</p>\n";
47 echo "</body>\n</html>\n";
48 exit();
52 // Sort comparison for sensitivities by their order attribute.
53 function sensitivity_compare($a, $b)
55 return ($a[2] < $b[2]) ? -1 : 1;
58 // get issues
59 $ires = sqlStatement("SELECT id, type, title, begdate FROM lists WHERE " .
60 "pid = ? AND enddate IS NULL " .
61 "ORDER BY type, begdate", array($pid));
63 <!DOCTYPE html>
64 <html>
65 <head>
66 <?php Header::setupHeader(['datetime-picker', 'common', 'jquery-ui', 'jquery-ui-darkness']);?>
67 <title><?php echo xlt('Patient Encounter'); ?></title>
70 <!-- validation library -->
71 <?php
72 //Not lbf forms use the new validation, please make sure you have the corresponding values in the list Page validation
73 $use_validate_js = 1;
74 require_once($GLOBALS['srcdir'] . "/validation/validation_script.js.php"); ?>
76 <?php include_once("{$GLOBALS['srcdir']}/ajax/facility_ajax_jav.inc.php"); ?>
77 <script language="JavaScript">
80 var mypcc = '<?php echo $GLOBALS['phone_country_code'] ?>';
82 // Process click on issue title.
83 function newissue() {
84 dlgopen('../../patient_file/summary/add_edit_issue.php', '_blank', 700, 535, '', '', {
85 buttons: [
86 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
88 });
89 return false;
92 // callback from add_edit_issue.php:
93 function refreshIssue(issue, title) {
94 var s = document.forms[0]['issues[]'];
95 s.options[s.options.length] = new Option(title, issue, true, true);
98 <?php
99 //Gets validation rules from Page Validation list.
100 //Note that for technical reasons, we are bypassing the standard validateUsingPageRules() call.
101 $collectthis = collectValidationPageRules("/interface/forms/newpatient/common.php");
102 if (empty($collectthis)) {
103 $collectthis = "undefined";
104 } else {
105 $collectthis = json_sanitize($collectthis["new_encounter"]["rules"]);
108 var collectvalidation = <?php echo $collectthis; ?>;
109 $(document).ready(function(){
110 window.saveClicked = function(event) {
111 var submit = submitme(1, event, 'new-encounter-form', collectvalidation);
112 if (submit) {
113 top.restoreSession();
114 $('#new-encounter-form').submit();
118 $(".enc_issue").on('click', function(e) {
119 e.preventDefault();e.stopPropagation();
120 dlgopen('', '', 700, 650, '', '', {
122 buttons: [{text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}],
124 allowResize: true,
125 allowDrag: true,
126 dialogId: '',
127 type: 'iframe',
128 url: $(this).attr('href')
132 $('.datepicker').datetimepicker({
133 <?php $datetimepicker_timepicker = false; ?>
134 <?php $datetimepicker_showseconds = false; ?>
135 <?php $datetimepicker_formatInput = true; ?>
136 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
137 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
141 function bill_loc(){
142 var pid = <?php echo attr($pid);?>;
143 var dte = document.getElementById('form_date').value;
144 var facility = document.forms[0].facility_id.value;
145 ajax_bill_loc(pid, dte, facility);
146 <?php if ($GLOBALS['set_pos_code_encounter']) { ?>
147 $.ajax({
148 url: "./../../../library/ajax/facility_ajax_code.php",
149 method: "GET",
150 data: {
151 mode: "get_pos",
152 facility_id: facility
154 .done(function (fid) {
155 document.forms[0].pos_code.value = fid;
157 .fail(function (xhr) {
158 console.log('error', xhr);
160 <?php } ?>
163 // Handler for Cancel clicked when creating a new encounter.
164 // Show demographics or encounters list depending on what frame we're in.
165 function cancelClickedNew() {
166 if (top.tab_mode) {
167 window.parent.left_nav.loadFrame('ens1', window.name, 'patient_file/history/encounters.php');
169 var target = window;
170 while (target != top) {
171 if (target.name == 'RBot') {
172 target.parent.left_nav.loadFrame('ens1', window.name, 'patient_file/history/encounters.php');
173 break;
175 else if (target.name == 'RTop') {
176 target.parent.left_nav.loadFrame('dem1', window.name, 'patient_file/summary/demographics.php');
177 break;
179 target = target.parent;
181 return false;
184 // Handler for cancel clicked when not creating a new encounter.
185 // Just reload the view mode.
186 function cancelClickedOld() {
187 location.href = '<?php echo "$rootdir/patient_file/encounter/forms.php"; ?>';
188 return false;
191 </script>
192 <style>
193 @media only screen and (max-width: 1024px) {
194 #visit-details [class*="col-"], #visit-issues [class*="col-"]{
195 width: 100%;
196 text-align: <?php echo ($_SESSION['language_direction'] == 'rtl') ? 'right ': 'left '?> !Important;
198 </style>
199 <?php
200 if ($viewmode) {
201 $body_javascript = '';
202 $heading_caption = xl('Patient Encounter Form');
203 } else {
204 $body_javascript = 'onload="javascript:document.new_encounter.reason.focus();"';
205 $heading_caption = xl('New Encounter Form');
209 if ($GLOBALS['enable_help'] == 1) {
210 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#676666" title="' . xla("Click to view Help") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
211 } elseif ($GLOBALS['enable_help'] == 2) {
212 $help_icon = '<a class="pull-right oe-help-redirect" data-target="#myModal" data-toggle="modal" href="#" id="help-href" name="help-href" style="color:#DCD6D0 !Important" title="' . xla("To enable help - Go to Administration > Globals > Features > Enable Help Modal") . '"><i class="fa fa-question-circle" aria-hidden="true"></i></a>';
213 } elseif ($GLOBALS['enable_help'] == 0) {
214 $help_icon = '';
217 </head>
218 <body class="body_top" <?php echo $body_javascript;?>>
219 <div class="container">
220 <div class="row">
221 <div class="col-xs-12">
222 <!-- Required for the popup date selectors -->
223 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
224 <div class="">
225 <div class="page-header">
226 <h2><?php echo text($heading_caption); ?><?php echo $help_icon; ?></h2>
227 </div>
228 </div>
229 </div>
230 </div>
231 <div class="row">
232 <div class="col-xs-12">
233 <form id="new-encounter-form" method='post' action="<?php echo $rootdir ?>/forms/newpatient/save.php" name='new_encounter'>
234 <?php if ($viewmode) { ?>
235 <input type=hidden name='mode' value='update'>
236 <input type=hidden name='id' value='<?php echo (isset($_GET["id"])) ? attr($_GET["id"]) : '' ?>'>
237 <?php } else { ?>
238 <input type='hidden' name='mode' value='new'>
239 <?php } ?>
240 <fieldset>
241 <legend><?php echo xlt('Visit Details')?></legend>
242 <div id = "visit-details">
243 <div class="form-group ">
244 <label for="pc_catid" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Visit Category:'); ?></label>
245 <div class="col-sm-3">
246 <select name='pc_catid' id='pc_catid' class='form-control col-sm-12'>
247 <option value='_blank'>-- <?php echo xlt('Select One'); ?> --</option>
248 <?php
249 //Bring only patient ang group categories
250 $visitSQL = "SELECT pc_catid, pc_catname, pc_cattype
251 FROM openemr_postcalendar_categories
252 WHERE pc_active = 1 and pc_cattype IN (0,3) and pc_constant_id != 'no_show' ORDER BY pc_seq";
254 $visitResult = sqlStatement($visitSQL);
255 $therapyGroupCategories = [];
257 while ($row = sqlFetchArray($visitResult)) {
258 $catId = $row['pc_catid'];
259 $name = $row['pc_catname'];
261 if ($row['pc_cattype'] == 3) {
262 $therapyGroupCategories[] = $catId;
265 if ($catId === "_blank") {
266 continue;
269 if ($row['pc_cattype'] == 3 && !$GLOBALS['enable_group_therapy']) {
270 continue;
273 // Fetch acl for category of given encounter. Only if has write auth for a category, then can create an encounter of that category.
274 $postCalendarCategoryACO = fetchPostCalendarCategoryACO($catId);
275 if ($postCalendarCategoryACO) {
276 $postCalendarCategoryACO = explode('|', $postCalendarCategoryACO);
277 $authPostCalendarCategoryWrite = acl_check($postCalendarCategoryACO[0], $postCalendarCategoryACO[1], '', 'write');
278 } else { // if no aco is set for category
279 $authPostCalendarCategoryWrite = true;
282 //if no permission for category write, don't show in drop-down
283 if (!$authPostCalendarCategoryWrite) {
284 continue;
287 $optionStr = '<option value="%pc_catid%" %selected%>%pc_catname%</option>';
288 $optionStr = str_replace("%pc_catid%", attr($catId), $optionStr);
289 $optionStr = str_replace("%pc_catname%", text(xl_appt_category($name)), $optionStr);
290 if ($viewmode) {
291 $selected = ($result['pc_catid'] == $catId) ? " selected" : "";
292 } else {
293 $selected = ($GLOBALS['default_visit_category'] == $catId) ? " selected" : "";
296 $optionStr = str_replace("%selected%", $selected, $optionStr);
297 echo $optionStr;
300 </select>
301 </div>
302 <?php
303 $sensitivities = acl_get_sensitivities();
304 if ($sensitivities && count($sensitivities)) {
305 usort($sensitivities, "sensitivity_compare");
307 <label for="pc_catid" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Sensitivity:'); ?> &nbsp;<i id='sensitivity-tooltip' class="fa fa-info-circle text-primary" aria-hidden="true"></i></label>
308 <div class="col-sm-3">
309 <select name='form_sensitivity' id='form_sensitivity' class='form-control col-sm-12' >
310 <?php
311 foreach ($sensitivities as $value) {
312 // Omit sensitivities to which this user does not have access.
313 if (acl_check('sensitivities', $value[1])) {
314 echo " <option value='" . attr($value[1]) . "'";
315 if ($viewmode && $result['sensitivity'] == $value[1]) {
316 echo " selected";
319 echo ">" . xlt($value[3]) . "</option>\n";
323 echo " <option value=''";
324 if ($viewmode && !$result['sensitivity']) {
325 echo " selected";
328 echo ">" . xlt('None'). "</option>\n";
330 </select>
331 <?php
332 } else {
335 <?php
338 </div>
339 <div class="clearfix"></div>
340 </div>
341 <div class="form-group">
342 <label for='form_date' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Date of Service:'); ?></label>
343 <div class="col-sm-3">
344 <input type='text' class='form-control datepicker col-sm-12' name='form_date' id='form_date' <?php echo $disabled ?>
345 value='<?php echo $viewmode ? attr(oeFormatShortDate(substr($result['date'], 0, 10))) : oeFormatShortDate(date('Y-m-d')); ?>'
346 title='<?php echo xla('Date of service'); ?>'/>
347 </div>
349 <div
350 <?php
351 if ($GLOBALS['ippf_specific']) {
352 echo " style='visibility:hidden;'";
353 } ?>>
354 <label for='form_onset_date' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Onset/hosp. date:'); ?> &nbsp;<i id='onset-tooltip' class="fa fa-info-circle text-primary" aria-hidden="true"></i></label>
355 <div class="col-sm-3">
356 <input type='text' class='form-control datepicker col-sm-12' name='form_onset_date' id='form_onset_date'
357 value='<?php echo $viewmode && $result['onset_date']!='0000-00-00 00:00:00' ? attr(oeFormatShortDate(substr($result['onset_date'], 0, 10))) : ''; ?>'
358 title='<?php echo xla('Date of onset or hospitalization'); ?>' />
359 </div>
360 </div>
361 <div class="clearfix"></div>
362 </div>
363 <div class="form-group"
364 <?php
365 if (!$GLOBALS['gbl_visit_referral_source']) {
366 echo "style='display:none'";
367 } ?>>">
368 <label class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Referral Source'); ?>:</label>
369 <div class="col-sm-3">
370 <?php echo generate_select_list('form_referral_source', 'refsource', $viewmode ? $result['referral_source'] : '', '');?>
371 </div>
372 <div class="clearfix"></div>
373 </div>
374 <?php if ($GLOBALS['enable_group_therapy']) { ?>
375 <div class="form-group"id="therapy_group_name" style="display: none">
376 <label for="form_group" class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Group name'); ?>:</label>
377 <div class="col-sm-3">
378 <input type='text'name='form_group' class='form-control col-sm-12' id="form_group" placeholder='<?php echo xla('Click to select');?>' value='<?php echo $viewmode && in_array($result['pc_catid'], $therapyGroupCategories) ? attr(getGroup($result['external_id'])['group_name']) : ''; ?>' onclick='sel_group()' title='<?php echo xla('Click to select group'); ?>' readonly />
379 <input type='hidden' name='form_gid' value='<?php echo $viewmode && in_array($result['pc_catid'], $therapyGroupCategories) ? attr($result['external_id']) : '' ?>' />
380 </div>
381 <div class="clearfix"></div>
382 </div>
383 <?php }?>
384 <div class="form-group">
385 <label for='facility_id' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Facility'); ?>:</label>
386 <div class="col-sm-8">
387 <select name='facility_id' id='facility_id' class='form-control col-sm-9' onChange="bill_loc()">
388 <?php
389 if ($viewmode) {
390 $def_facility = $result['facility_id'];
391 } else {
392 $dres = sqlStatement("select facility_id from users where username = ?", array($_SESSION['authUser']));
393 $drow = sqlFetchArray($dres);
394 $def_facility = $drow['facility_id'];
396 $posCode = '';
397 $facilities = $facilityService->getAllServiceLocations();
398 if ($facilities) {
399 foreach ($facilities as $iter) { ?>
400 <option value="<?php echo attr($iter['id']); ?>"
401 <?php
402 if ($def_facility == $iter['id']) {
403 if (!$viewmode) {
404 $posCode = $iter['pos_code'];
406 echo "selected";
407 }?>><?php echo text($iter['name']); ?>
408 </option>
409 <?php
413 </select>
414 </div>
415 <div class="clearfix"></div>
416 </div>
417 <div class="form-group">
418 <label for='billing_facility' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('Billing Facility'); ?>:</label>
419 <div id="ajaxdiv" class="col-sm-8">
420 <?php
421 $default_bill_fac = isset($result['billing_facility']) ? $result['billing_facility'] : $def_facility;
422 billing_facility('billing_facility', $default_bill_fac);
424 </div>
425 <div class="clearfix"></div>
426 </div>
427 </div>
428 <?php if ($GLOBALS['set_pos_code_encounter']) { ?>
429 <div class="form-group">
430 <label for='pos_code' class="control-label col-sm-2 oe-text-to-right"><?php echo xlt('POS Code'); ?>:</label>
431 <div class="col-sm-8">
432 <select name="pos_code" id="pos_code" class='form-control col-sm-9'>
433 <?php
434 $pc = new POSRef();
435 foreach ($pc->get_pos_ref() as $pos) {
436 echo "<option value=\"" . attr($pos["code"]) . "\" ";
437 if (($pos["code"] == $result['pos_code'] && $viewmode) || ($pos["code"] == $posCode && !$viewmode)) {
438 echo "selected";
440 echo ">" . text($pos['code']) . ": ". xlt($pos['title']);
441 echo "</option>\n";
444 </select>
445 </div>
446 <div class="clearfix"></div>
447 </div>
448 <?php }?>
449 </fieldset>
450 <fieldset>
451 <legend><?php echo xlt('Reason for Visit')?></legend>
452 <div class="form-group">
453 <div class="col-sm-10 col-sm-offset-1">
454 <textarea name="reason" id="reason" class="form-control" cols="80" rows="4" ><?php echo $viewmode ? text($result['reason']) : text($GLOBALS['default_chief_complaint']); ?></textarea>
455 </div>
456 </div>
457 </fieldset>
458 <fieldset>
459 <legend><?php echo xlt('Link/Add Issues (Injuries/Medical/Allergy) to Current Visit')?></legend>
460 <div id = "visit-issues">
461 <div class="form-group clearfix">
462 <div class="col-sm-6 col-lg-offset-3">
463 <?php
464 // To see issues stuff user needs write access to all issue types.
465 $issuesauth = true;
466 foreach ($ISSUE_TYPES as $type => $dummy) {
467 if (!acl_check_issue($type, '', 'write')) {
468 $issuesauth = false;
469 break;
472 if ($issuesauth) {
474 <div class="col-sm-12">
475 <div class="col-sm-12 pull-left" style="padding-bottom:5px">
476 <div class="btn-group" role="group">
477 <?php if (acl_check('patients', 'med', '', 'write')) { ?>
478 <a href="../../patient_file/summary/add_edit_issue.php" class="css_button_small link_submit enc_issue"
479 onclick="top.restoreSession()"><span><?php echo xlt('Add Issue'); ?></span></a>
480 <?php } ?>
481 </div>
482 </div>
483 <div class="col-sm-12 pull-left">
484 <select multiple name='issues[]' class='col-sm-12'
485 title='<?php echo xla('Hold down [Ctrl] for multiple selections or to unselect'); ?>' size='6'>
486 <?php
487 while ($irow = sqlFetchArray($ires)) {
488 $list_id = $irow['id'];
489 $tcode = $irow['type'];
490 if ($ISSUE_TYPES[$tcode]) {
491 $tcode = $ISSUE_TYPES[$tcode][2];
493 echo " <option value='" . attr($list_id) . "'";
494 if ($viewmode) {
495 $perow = sqlQuery("SELECT count(*) AS count FROM issue_encounter WHERE " .
496 "pid = ? AND encounter = ? AND list_id = ?", array($pid, $encounter, $list_id));
497 if ($perow['count']) {
498 echo " selected";
500 } else {
501 // For new encounters the invoker may pass an issue ID.
502 if (!empty($_REQUEST['issue']) && $_REQUEST['issue'] == $list_id) {
503 echo " selected";
506 echo ">" . text($tcode) . ": " . text($irow['begdate']) . " " .
507 text(substr($irow['title'], 0, 40)) . "</option>\n";
510 </select>
511 </div>
512 <div class="col-sm-12">
513 <p><i><?php echo xlt('To link this encounter/consult to an existing issue, click the '
514 . 'desired issue above to highlight it and then click [Save]. '
515 . 'Hold down [Ctrl] button to select multiple issues.'); ?></i></p>
516 </div>
517 </div>
518 <?php
521 </div>
522 </div>
523 </div>
524 </fieldset>
525 <?php //can change position of buttons by creating a class 'position-override' and adding rule text-align:center or right as the case may be in individual stylesheets ?>
526 <div class="form-group clearfix">
527 <div class="col-sm-12 text-left position-override">
528 <button type="button" class="btn btn-default btn-save" onclick="top.restoreSession(); saveClicked(undefined);"><?php echo xlt('Save');?></button>
529 <?php if ($viewmode || empty($_GET["autoloaded"])) { // not creating new encounter ?>
530 <button type="button" class="btn btn-link btn-cancel btn-separate-left" onClick="return cancelClickedOld()"><?php echo xlt('Cancel');?></button>
531 <?php } else { // not $viewmode ?>
532 <button class="btn btn-link btn-cancel btn-separate-left link_submit" onClick="return cancelClickedNew()">
533 <?php echo xlt('Cancel'); ?></button>
534 <?php } // end not $viewmode ?>
535 </div>
536 </div>
537 <div class="clearfix"></div>
538 </form>
539 </div>
540 </div>
541 </div><!--end of container div-->
542 <br>
543 <?php
544 //home of the help modal ;)
545 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
546 if ($GLOBALS['enable_help'] == 1) {
547 echo "<script>var helpFile = 'common_help.php'</script>";
548 //help_modal.php lives in interface, set path accordingly
549 require "../../help_modal.php";
552 </body>
553 <script language="javascript">
554 <?php
555 if (!$viewmode) { ?>
556 function duplicateVisit(enc, datestr) {
557 if (!confirm('<?php echo xls("A visit already exists for this patient today. Click Cancel to open it, or OK to proceed with creating a new one.") ?>')) {
558 // User pressed the cancel button, so re-direct to today's encounter
559 top.restoreSession();
560 parent.left_nav.setEncounter(datestr, enc, window.name);
561 parent.left_nav.loadFrame('enc2', window.name, 'patient_file/encounter/encounter_top.php?set_encounter=' + enc);
562 return;
564 // otherwise just continue normally
566 <?php
568 // Search for an encounter from today
569 $erow = sqlQuery("SELECT fe.encounter, fe.date " .
570 "FROM form_encounter AS fe, forms AS f WHERE " .
571 "fe.pid = ? " .
572 " AND fe.date >= ? " .
573 " AND fe.date <= ? " .
574 " AND " .
575 "f.formdir = 'newpatient' AND f.form_id = fe.id AND f.deleted = 0 " .
576 "ORDER BY fe.encounter DESC LIMIT 1", array($pid,date('Y-m-d 00:00:00'),date('Y-m-d 23:59:59')));
578 if (!empty($erow['encounter'])) {
579 // If there is an encounter from today then present the duplicate visit dialog
580 echo "duplicateVisit('" . $erow['encounter'] . "', '" .
581 attr(oeFormatShortDate(substr($erow['date'], 0, 10))) . "');\n";
586 <?php
587 if ($GLOBALS['enable_group_therapy']) { ?>
588 /* hide / show group name input */
589 var groupCategories = <?php echo json_encode($therapyGroupCategories); ?>;
590 $('#pc_catid').on('change', function () {
591 if(groupCategories.indexOf($(this).val()) > -1){
592 $('#therapy_group_name').show();
593 } else {
594 $('#therapy_group_name').hide();
598 function sel_group() {
599 top.restoreSession();
600 var url = '<?php echo $GLOBALS['webroot']?>/interface/main/calendar/find_group_popup.php';
601 dlgopen(url, '_blank', 500, 400, '', '', {
602 buttons: [
603 {text: '<?php echo xla('Close'); ?>', close: true, style: 'default btn-sm'}
607 // This is for callback by the find-group popup.
608 function setgroup(gid, name) {
609 var f = document.forms[0];
610 f.form_group.value = name;
611 f.form_gid.value = gid;
614 <?php
615 if ($viewmode && in_array($result['pc_catid'], $therapyGroupCategories)) {?>
616 $('#therapy_group_name').show();
617 <?php
618 } ?>
619 <?php
620 } ?>
622 $(document).ready(function(){
623 $('#billing_facility').addClass('col-sm-9');
624 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
625 // the relevant css file needs to be called i.e. jquery-ui-darkness - to get a black tooltip
626 $('#sensitivity-tooltip').attr( "title", "<?php echo xla('If set as high will restrict visibility of encounter to users belonging to certain groups (AROs). By default - Physicians and Administrators'); ?>" );
627 $('#sensitivity-tooltip').tooltip();
628 $('#onset-tooltip').attr( "title", "<?php echo xla('Hospital date needed for successful billing of hospital encounters'); ?>" );
629 $('#onset-tooltip').tooltip();
631 </script>
632 </html>