2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
5 * 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. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 \********************************************************************************/
19 require_once("../globals.php");
20 require_once("$srcdir/patient.inc");
21 require_once("../../custom/code_types.inc.php");
24 $codetype = $_REQUEST['codetype'];
25 $form_code_type = $_POST['form_code_type'];
29 <?php
html_header_show(); ?
>
30 <title
><?php
xl('Code Finder','e'); ?
></title
>
31 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
34 td
{ font
-size
:10pt
; }
37 <script language
="JavaScript">
38 //pass value selected to the parent window
39 function window_submit(chk
)
43 if (len
==undefined
&& chk
.checked
==1)
52 for (pr
= 0; pr
< chk
.length
; pr++
)
54 if(chk
[pr
].checked
== 1)
59 str
= str+
"#"+chk
[pr
].value
;
64 alert('<?php echo xl("Select Diagnosis");?>');
65 if (opener
.closed ||
! opener
.set_related
)
66 alert("<?php echo xl('The destination form was closed');?>");
68 opener
.set_related(str
,"diagnosis");
74 function window_close(chk
)
79 function chkbox_select_none(chk
)
82 if (len
==undefined
) {chk
.checked
=false;}
85 for (pr
= 0; pr
< chk
.length
; pr++
)
87 chk
[pr
].checked
=false;
92 function chkbox_select_all(chk
)
95 if (len
==undefined
) {chk
.checked
=true;}
98 for (pr
= 0; pr
< chk
.length
; pr++
)
100 chk
[pr
].checked
=true;
105 function check_search_str()
107 var search_str
= document
.getElementById('search_term').value
;
108 if(search_str
.length
< 3)
110 alert('<?php echo xl("Search string should have at least three characters");?>');
113 top
.restoreSession();
119 <body
class="body_top">
120 <form method
='post' name
='theform' action
='find_code_popup.php' onsubmit
="return check_search_str();">
122 <input type
="hidden" name
="search_status" id
="search_status" value
=1;>
123 <table border
='0' cellpadding
='5' cellspacing
='0'>
133 echo "<input type='text' name='form_code_type' value='$codetype' size='5' readonly>\n";
136 echo " <select name='form_code_type'";
138 foreach ($code_types as $key => $value) {
139 echo " <option value='$key'";
140 if ($codetype == $key ||
$form_code_type == $key) echo " selected";
141 echo ">$key</option>\n";
143 echo " <option value='PROD'";
144 if ($codetype == 'PROD' ||
$form_code_type == 'PROD') echo " selected";
145 echo ">Product</option>\n";
146 echo " </select> \n";
149 <?php
xl('Search for','e'); ?
>
150 <input type
='text' name
='search_term' id
='search_term' size
='12' value
='<?php echo $_REQUEST['search_term
']; ?>'
151 title
='<?php xl('Any part of the desired code
or its description
','e
'); ?>' />
153 <input type
='submit' name
='bn_search' id
='bn_search' value
='<?php xl('Search
','e
'); ?>' />
164 <form method
='post' name
='select_diagonsis'>
168 <?php
if ($_REQUEST['bn_search'])
170 $search_term = $_REQUEST['search_term'];
171 if ($form_code_type == 'PROD') {
172 $query = "SELECT dt.drug_id, dt.selector, d.name " .
173 "FROM drug_templates AS dt, drugs AS d WHERE " .
174 "( d.name LIKE '%$search_term%' OR " .
175 "dt.selector LIKE '%$search_term%' ) " .
176 "AND d.drug_id = dt.drug_id " .
177 "ORDER BY d.name, dt.selector, dt.drug_id";
178 $res = sqlStatement($query);
180 while ($row = sqlFetchArray($res)) {
181 $row_count = $row_count +
1;
182 $drug_id = addslashes($row['drug_id']);
183 $selector = addslashes($row['selector']);
184 $desc = addslashes($row['name']);
186 <input type
="checkbox" name
="diagnosis[row_count]" value
= "<?php echo $desc; ?>" > <?php
echo $drug_id." ".$selector." ".$desc."</br>";
190 $query = "SELECT count(*) as count FROM codes " .
191 "WHERE (code_text LIKE '%$search_term%' OR " .
192 "code LIKE '%$search_term%') " ;
193 $res = sqlStatement($query);
194 if ($row = sqlFetchArray($res))
196 $no_of_items = addslashes($row['count']);
200 <script language
='JavaScript'>
201 alert("<?php echo xl('Search string does not match with list in database'); echo '\n'; echo xl('Please enter new search string');?>");
202 document
.theform
.search_term
.value
=" ";
203 document
.theform
.search_term
.focus();
207 $query = "SELECT code_type, code, modifier, code_text FROM codes " .
208 "WHERE (code_text LIKE '%$search_term%' OR " .
209 "code LIKE '%$search_term%') " .
211 // echo "\n<!-- $query -->\n"; // debugging
212 $res = sqlStatement($query);
214 while ($row = sqlFetchArray($res)) {
215 $row_count = $row_count +
1;
216 $itercode = addslashes($row['code']);
217 $itertext = addslashes(ucfirst(strtolower(trim($row['code_text']))));
219 <input type
="checkbox" id
="chkbox" value
= "<?php echo $form_code_type.":".$itercode."-".$itertext; ?>" > <?php
echo $itercode." ".$itertext."</br>";
229 <input type
='button' id
='select_all' value
='<?php xl('Select All
','e
'); ?>' onclick
="chkbox_select_all(document.select_diagonsis.chkbox);"/>
231 <input type
='button' id
='unselect_all' value
='<?php xl('Unselect All
','e
'); ?>' onclick
="chkbox_select_none(document.select_diagonsis.chkbox);"/>
233 <input type
='button' id
='submit' value
='<?php xl('Submit
','e
'); ?>' onclick
="window_submit(document.select_diagonsis.chkbox);"/>
235 <input type
='button' id
='cancel' value
='<?php xl('Cancel
','e
'); ?>' onclick
="window_close();"/>