052fa22f9022da0eac76bbd7993b7ff64e93e147
[openemr.git] / interface / reports / report.inc.php
blob052fa22f9022da0eac76bbd7993b7ff64e93e147
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.
25 //
26 // Author: Eldho Chacko <eldho@zhservices.com>
27 // Paul Simon K <paul@zhservices.com>
29 // +------------------------------------------------------------------------------+
31 function stripslashes_deep($value)
33 $value = is_array($value) ? array_map('stripslashes_deep', $value) : strip_escape_custom($value);
34 return $value;
37 //Parses the search value part of the criteria and prepares for sql.
38 function PrepareSearchItem($SearchItem)
40 $SplitArray=split(' like ',$SearchItem);
41 if(isset($SplitArray[1]))
43 $SplitArray[1] = substr($SplitArray[1], 0, -1);
44 $SplitArray[1] = substr($SplitArray[1], 1);
45 $SearchItem=$SplitArray[0].' like '."'".add_escape_custom($SplitArray[1])."'";
47 else
49 $SplitArray=split(' = ',$SearchItem);
50 if(isset($SplitArray[1]))
52 $SplitArray[1] = substr($SplitArray[1], 0, -1);
53 $SplitArray[1] = substr($SplitArray[1], 1);
54 $SearchItem=$SplitArray[0].' = '."'".add_escape_custom($SplitArray[1])."'";
57 return($SearchItem);
60 //Parses the database value and prepares for display.
61 function BuildArrayForReport($Query)
63 $array_data=array();
64 $res = sqlStatement($Query);
65 while($row=sqlFetchArray($res))
67 $array_data[$row['id']]=htmlspecialchars($row['name'],ENT_QUOTES);
69 return $array_data;
72 //The criteria "Insurance Company" is coded here.The ajax one
73 function InsuranceCompanyDisplay()
75 global $ThisPageSearchCriteriaDisplay,$ThisPageSearchCriteriaKey,$ThisPageSearchCriteriaIndex,$web_root;
77 echo '<table width="140" border="0" cellspacing="0" cellpadding="0">'.
78 '<tr>'.
79 '<td width="140" colspan="2">'.
80 '<iframe id="frame_to_hide" style="position:absolute;display:none; width:240px; height:100px" frameborder=0'.
81 'scrolling=no marginwidth=0 src="" marginheight=0>hello</iframe>'.
82 '<input type="hidden" id="hidden_ajax_close_value" value="'.attr($_POST['type_code']).'" /><input name="type_code" id="type_code" class="text "'.
83 'style=" width:140px;" title="'.xla("Type Id or Name.3 characters minimum (including spaces).").'"'.
84 'onfocus="hide_frame_to_hide();appendOptionTextCriteria(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
85 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\','.
86 'document.getElementById(\'type_code\').value,document.getElementById(\'div_insurance_or_patient\').innerHTML,'.
87 '\' = \','.
88 '\'text\')" onblur="show_frame_to_hide()" onKeyDown="PreventIt(event)" value="'.attr($_POST['type_code']).'" autocomplete="off" /><br>'.
89 '<!--onKeyUp="ajaxFunction(event,\'non\',\'search_payments.php\');"-->'.
90 '<div id="ajax_div_insurance_section">'.
91 '<div id="ajax_div_insurance_error"> </div>'.
92 '<div id="ajax_div_insurance" style="display:none;"></div>'.
93 '</div>'.
94 '</div> </td>'.
95 '</tr>'.
96 '<tr height="5"><td colspan="2"></td></tr>'.
97 '<tr>'.
98 '<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>'.
99 '<td><a href="#" onClick="CleanUpAjax(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
100 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\',\' = \')"><img src="'.$web_root.'/interface/pic/Clear.gif" border="0" /></a></td>'.
101 '</tr>'.
102 '</table>'.
103 '<input type="hidden" name="hidden_type_code" id="hidden_type_code" value="'.attr($_POST['hidden_type_code']).'"/>';