Fee sheet enhancements
[openemr.git] / interface / forms / fee_sheet / review / fee_sheet_search_ajax.php
blobba051d3347140500053d1277d71490b59a1266ec
1 <?php
2 /**
3 * Controller for AJAX requests to search for codes from the fee sheet
4 *
5 * Copyright (C) 2013 Kevin Yeh <kevin.y@integralemr.com> and OEMR <www.oemr.org>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * 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, see <http://opensource.org/licenses/gpl-license.php>;.
18 * @package OpenEMR
19 * @author Kevin Yeh <kevin.y@integralemr.com>
20 * @link http://www.open-emr.org
22 $fake_register_globals=false;
23 $sanitize_all_escapes=true;
24 require_once("../../../globals.php");
25 require_once("fee_sheet_classes.php");
26 require_once("fee_sheet_search_queries.php");
27 include_once("$srcdir/jsonwrapper/jsonwrapper.php");
29 if(!acl_check('acct', 'bill'))
31 header("HTTP/1.0 403 Forbidden");
32 echo "Not authorized for billing";
33 return false;
36 if(isset($_REQUEST['search_query']))
38 $search_query=$_REQUEST['search_query'];
40 else
42 header("HTTP/1.0 403 Forbidden");
43 echo "No search parameter specified";
44 return false;
46 if(isset($_REQUEST['search_type']))
48 $search_type=$_REQUEST['search_type'];
50 else
52 $search_type='ICD9';
54 if(isset($_REQUEST['search_type_id']))
56 $search_type_id=$_REQUEST['search_type_id'];
58 else
60 $search_type_id=2;
62 $retval['codes']=diagnosis_search($search_type_id,$search_type,$search_query);
64 echo json_encode($retval);