minor changes to prior commit
[openemr.git] / interface / reports / report.inc.php
blob72070cb96c70f15e0022751e0f0fa1e423fa04f9
1 <?php
2 // +-----------------------------------------------------------------------------+
3 //
4 // Common php functions are stored in this page.
5 //
6 // Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
7 //
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License
11 // as published by the Free Software Foundation; either version 2
12 // of the License, or (at your option) any later version.
15 // This program is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
21 // A copy of the GNU General Public License is included along with this program:
22 // openemr/interface/login/GnuGPL.html
23 // For more information write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 // Author: Eldho Chacko <eldho@zhservices.com>
27 // Paul Simon K <paul@zhservices.com>
29 // +------------------------------------------------------------------------------+
31 //Parses the search value part of the criteria and prepares for sql.
32 function PrepareSearchItem($SearchItem)
34 $SplitArray=explode(' like ', $SearchItem);
35 if (isset($SplitArray[1])) {
36 $SplitArray[1] = substr($SplitArray[1], 0, -1);
37 $SplitArray[1] = substr($SplitArray[1], 1);
38 $SearchItem=$SplitArray[0].' like '."'".add_escape_custom($SplitArray[1])."'";
39 } else {
40 $SplitArray=explode(' = ', $SearchItem);
41 if (isset($SplitArray[1])) {
42 $SplitArray[1] = substr($SplitArray[1], 0, -1);
43 $SplitArray[1] = substr($SplitArray[1], 1);
44 $SearchItem=$SplitArray[0].' = '."'".add_escape_custom($SplitArray[1])."'";
48 return($SearchItem);
51 //Parses the database value and prepares for display.
52 function BuildArrayForReport($Query)
54 $array_data=array();
55 $res = sqlStatement($Query);
56 while ($row=sqlFetchArray($res)) {
57 $array_data[$row['id']]=htmlspecialchars($row['name'], ENT_QUOTES);
60 return $array_data;
63 //The criteria "Insurance Company" is coded here.The ajax one
64 function InsuranceCompanyDisplay()
66 global $ThisPageSearchCriteriaDisplay,$ThisPageSearchCriteriaKey,$ThisPageSearchCriteriaIndex,$web_root;
68 echo '<table width="140" border="0" cellspacing="0" cellpadding="0">'.
69 '<tr>'.
70 '<td width="140" colspan="2">'.
71 '<iframe id="frame_to_hide" style="position:absolute;display:none; width:240px; height:100px" frameborder=0'.
72 'scrolling=no marginwidth=0 src="" marginheight=0>hello</iframe>'.
73 '<input type="hidden" id="hidden_ajax_close_value" value="'.attr($_POST['type_code']).'" /><input name="type_code" id="type_code" class="text "'.
74 'style=" width:140px;" title="'.xla("Type Id or Name.3 characters minimum (including spaces).").'"'.
75 'onfocus="hide_frame_to_hide();appendOptionTextCriteria(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
76 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\','.
77 'document.getElementById(\'type_code\').value,document.getElementById(\'div_insurance_or_patient\').innerHTML,'.
78 '\' = \','.
79 '\'text\')" onblur="show_frame_to_hide()" onKeyDown="PreventIt(event)" value="'.attr($_POST['type_code']).'" autocomplete="off" /><br>'.
80 '<!--onKeyUp="ajaxFunction(event,\'non\',\'search_payments.php\');"-->'.
81 '<div id="ajax_div_insurance_section">'.
82 '<div id="ajax_div_insurance_error"> </div>'.
83 '<div id="ajax_div_insurance" style="display:none;"></div>'.
84 '</div>'.
85 '</div> </td>'.
86 '</tr>'.
87 '<tr height="5"><td colspan="2"></td></tr>'.
88 '<tr>'.
89 '<td><div name="div_insurance_or_patient" id="div_insurance_or_patient" class="text" style="border:1px solid black; padding-left:5px; width:50px; height:17px;">'.attr($_POST['hidden_type_code']).'</div><input type="hidden" name="description" id="description" /></td>'.
90 '<td><a href="#" onClick="CleanUpAjax(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
91 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\',\' = \')"><img src="'.$web_root.'/interface/pic/Clear.gif" border="0" /></a></td>'.
92 '</tr>'.
93 '</table>'.
94 '<input type="hidden" name="hidden_type_code" id="hidden_type_code" value="'.attr($_POST['hidden_type_code']).'"/>';