7 * @link http://www.open-emr.org
8 * @author Rod Roark <rod@sunsetsystems.com>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2010-2012 Rod Roark <rod@sunsetsystems.com>
11 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
17 $id = (isset($_GET['id']) ?
$_GET['id'] : '') +
0;
18 $order = (isset($_GET['order']) ?
$_GET['order'] : '') +
0;
19 $labid = (isset($_GET['labid']) ?
$_GET['labid'] : '') +
0;
23 $render .= "<table class=\"table\">";
24 // Determine indentation level for this container.
25 for ($level = 0, $parentid = $id; $parentid; ++
$level) {
26 $row = sqlQuery("SELECT parent FROM procedure_type WHERE procedure_type_id = ?", [$parentid]);
27 $parentid = $row['parent'] +
0;
30 $res = sqlStatement("SELECT * FROM procedure_type WHERE parent = ? " .
31 "ORDER BY seq, name, procedure_type_id", [$id]);
35 // Generate a table row for each immediate child.
36 while ($row = sqlFetchArray($res)) {
37 $chid = $row['procedure_type_id'] +
0;
38 $isOrder = substr($row['procedure_type'], 0, 3);
40 // Find out if this child has any children.
41 $trow = sqlQuery("SELECT procedure_type_id FROM procedure_type WHERE parent = ? LIMIT 1", [$chid]);
42 $iscontainer = !empty($trow['procedure_type_id']);
46 $classes .= ' haskids';
48 // for proper indentation
49 if (($isOrder == 'grp' ||
$isOrder == 'fgp') && $row['parent'] == 0) {
50 $classes .= ' oe-grp';
51 $classes .= ' oe-pl' . ($level * 10) ;
52 } elseif (($isOrder == 'grp' ||
$isOrder == 'fgp') && $row['parent'] != 0) {
53 $classes .= ' oe-bold';
54 $classes .= ' oe-pl' . ($level * 10) ;
55 } elseif ($isOrder == 'ord' ||
$isOrder == 'for') {
56 $classes .= ' oe-ord';
57 $classes .= ' oe-pl' . ($level * 10) ;
59 $classes .= ' oe-pl' . ($level * 10) ;
63 $render .= "<td id=\"td" . attr($chid) . "\"";
64 $render .= " onclick=\"toggle(" . attr_js($chid) . ")\"";
65 $render .= " class=\"" . attr($classes) . "\">";
66 $render .= "<span style=\"margin: 0 4 0 " . round(($level * 9) * 1.3333) . "px\" class=\"plusminus\">";
67 $render .= "<span class=\"plusminus\">";
68 $render .= $iscontainer ?
"+ " : '| ';
70 if ($isOrder == 'ord') {
71 $render .= "<mark class=\"oe-patient-background\">" . text($row['name']) . "</mark></td>";
72 } elseif ($isOrder == 'for') {
73 $render .= "<mark class=\"oe-pink-background\">" . text($row['name']) . "</mark></td>";
75 $render .= text($row['name']) . "</td>";
78 $render .= "<td class=\"col2\">";
79 if ($isOrder == 'ord' ||
$isOrder == 'for') {
80 if ($order && ($labid == 0 ||
$row['lab_id'] == $labid)) {
81 $render .= "<input type=\"radio\" name=\"form_order\" value=\"" . attr($chid) . "\"";
82 if ($chid == $order) {
83 $render .= " checked";
88 if ($isOrder == 'ord') {
89 $render .= "<mark class=\"oe-patient-background\">" . xlt('Order') . "</mark>";
90 } elseif ($isOrder == 'for') {
91 $render .= "<mark class=\"oe-pink-background\">" . xlt('Custom Order') . "</mark>";
95 //$render .= ' ';
96 if ($isOrder == 'grp' && $row['parent'] == 0) {
97 $render .= xlt('Top Group');
98 } elseif ($isOrder == 'fgp' && $row['parent'] == 0) {
99 $render .= "<mark class=\"oe-pink-background\">" . xlt('Custom Top Group') . "</mark>";
100 } elseif ($isOrder == 'grp') {
101 $render .= xlt('Sub Group');
102 } elseif ($isOrder == 'fgp') {
103 $render .= "<mark class=\"oe-pink-background\">" . xlt('Custom Sub Group') . "</mark>";
104 } elseif ($isOrder == 'res') {
105 $render .= xlt('Result');
106 } elseif ($isOrder == 'rec') {
107 $render .= xlt('Recommendation');
112 if (($isOrder != 'grp' && $isOrder != 'fgp') && !empty($row['procedure_code'])) {
113 $render .= "<td class=\"col3\">" . text($row['procedure_code']) . "</td>";
114 } elseif (($isOrder != 'grp' && $isOrder != 'fgp') && empty($row['procedure_code'])) {
115 $render .= "<td class=\"col3\" style=\"padding-left: 15px\"><span class=\"required-tooltip\" title=\"" .
116 xla("Missing Identifying Code") .
117 "\"><i class=\"fa fa-exclamation-triangle text-center text-danger\" aria-hidden=\"true\" ></i></span></td>";
118 } elseif ($isOrder == 'grp' ||
$isOrder == 'fgp') {
119 $render .= "<td class=\"col3\">" . text($row['procedure_code']) . "</td>";
122 $thislab = $row['lab_id'] ?
$row['lab_id'] +
0 : 0;
123 if ($isOrder == 'fgp') {
125 } elseif ($isOrder == 'for') {
128 $render .= "<td class=\"col6\">" . text($level +
1) . "</td>";
129 $render .= "<td class=\"col4\">" . text($row['description']) . "</td>";
130 $render .= "<td class=\"col5\">";
131 $render .= "<span onclick=\"handleNode(" . attr_js($chid) . "," .
132 attr_js($typeIs) . ",false," . attr_js($thislab) .
133 ")\" class=\"text-body haskids fa fa-pencil-alt fa-lg\" title=" . xla("Edit") . "></span>";
135 $render .= "<td class=\"col5\">";
136 //if ($isOrder != 'for') {//RP_MODIFIED 2018-08-03 to allow for manual lab entry
137 $render .= "<span style=\"margin-left: 30px\" onclick=\"handleNode(" .
138 attr_js($chid) . "," . attr_js($typeIs) . ",true," . attr_js($thislab) .
139 ")\" class=\"haskids text-body fa fa-plus fa-lg\" title=" . xla("Add") . " ></span>";
140 //}//RP_MODIFIED 2018-08-03
145 $render .= "</table>\n";
146 $rendered = "$('#con" . attr($id) . "').html(";
147 $rendered .= js_escape($render) . ");";
148 $rendered .= "nextOpen();\n";