ongoing internationalization of date widget
[openemr.git] / interface / reports / report.inc.php
bloba91b5bacf8aec71665ff4501213a678023bb1561
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=explode(' like ', $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].' like '."'".add_escape_custom($SplitArray[1])."'";
45 } else {
46 $SplitArray=explode(' = ', $SearchItem);
47 if (isset($SplitArray[1])) {
48 $SplitArray[1] = substr($SplitArray[1], 0, -1);
49 $SplitArray[1] = substr($SplitArray[1], 1);
50 $SearchItem=$SplitArray[0].' = '."'".add_escape_custom($SplitArray[1])."'";
54 return($SearchItem);
57 //Parses the database value and prepares for display.
58 function BuildArrayForReport($Query)
60 $array_data=array();
61 $res = sqlStatement($Query);
62 while ($row=sqlFetchArray($res)) {
63 $array_data[$row['id']]=htmlspecialchars($row['name'], ENT_QUOTES);
66 return $array_data;
69 //The criteria "Insurance Company" is coded here.The ajax one
70 function InsuranceCompanyDisplay()
72 global $ThisPageSearchCriteriaDisplay,$ThisPageSearchCriteriaKey,$ThisPageSearchCriteriaIndex,$web_root;
74 echo '<table width="140" border="0" cellspacing="0" cellpadding="0">'.
75 '<tr>'.
76 '<td width="140" colspan="2">'.
77 '<iframe id="frame_to_hide" style="position:absolute;display:none; width:240px; height:100px" frameborder=0'.
78 'scrolling=no marginwidth=0 src="" marginheight=0>hello</iframe>'.
79 '<input type="hidden" id="hidden_ajax_close_value" value="'.attr($_POST['type_code']).'" /><input name="type_code" id="type_code" class="text "'.
80 'style=" width:140px;" title="'.xla("Type Id or Name.3 characters minimum (including spaces).").'"'.
81 'onfocus="hide_frame_to_hide();appendOptionTextCriteria(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
82 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\','.
83 'document.getElementById(\'type_code\').value,document.getElementById(\'div_insurance_or_patient\').innerHTML,'.
84 '\' = \','.
85 '\'text\')" onblur="show_frame_to_hide()" onKeyDown="PreventIt(event)" value="'.attr($_POST['type_code']).'" autocomplete="off" /><br>'.
86 '<!--onKeyUp="ajaxFunction(event,\'non\',\'search_payments.php\');"-->'.
87 '<div id="ajax_div_insurance_section">'.
88 '<div id="ajax_div_insurance_error"> </div>'.
89 '<div id="ajax_div_insurance" style="display:none;"></div>'.
90 '</div>'.
91 '</div> </td>'.
92 '</tr>'.
93 '<tr height="5"><td colspan="2"></td></tr>'.
94 '<tr>'.
95 '<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>'.
96 '<td><a href="#" onClick="CleanUpAjax(\''.$ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex].'\','.
97 '\''.$ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'\',\' = \')"><img src="'.$web_root.'/interface/pic/Clear.gif" border="0" /></a></td>'.
98 '</tr>'.
99 '</table>'.
100 '<input type="hidden" name="hidden_type_code" id="hidden_type_code" value="'.attr($_POST['hidden_type_code']).'"/>';