Skip to content

Commit

Permalink
Auto suggest for lot number in the immunization form
Browse files Browse the repository at this point in the history
Signed-off-by: Sherwin Gaddis <[email protected]>
  • Loading branch information
juggernautsei authored and bradymiller committed Jan 4, 2017
1 parent 55872bd commit 19e733e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 4 deletions.
18 changes: 14 additions & 4 deletions interface/patient_file/summary/immunizations.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ function saveImmunizationObservationResults($id,$immunizationdata)
<?php html_header_show();?>

<!-- supporting javascript code -->
<script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script>
<script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/textformat.js"></script>
<script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>

<script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-9-1/index.js"></script>
<script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-ui-1-10-4/ui/jquery-ui.js"></script>

<!-- page styles -->
<link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">

<link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-ui-1-10-4/themes/base/jquery-ui.min.css" type="text/css" />
<style>
.highlight {
color: green;
Expand Down Expand Up @@ -429,7 +429,7 @@ function saveImmunizationObservationResults($id,$immunizationdata)
<span class=text>
<?php echo htmlspecialchars( xl('Immunization Lot Number'), ENT_NOQUOTES); ?> </span> </td>
<td>
<input class='text' type='text' name="lot_number" size="25" value="<?php echo htmlspecialchars( $lot_number, ENT_QUOTES); ?>"> </td>
<input class='text auto' type='text' name="lot_number" size="25" value="<?php echo htmlspecialchars( $lot_number, ENT_QUOTES); ?>"> </td>
</tr>
<tr>
<td align="right">
Expand Down Expand Up @@ -1141,6 +1141,16 @@ function sel_code(id)
$('#clickId').val(checkId);
dlgopen('<?php echo $GLOBALS['webroot'] . "/interface/patient_file/encounter/" ?>find_code_popup.php', '_blank', 700, 400);
}

$(function() {

//autocomplete
$(".auto").autocomplete({
source: "../../../library/ajax/imm_autocomplete/search.php",
minLength: 1
});

});
</script>

</html>
54 changes: 54 additions & 0 deletions library/ajax/imm_autocomplete/search.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/** Copyright (C) 2016 Sherwin Gaddis <[email protected]>
*
* LICENSE: This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http:https://opensource.org/licenses/gpl-license.php>;.
*
* @package OpenEMR
* Sherwin Gaddis <[email protected]>
* @link http:https://www.open-emr.org
*/

//SANITIZE ALL ESCAPES
$sanitize_all_escapes=true;
//

//STOP FAKE REGISTER GLOBALS
$fake_register_globals=false;
//
require_once('../../../interface/globals.php');


if (isset($_GET['term'])){
$term = $_GET['term'];
$return_arr = array();

try {
$sql = "SELECT DISTINCT lot_number FROM immunizations WHERE lot_number LIKE ? ";

$res = sqlstatement($sql,"%".$term."%");
while($row = sqlFetchArray($res)){
$return_arr[] = $row['lot_number'] ;
}


catch(Excption $e) {
echo 'ERROR: ' . $e->getMessage(), "\n";
}


/* Toss back results as json encoded array. */
echo json_encode($return_arr);
}


?>

0 comments on commit 19e733e

Please sign in to comment.