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
;
128 @media only screen
and (max
-width
: 768px
) {
139 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
143 <script language
="JavaScript">
147 require($GLOBALS['srcdir'] . "/restoreSession.php");
152 // Create array of IDs to pre-select, leaf to top.
154 echo $order > 0 ?
$order : 0;
155 for ($parentid = $order; $parentid > 0;) {
156 $row = sqlQuery("SELECT parent FROM procedure_type WHERE procedure_type_id = '$parentid'");
157 $parentid = $row['parent'] +
0;
165 // initiate by loading the top-level nodes
166 $
(document
).ready(function(){
170 // This is called repeatedly at initialization until all desired nodes
172 function nextOpen() {
173 if (preopen
.length
) {
174 var thisid
= preopen
.pop();
176 if (thisid
== 0 || preopen
.length
> 0) {
180 $
.getScript('types_ajax.php?id=' + thisid +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
191 // toggle expansion indicator from + to - or vice versa
192 function swapsign(td1
, from
, to
) {
194 var i
= s
.indexOf('>' + from +
' <');
195 if (i
>= 0) td1
.html(s
.substring(0,i+
1) + to + s
.substring(i+
2));
198 // onclick handler to expand or collapse a node
199 function toggle(id
) {
200 var td1
= $
('#td' + id
);
201 if (!td1
.hasClass('haskids')) return;
202 if (td1
.hasClass('isExpanded')) {
203 $
('#con' + id
).remove();
204 td1
.removeClass('isExpanded');
205 swapsign(td1
, '-', '+');
209 td1
.parent().after('<tr class="outertr"><td colspan="7" id="con' + id +
'" style="padding:0">Loading...</td></tr>');
210 td1
.addClass('isExpanded');
211 swapsign(td1
, '+', '-');
212 $
.getScript('types_ajax.php?id=' + id +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
216 // Called by the edit window to refresh a given node's children
217 function refreshFamily(id
, haskids
) {
218 if (id
) { // id == 0 means top level
219 var td1
= $
('#td' + id
);
220 if (td1
.hasClass('isExpanded')) {
221 $
('#con' + id
).remove();
222 td1
.removeClass('isExpanded');
223 swapsign(td1
, '-', '+');
225 if (td1
.hasClass('haskids') && !haskids
) {
226 td1
.removeClass('haskids');
227 // swapsign(td1, '+', '.');
228 swapsign(td1
, '+', '|');
231 if (!td1
.hasClass('haskids') && haskids
) {
232 td1
.addClass('haskids');
233 // swapsign(td1, '.', '+');
234 swapsign(td1
, '|', '+');
237 td1
.parent().after('<tr class="outertr"><td colspan="7" id="con' + id +
'" style="padding:0">Loading...</td></tr>');
238 td1
.addClass('isExpanded');
239 swapsign(td1
, '+', '-');
243 $
.getScript('types_ajax.php?id=' + id +
'&order=<?php echo $order; ?>' +
'&labid=<?php echo $labid; ?>');
249 function handleNode(id
, type
, add
, lab
) {
250 var editTitle
= '<i class="fa fa-pencil" style="width:20px;" aria-hidden="true"></i> ' +
'<?php echo xlt("Edit Mode"); ?> ';
251 var addTitle
= '<i class="fa fa-plus" style="width:20px;" aria-hidden="true"></i> ' +
'<?php echo xlt("Add Mode"); ?>';
253 type
= (type
=== 1 && !add
) ?
'fgp' : 'for';
255 let url
= 'types_edit.php?addfav=' + type +
'&labid=' + lab +
'&parent=0&typeid=' + id
;
258 url
= 'types_edit.php?addfav=' + type +
'&labid=' + lab +
'&typeid=0&parent=' + id
;
259 dlgopen(url
, '_blank', 800, 750, false, addTitle
);
261 dlgopen(url
, '_blank', 800, 750, false, editTitle
);
265 // call this to alternate row colors when anything changes the number of rows
268 $
('#con0 tr').each(function(index
) {
269 // skip any row that contains other rows
270 if ($
(this
).hasClass('outertr')) return;
271 this
.className
= (i++
& 1) ?
"evenrow" : "oddrow";
275 // Callback from popups to refresh this display.
276 function refreshme() {
277 // location.reload();
278 document
.forms
[0].submit();
284 <body
class="body_nav">
286 if ($GLOBALS['enable_help'] == 1) {
287 $help_icon = '<a class="oe-pull-away 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>';
288 } elseif ($GLOBALS['enable_help'] == 2) {
289 $help_icon = '<a class="oe-pull-away 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>';
290 } elseif ($GLOBALS['enable_help'] == 0) {
294 <div
class="container">
296 <div
class="col-sm-12">
297 <div
class="page-header clearfix">
298 <h2 id
="header_title" class="clearfix"><span id
='header_text'><?php
echo xlt('Configure Orders and Results');?
></span
><?php
echo $help_icon; ?
></h2
>
303 <div
class="col-sm-12">
304 <form method
='post' name
='theform'
305 action
='types.php?popup=<?php echo $popup ?>&order=<?php
307 if (isset($_GET['formid
'])) {
308 echo '&formid
=' . $_GET['formid
'];
311 if (isset($_GET['formseq
'])) {
312 echo '&formseq
=' . $_GET['formseq
'];
315 <div
class="btn-group">
316 <button type
="button" name
="form_search" class="btn btn-default btn-refresh" onclick
="refreshme()"><?php
echo xlt('Refresh');?
></button
>
317 <button type
="button" class="btn btn-default btn-add" name
='add_node_btn' id
='add_node_button' onclick
='handleNode(0,"","")'><?php
echo xlt('Add Top Level');?
></button
>
321 <div
class = "table-responsive">
322 <table
class="table" style
="margin-bottom:0">
325 <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
>
326 <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
>
327 <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
>
328 <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
>
329 <td
class='col4 oe-pl0' align
='left'><?php
echo xlt('Description') ?
></td
>
330 <td
class='col5 oe-pl0' align
='left'><?php
echo xlt('Edit') ?
></td
>
331 <td
class='col5 oe-pl0' align
='center'><?php
echo xlt('Add') ?
></td
>
336 <div id
="con0"></div
>
337 <?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 ?>
338 <div
class="form-group clearfix">
339 <div
class="col-sm-12 text-left position-override">
340 <div
class="btn-group btn-group-pinch" role
="group">
341 <?php
if ($popup) { ?
>
342 <button type
="submit" class="btn btn-default btn-save" name
='form_save' value
='<?php echo xla('Save
'); ?>'><?php
echo xlt('Save');?
></button
>
343 <button
class="btn btn-link btn-cancel btn-separate-left" onclick
="CancelDistribute()"><?php
echo xlt('Cancel');?
></button
>
351 </div
><!--End of Container div
-->
354 //home of the help modal ;)
355 //$GLOBALS['enable_help'] = 0; // Please comment out line if you want help modal to function on this page
356 if ($GLOBALS['enable_help'] == 1) {
357 echo "<script>var helpFile = 'configure_orders_help.php'</script>";
358 //help_modal.php lives in interface, set path accordingly
359 require "../help_modal.php";
364 $
(document
).ready(function(){
365 //for jquery tooltip to function if jquery 1.12.1.js is called via jquery-ui in the Header::setupHeader
366 // the relevant css file needs to be called i.e. jquery-ui-darkness - to get a black tooltip
367 $
('#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();
368 $
('#order-tooltip').attr( "title", "<?php echo xla('The entries highlighted in yellow can be ordered as a test or procedure those highlighted in pink can be ordered as a Custom Group'); ?>" +
". " +
"<?php echo xla('Click on the blue plus sign under Name to reveal test names'); ?>" ).tooltip();
369 $
('#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')?>.").
371 $
('#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')?>.").
373 $
('table td .required-tooltip').attr( "title", "<?php echo xla('For proper tabulated display of tests and results an identifying code is required'); ?>").tooltip();
374 $
("table td .required-tooltip").fadeIn(500);
375 $
("table td .required-tooltip3").fadeOut(1000);
376 $
("table td .required-tooltip").fadeIn(500);
377 $
(".plusminus").click(function(){
378 $
(".required-tooltip").effect("pulsate", {times
:1}, 4000);