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