6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @author Jerry Padgett <sjpadgett@gmail.com>
10 * @copyright Copyright (c) 2010-2012 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/acl.inc");
17 use OpenEMR\Core\Header
;
19 // This script can be run either inside the OpenEMR frameset for order catalog
20 // maintenance, or as a popup window for selecting an item to order. In the
21 // popup case the GET variables 'popup' (a boolean) and 'order' (an optional
22 // item ID to select) will be provided, and maintenance may also be permitted.
24 $popup = empty($_GET['popup']) ?
0 : 1;
25 $order = isset($_GET['order']) ?
$_GET['order'] +
0 : 0;
26 $labid = isset($_GET['labid']) ?
$_GET['labid'] +
0 : 0;
28 // If Save was clicked, set the result, close the window and exit.
30 if ($popup && $_POST['form_save']) {
31 $form_order = isset($_GET['form_order']) ?
$_GET['form_order'] +
0 : 0;
32 $ptrow = sqlQuery("SELECT name FROM procedure_type WHERE " . "procedure_type_id = '$form_order'");
33 $name = addslashes($ptrow['name']);
35 <script type
="text/javascript"
36 src
="<?php echo $webroot ?>/interface/main/tabs/js/include_opener.js">
38 <script language
="JavaScript">
39 if (opener
.closed ||
! opener
.set_proc_type
) {
40 alert('<?php echo xlt('The destination form was closed
; I cannot act on your selection
.'); ?>');
42 opener
.set_proc_type(<?php
echo "$form_order, '$name'" ?
>);
44 // This is to generate the "Questions at Order Entry" for the Procedure Order form.
45 // GET parms needed for this are: formid, formseq.
46 if (isset($_GET['formid'])) {
47 require_once("qoe.inc.php");
48 $qoe_init_javascript = '';
49 echo ' opener.set_proc_html("';
50 echo generate_qoe_html($form_order, intval($_GET['formid']), 0, intval($_GET['formseq']));
51 echo '", "' . $qoe_init_javascript . '");' . "\n";
55 window
.close(); // comment out for debugging
67 <?php Header
::setupHeader(['opener', 'datetime-picker', 'jquery-ui', 'jquery-ui-base']);?
>
69 <title
><?php
echo xlt('Configure Orders and Results'); ?
></title
>
71 <style type
="text/css">
79 font
-family
: sans
-serif
;
84 font
-family
: monospace
;
94 background
-color
: #cccccc;
98 background
-color
: #ddddff;
101 background
-color
: #ffffff;
104 padding
: 0px
0px
0px
10px
;
131 font
-size
: 18px
!important
;
139 padding
-left
: 0 !important
;
167 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
171 <script language
="JavaScript">
175 require($GLOBALS['srcdir'] . "/restoreSession.php");
180 // Create array of IDs to pre-select, leaf to top.
182 echo $order > 0 ?
$order : 0;
183 for ($parentid = $order; $parentid > 0;) {
184 $row = sqlQuery("SELECT parent FROM procedure_type WHERE procedure_type_id = '$parentid'");
185 $parentid = $row['parent'] +
0;
193 // initiate by loading the top-level nodes
194 $
(document
).ready(function(){
198 // This is called repeatedly at initialization until all desired nodes
200 function nextOpen() {
201 if (preopen
.length
) {
202 var thisid
= preopen
.pop();
204 if (thisid
== 0 || preopen
.length
> 0) {
208 $
.getScript('types_ajax.php?id=' + thisid +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
219 // toggle expansion indicator from + to - or vice versa
220 function swapsign(td1
, from
, to
) {
222 var i
= s
.indexOf('>' + from +
' <');
223 if (i
>= 0) td1
.html(s
.substring(0,i+
1) + to + s
.substring(i+
2));
226 // onclick handler to expand or collapse a node
227 function toggle(id
) {
228 var td1
= $
('#td' + id
);
229 if (!td1
.hasClass('haskids')) return;
230 if (td1
.hasClass('isExpanded')) {
231 $
('#con' + id
).remove();
232 td1
.removeClass('isExpanded');
233 swapsign(td1
, '-', '+');
237 td1
.parent().after('<tr class="outertr"><td colspan="6" id="con' + id +
'" style="padding:0">Loading...</td></tr>');
238 td1
.addClass('isExpanded');
239 swapsign(td1
, '+', '-');
240 $
.getScript('types_ajax.php?id=' + id +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
244 // Called by the edit window to refresh a given node's children
245 function refreshFamily(id
, haskids
) {
246 if (id
) { // id == 0 means top level
247 var td1
= $
('#td' + id
);
248 if (td1
.hasClass('isExpanded')) {
249 $
('#con' + id
).remove();
250 td1
.removeClass('isExpanded');
251 swapsign(td1
, '-', '+');
253 if (td1
.hasClass('haskids') && !haskids
) {
254 td1
.removeClass('haskids');
255 // swapsign(td1, '+', '.');
256 swapsign(td1
, '+', '|');
259 if (!td1
.hasClass('haskids') && haskids
) {
260 td1
.addClass('haskids');
261 // swapsign(td1, '.', '+');
262 swapsign(td1
, '|', '+');
265 td1
.parent().after('<tr class="outertr"><td colspan="6" id="con' + id +
'" style="padding:0">Loading...</td></tr>');
266 td1
.addClass('isExpanded');
267 swapsign(td1
, '+', '-');
271 $
.getScript('types_ajax.php?id=' + id +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
278 dlgopen('types_edit.php?parent=0&typeid=' + id
, '_blank', 800, 750);
283 dlgopen('types_edit.php?typeid=0&parent=' + id
, '_blank', 800, 750);
286 // call this to alternate row colors when anything changes the number of rows
289 $
('#con0 tr').each(function(index
) {
290 // skip any row that contains other rows
291 if ($
(this
).hasClass('outertr')) return;
292 this
.className
= (i++
& 1) ?
"evenrow" : "oddrow";
296 // Callback from popups to refresh this display.
297 function refreshme() {
298 // location.reload();
299 document
.forms
[0].submit();
305 <body
class="body_nav">
307 if ($GLOBALS['enable_help'] == 1) {
308 $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>';
309 } elseif ($GLOBALS['enable_help'] == 2) {
310 $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>';
311 } elseif ($GLOBALS['enable_help'] == 0) {
315 <div
class="container">
317 <div
class="col-xs-12">
318 <div
class="page-header clearfix">
319 <h2 id
="header_title" class="clearfix"><span id
='header_text'><?php
echo xlt('Configure Orders and Results');?
></span
><?php
echo $help_icon; ?
></h2
>
324 <div
class="col-xs-12">
325 <form method
='post' name
='theform'
326 action
='types.php?popup=<?php echo $popup ?>&order=<?php
328 if (isset($_GET['formid
'])) {
329 echo '&formid
=' . $_GET['formid
'];
332 if (isset($_GET['formseq
'])) {
333 echo '&formseq
=' . $_GET['formseq
'];
336 <div
class="btn-group">
337 <button type
="button" name
="form_search" class="btn btn-default btn-refresh" onclick
="refreshme()"><?php
echo xlt('Refresh');?
></button
>
338 <button type
="button" class="btn btn-default btn-add" name
='add_node_btn' id
='add_node_button' onclick
='anode(0)'><?php
echo xlt('Add Top Level');?
></button
>
342 <div
class = "table-responsive">
343 <table
class="table" style
="margin-bottom:0">
346 <td
class='col1' align
='left'> 
; 
;<?php
echo xlt('Name') ?
> <i id
="name-tooltip" class="fa fa-info-circle oe-text-black" aria
-hidden
="true"></i
></td
>
347 <td
class='col2 oe-pl0' align
='left'><?php
echo xlt('Category') ?
> <i id
="order-tooltip" class="fa fa-info-circle oe-text-black" aria
-hidden
="true"></i
></td
>
348 <td
class='col3 oe-pl0' align
='left'><?php
echo xlt('Code') ?
> <i id
="code-tooltip" class="fa fa-info-circle oe-text-black" aria
-hidden
="true"></i
></td
>
349 <td
class='col6 oe-pl0' align
='left'><?php
echo xlt('Tier') ?
> <i id
="tier-tooltip" class="fa fa-info-circle oe-text-black" aria
-hidden
="true"></i
></td
>
350 <td
class='col4 oe-pl0' align
='left'><?php
echo xlt('Description') ?
></td
>
351 <td
class='col5 oe-pl0' align
='left' style
='padding-left:0px'><?php
echo xlt('Edit/Add') ?
></td
>
356 <div id
="con0"></div
>
357 <?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 ?>
358 <div
class="form-group clearfix">
359 <div
class="col-sm-12 text-left position-override">
360 <div
class="btn-group btn-group-pinch" role
="group">
361 <?php
if ($popup) { ?
>
362 <button type
="submit" class="btn btn-default btn-save" name
='form_save' value
='<?php echo xla('Save
'); ?>'><?php
echo xlt('Save');?
></button
>
363 <button
class="btn btn-link btn-cancel btn-separate-left" onclick
="CancelDistribute()"><?php
echo xlt('Cancel');?
></button
>
371 </div
><!--End of Container div
-->
374 //home of the help modal ;)
375 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
376 if ($GLOBALS['enable_help'] == 1) {
377 echo "<script>var helpFile = 'configure_orders_help.php'</script>";
378 //help_modal.php lives in interface, set path accordingly
379 require "../help_modal.php";
384 $
(document
).ready(function(){
385 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
386 // the relevant css file needs to be called i.e. jquery-ui-darkness - to get a black tooltip
387 $
('#name-tooltip').attr( "title", "<?php echo xla('The actual tests or procedures that can be searched for and ordered are highlighted in yellow'); ?>" +
". " +
"<?php echo xla('Click on the blue plus sign under Name to reveal test names'); ?>").tooltip();
388 $
('#order-tooltip').attr( "title", "<?php echo xla('The entries marked yes can be ordered as a test or procedure'); ?>" +
". " +
"<?php echo xla('Click on the blue plus sign under Name to reveal test names'); ?>" ).tooltip();
389 $
('#code-tooltip').attr( "title", "<?php echo xla('Category - Order, Result and Recommendation need an identifying code');?>" +
". " +
"<?php echo xla('Red Triangle indicates a required code that is missing')?>.").
391 $
('#tier-tooltip').attr( "title", "<?php echo xla('Shows the hierarchal level of this line');?>" +
". " +
"<?php echo xla('Tier 1 entries should be of Category Top Group')?>.").
393 $
('table td .required-tooltip').attr( "title", "<?php echo xla('For proper tabulated display of tests and results an identifying code is required'); ?>").tooltip();
394 $
("table td .required-tooltip").fadeIn(500);
395 $
("table td .required-tooltip3").fadeOut(1000);
396 $
("table td .required-tooltip").fadeIn(500);
397 $
(".plusminus").click(function(){
398 $
(".required-tooltip").effect("pulsate", {times
:1}, 4000);