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 \********************************************************************************/
20 require_once("../globals.php");
21 require_once("$srcdir/patient.inc");
22 require_once("../../custom/code_types.inc.php");
25 $codetype = $_REQUEST['codetype'];
26 $form_code_type = $_POST['form_code_type'];
30 <?php
html_header_show(); ?
>
31 <title
><?php
xl('Drug Finder','e'); ?
></title
>
32 <link rel
="stylesheet" href
='<?php echo $css_header ?>' type
='text/css'>
35 td
{ font
-size
:10pt
; }
38 <script language
="JavaScript">
39 //pass value selected to the parent window
40 function window_submit(chk
)
44 if (len
==undefined
&& chk
.checked
==1)
53 for (pr
= 0; pr
< chk
.length
; pr++
)
55 if(chk
[pr
].checked
== 1)
60 str
= str+
"#"+chk
[pr
].value
;
65 alert('<?php echo xl("Select Drug");?>');
66 if (opener
.closed ||
! opener
.set_related
)
67 alert("<?php echo xl('The destination form was closed')?>");
69 opener
.set_related(str
,"drugs");
75 function window_close(chk
)
80 function chkbox_select_none(chk
)
83 if (len
==undefined
) {chk
.checked
=false;}
86 for (pr
= 0; pr
< chk
.length
; pr++
)
88 chk
[pr
].checked
=false;
93 function chkbox_select_all(chk
)
96 if (len
==undefined
) {chk
.checked
=true;}
99 for (pr
= 0; pr
< chk
.length
; pr++
)
101 chk
[pr
].checked
=true;
106 function check_search_str()
108 var search_str
= document
.getElementById('search_term').value
;
109 if(search_str
.length
< 3)
111 alert('<?php echo xl("Search string should have at least three characters");?>');
114 top
.restoreSession();
120 <body
class="body_top">
121 <form method
='post' name
='theform' action
='find_drug_popup.php' onsubmit
="return check_search_str();">
123 <input type
="hidden" name
="search_status" id
="search_status" value
=1;>
124 <table border
='0' cellpadding
='5' cellspacing
='0'>
132 <?php
xl('Search for','e'); ?
>
133 <input type
='text' name
='search_term' id
='search_term' size
='12' value
='<?php echo $_REQUEST['search_term
']; ?>'
134 title
='<?php xl('Any part of the drug id
or drug name
','e
'); ?>' />
136 <input type
='submit' name
='bn_search' id
='bn_search' value
='<?php xl('Search
','e
'); ?>' />
147 <form method
='post' name
='select_drug'>
151 <?php
if ($_REQUEST['bn_search'])
153 $search_term = $_REQUEST['search_term'];
155 $query = "SELECT count(*) as count FROM drugs " .
156 "WHERE (drug_id LIKE '%$search_term%' OR " .
157 "name LIKE '%$search_term%') ";
158 $res = sqlStatement($query);
159 if ($row = sqlFetchArray($res))
161 $no_of_items = addslashes($row['count']);
165 <script language
='JavaScript'>
166 alert("<?php echo xl('Search string does not match with list in database'); echo '\n'; echo xl('Please enter new search string');?>");
167 document
.theform
.search_term
.value
=" ";
168 document
.theform
.search_term
.focus();
172 $query = "SELECT drug_id, name FROM drugs " .
173 "WHERE (drug_id LIKE '%$search_term%' OR " .
174 "name LIKE '%$search_term%') " .
176 $res = sqlStatement($query);
178 while ($row = sqlFetchArray($res)) {
179 $row_count = $row_count +
1;
180 $itercode = addslashes($row['drug_id']);
181 $itertext = addslashes(ucfirst(strtolower(trim($row['name']))));
183 <input type
="checkbox" id
="chkbox" name
="chkbox" value
= "<?php echo $itercode."-".$itertext; ?>" > <?php
echo $itercode." ".$itertext."</br>";
192 <input type
='button' name
='select_all' value
='<?php xl('Select All
','e
'); ?>' onclick
="chkbox_select_all(document.select_drug.chkbox);"/>
194 <input type
='button' name
='unselect_all' value
='<?php xl('Unselect All
','e
'); ?>' onclick
="chkbox_select_none(document.select_drug.chkbox);"/>
196 <input type
='button' name
='submit' value
='<?php xl('Submit
','e
'); ?>' onclick
="window_submit(document.select_drug.chkbox);"/>
198 <input type
='button' name
='cancel' value
='<?php xl('Cancel
','e
'); ?>' onclick
="window_close();"/>