EOB invoice fixes.
[openemr.git] / interface / de_identification_forms / find_immunization_popup.php
blob297e47b8ba131ca8f1c8e5f19879572383012a43
1 <?php
2 /**
3 * find_immunization_popup.php
5 * @package OpenEMR
6 * @link http://www.open-emr.org
7 * @author Visolve <vicareplus_engg@visolve.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) ViCarePlus, Visolve <vicareplus_engg@visolve.com>
10 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 require_once("../globals.php");
16 require_once("$srcdir/patient.inc");
17 require_once("../../custom/code_types.inc.php");
19 $info_msg = "";
20 $codetype = $_REQUEST['codetype'];
21 $form_code_type = $_POST['form_code_type'];
23 <html>
24 <head>
25 <?php html_header_show(); ?>
26 <title><?php echo xlt('Immunization'); ?></title>
27 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
28 <style>
29 td { font-size:10pt; }
30 </style>
31 <script language="JavaScript">
32 //pass value selected to the parent window
33 function window_submit(chk)
35 var str;
36 var len=chk.length;
37 if (len==undefined && chk.checked==1)
39 if(!str)
40 str = chk.value;
41 else
42 str = "#"+chk.value;
44 else
46 for (pr = 0; pr < chk.length; pr++)
48 if(chk[pr].checked == 1)
50 if(!str)
51 str = chk[pr].value;
52 else
53 str = str+"#"+chk[pr].value;
57 if(!str)
58 alert('<?php echo xls("Select Immunizations");?>');
59 if (opener.closed || ! opener.set_related)
60 alert("<?php echo xls('The destination form was closed');?>");
61 else
62 opener.set_related(str,"immunizations");
64 window.close();
68 function window_close(chk)
70 window.close();
73 function chkbox_select_none(chk)
75 var len=chk.length;
76 if (len==undefined) {chk.checked=false;}
77 else
79 for (pr = 0; pr < chk.length; pr++)
81 chk[pr].checked=false;
86 function chkbox_select_all(chk)
88 var len=chk.length;
89 if (len==undefined) {chk.checked=true;}
90 else
92 for (pr = 0; pr < chk.length; pr++)
94 chk[pr].checked=true;
99 function check_search_str()
101 var search_str = document.getElementById('search_term').value;
102 if(search_str.length < 3)
104 alert('<?php echo xls("Search string should have at least three characters");?>');
105 return false;
107 top.restoreSession();
108 return true;
110 </script>
111 </head>
112 <body class="body_top">
113 <form method='post' name='theform' action='find_immunization_popup.php' onsubmit="return check_search_str();">
114 <input type="hidden" name="csrf_token_form" value="<?php echo attr(collectCsrfToken()); ?>" />
116 <center>
117 <table border='0' cellpadding='5' cellspacing='0'>
118 <tr>
119 <td height="1">
120 </td>
121 </tr>
122 <tr>
123 <td>
125 <?php echo xlt('Search for'); ?>
126 <input type='text' name='search_term' id='search_term' size='12' value='<?php echo attr($_REQUEST['search_term']); ?>'
127 title='<?php echo xla('Any part of the immunization id or immunization name'); ?>' />
128 &nbsp;
129 <input type='submit' name='bn_search' value='<?php echo xla('Search'); ?>' />
130 </b>
131 </td>
132 </tr>
133 <tr>
134 <td height="1">
135 </td>
136 </tr>
137 </table>
138 </center>
139 </form>
140 <form method='post' name='select_immunization'>
141 <?php if ($_REQUEST['bn_search']) { ?>
142 <?php
143 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
144 die(xlt('Authentication Error'));
148 <table border='0'>
149 <tr>
150 <td colspan="4">
151 <?php
152 $search_term = $_REQUEST['search_term'];
154 $query = "SELECT count(*) as count FROM list_options " .
155 "WHERE (list_id = 'immunizations' and title LIKE ? AND activity = 1) " ;
156 $res = sqlStatement($query, array('%'.$search_term.'%'));
157 if ($row = sqlFetchArray($res)) {
158 $no_of_items = $row['count'];
159 if ($no_of_items < 1) {
161 <script language='JavaScript'>
162 alert("<?php echo xls('Search string does not match with list in database');
163 echo '\n';
164 echo xls('Please enter new search string');?>");
165 document.theform.search_term.value=" ";
166 document.theform.search_term.focus();
167 </script>
168 <?php
171 $query = "SELECT option_id,title FROM list_options " .
172 "WHERE (list_id = 'immunizations' and title LIKE ? AND activity = 1) " .
173 "ORDER BY title";
174 $res = sqlStatement($query, array('%'.$search_term.'%'));
175 $row_count = 0;
176 while ($row = sqlFetchArray($res)) {
177 $row_count = $row_count + 1;
178 $itercode = $row['option_id'];
179 $itertext = ucfirst(strtolower(trim($row['title'])));
181 <input type="checkbox" id="chkbox" value= "<?php echo attr($itercode) . "-" . attr($itertext); ?>" > <?php echo text($itercode) . " " . text($itertext) . "</br>";
187 </td>
188 </tr>
189 </table>
190 <center>
191 <input type='button' name='select_all' value='<?php echo xla('Select All'); ?>' onclick="chkbox_select_all(document.select_immunization.chkbox);"/>
193 <input type='button' name='select_none' value='<?php echo xla('Unselect All'); ?>' onclick="chkbox_select_none(document.select_immunization.chkbox);"/>
195 <input type='button' name='submit' value='<?php echo xla('Submit'); ?>' onclick="window_submit(document.select_immunization.chkbox);"/>
197 <input type='button' name='cancel' value='<?php echo xla('Cancel'); ?>' onclick="window_close();"/>
199 </center>
200 <?php } ?>
201 </form>
202 </body>
203 </html>