LBF custom template (nation notes) fancybox replace.
[openemr.git] / interface / reports / criteria.tab.php
blob6b28c36aa9f83deaeb05b8f3de629405d6bb1862
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.
23 // Author: Eldho Chacko <eldho@zhservices.com>
24 // Paul Simon K <paul@zhservices.com>
26 // +------------------------------------------------------------------------------+
28 <!-- This displays the search criteria.The master processing is done here.This page is included in the billing_report.php -->
29 <style>
30 .criteria_class1{width:125px;}
31 .criteria_class2{padding-left:5px;}
32 </style>
33 <?php
34 $ThisPageSearchCriteriaKey=array();
35 $ThisPageSearchCriteriaDataType=array();
36 $ThisPageSearchCriteriaDisplay=array();
38 $ThisPageSearchCriteriaRadioKey=array();
39 $ThisPageSearchCriteriaDisplayRadio=array();
41 $ThisPageSearchCriteriaQueryDropDown=array();
42 $ThisPageSearchCriteriaQueryDropDownDefault=array();
43 $ThisPageSearchCriteriaQueryDropDownDefaultKey=array();
45 $ThisPageSearchCriteriaInclude=array();
46 //Filling the input array.
47 $ThisPageSearchCriteriaDisplay=$ThisPageSearchCriteriaDisplayMaster;
48 $ThisPageSearchCriteriaKey=explode(',', $ThisPageSearchCriteriaKeyMaster);
49 $ThisPageSearchCriteriaDataType=explode(',', $ThisPageSearchCriteriaDataTypeMaster);
50 //--------------------------------------------------------------
51 //Filling the input array.
52 $NumberOfRadioThisPageSearchCriteria=0;
53 $NumberOfQueryDropDownThisPageSearchCriteria=0;
54 $NumberOfIncludeThisPageSearchCriteria=0;
55 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaDataType); $ThisPageSearchCriteriaIndex++) {
56 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' || $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
57 $NumberOfRadioThisPageSearchCriteria++;
58 $ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]=$ThisPageSearchCriteriaDisplayRadioMaster[$NumberOfRadioThisPageSearchCriteria];
59 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex]=explode(',', $ThisPageSearchCriteriaRadioKeyMaster[$NumberOfRadioThisPageSearchCriteria]);
62 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
63 $NumberOfQueryDropDownThisPageSearchCriteria++;
64 $ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]=$NumberOfQueryDropDownThisPageSearchCriteria;
65 $ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]=
66 $ThisPageSearchCriteriaQueryDropDownMasterDefault[$NumberOfQueryDropDownThisPageSearchCriteria];
67 $ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]=
68 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[$NumberOfQueryDropDownThisPageSearchCriteria];
71 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
72 $NumberOfIncludeThisPageSearchCriteria++;
73 $ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]=$NumberOfIncludeThisPageSearchCriteria;
77 //------------------------------------------------------------------------------
79 <table width="560" border="0" cellspacing="0" cellpadding="0" >
80 <tr>
81 <td><fieldset style="border-color:#000000; border-width:1px;padding-left:5px;padding-right:0px;padding-top:0px;padding-bottom:0px;" >
82 <legend class='text'><b><?php echo htmlspecialchars(xl('Choose Criteria'), ENT_QUOTES) ?></b></legend>
83 <table width="290" border="0" cellspacing="0" cellpadding="0">
84 <tr>
85 <td class='text'><?php echo htmlspecialchars(xl('Criteria'), ENT_QUOTES) ?></td>
86 <td ></td>
87 </tr>
88 <tr>
89 <td width="140" >
90 <select name="choose_this_page_criteria" id="choose_this_page_criteria" title="Choose Criteria"
91 class="text" style="width:140px;" onChange="CriteriaVisible()" size='8' >
92 <?php
93 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
94 $optionValue = $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];
95 echo "<option value='".attr($optionValue)."'";
96 $optionLabel = $ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex];
97 echo ">".text($optionLabel)."</option>\n";
100 </select>
101 </td>
102 <td width="150" valign="top">
103 <!-- Below section comes as per the defined criteria arrays.Initially all are hidden.As per the click the corresponding items gets visible. -->
104 <?php
105 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
106 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='date' ||
107 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='datetime') {
108 $DateNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
110 <table width="150" border="0" cellspacing="0" cellpadding="0"
111 id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
112 <tr>
113 <td class='text criteria_class2' ><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></td>
114 </tr>
115 <tr>
116 <td width="150" class='text criteria_class2' >
117 <?php
118 echo generate_select_list(
119 "date_master_criteria_$DateNamePart",
120 "date_master_criteria",
121 $_REQUEST["date_master_criteria_$DateNamePart"],
122 "Date Criteria",
124 "text criteria_class1",
125 'calendar_function(this.value,"master_from_date_'.$DateNamePart.'","master_to_date_'.$DateNamePart.'");
126 appendOptionDateCriteria("'.attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]).'","'.
127 $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'",this.options[this.selectedIndex].text,'.
128 'this.options[this.selectedIndex].value," = ","master_from_date_'.$DateNamePart.'","master_to_date_'.$DateNamePart.'",
129 "'.$ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex].'")'
132 </td>
133 </tr>
134 <tr>
135 <td class='text' align="right" style="padding-right:5px;padding-bottom:2px;padding-top:2px">
136 <?php echo htmlspecialchars(xl('From'), ENT_QUOTES).':' ?><input type='text' size='7'
137 name='master_from_date_<?php echo $DateNamePart;?>'
138 id='master_from_date_<?php echo $DateNamePart;?>' class="text datepicker"
139 value="<?php echo attr($_REQUEST["master_from_date_$DateNamePart"]) ?>"
140 onChange="SetDateCriteriaCustom('date_master_criteria_<?php echo $DateNamePart;?>');
141 appendOptionDateCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>',
142 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];?>',
143 '<?php echo htmlspecialchars(xl('Custom'), ENT_QUOTES); ?>',
144 '<?php echo htmlspecialchars(xl('Custom'), ENT_QUOTES); ?>',
145 ' = ','master_from_date_<?php echo $DateNamePart;?>','master_to_date_<?php echo $DateNamePart;?>',
146 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />&nbsp;
147 </td>
148 </tr>
149 <tr>
150 <td class='text' align="right" style="padding-right:5px">
151 <?php echo htmlspecialchars(xl('To'), ENT_QUOTES).':' ?><input type='text' size='7'
152 name='master_to_date_<?php echo $DateNamePart;?>'
153 id='master_to_date_<?php echo $DateNamePart;?>' class="text datepicker"
154 value="<?php echo attr($_REQUEST["master_to_date_$DateNamePart"]) ?>"
155 onChange="SetDateCriteriaCustom('date_master_criteria_<?php echo $DateNamePart;?>');
156 appendOptionDateCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>',
157 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];?>',
158 '<?php echo htmlspecialchars(xl('Custom'), ENT_QUOTES); ?>',
159 '<?php echo htmlspecialchars(xl('Custom'), ENT_QUOTES); ?>',
160 ' = ','master_from_date_<?php echo $DateNamePart;?>','master_to_date_<?php echo $DateNamePart;?>',
161 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />&nbsp;
162 </td>
163 </tr>
164 </table>
165 <?php
168 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
169 $array_query_drop_down=BuildArrayForReport($ThisPageSearchCriteriaQueryDropDownMaster[$ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]]);
170 $QueryDropDownNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
172 <table width="150" border="0" cellspacing="0" cellpadding="0"
173 id="table_<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>" style="display:none">
174 <tr>
175 <td class='text criteria_class2' ><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></td>
176 </tr>
177 <tr>
178 <td width="150" class='text criteria_class2' >
180 <select style="width:140px;" name="query_drop_down_master_<?php echo $QueryDropDownNamePart;?>"
181 id="query_drop_down_master_<?php echo $QueryDropDownNamePart;?>" onchange="appendOptionRadioCriteria(
182 '<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
183 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.options[this.selectedIndex].text,
184 this.options[this.selectedIndex].value,' = ',
185 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')">
187 <option value="<?php echo attr($ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]) ?>"
188 ><?php echo text($ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]) ?></option>
190 <?php
191 foreach ($array_query_drop_down as $array_query_drop_down_key => $array_query_drop_down_value) {
192 if ($_REQUEST["query_drop_down_master_".$QueryDropDownNamePart]==$array_query_drop_down_key) {
193 $Selected=' selected ';
194 } else {
195 $Selected='';
198 <option value="<?php echo attr($array_query_drop_down_key) ?>" <?php echo $Selected ?>
199 ><?php echo text($array_query_drop_down_value) ?></option>
200 <?php
203 </select>
205 </td>
206 </tr>
207 </table>
208 <?php
211 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
212 $IncludeNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
214 <table width="150" border="0" cellspacing="0" cellpadding="0"
215 id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
216 <tr>
217 <td class='text criteria_class2' ><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></td>
218 </tr>
219 <tr>
220 <td width="150" class='text criteria_class2' ><?php
221 $FunctionName=$ThisPageSearchCriteriaIncludeMaster[$ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]];
222 $FunctionName();
223 ?></td>
224 </tr>
225 </table>
226 <?php
229 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text' ||
230 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
231 $TextNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
232 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text') {
233 $TextSeperator=' = ';
236 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
237 $TextSeperator=' like ';
240 <table width="150" border="0" cellspacing="0" cellpadding="0"
241 id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
242 <tr>
243 <td class='text criteria_class2' ><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></td>
244 </tr>
245 <tr>
246 <td width="150" class='text criteria_class2' ><input type="text" name="text_master_<?php echo attr($TextNamePart);?>"
247 id="text_master_<?php echo attr($TextNamePart);?>" value="<?php echo attr($_REQUEST["text_master_$TextNamePart"]) ?>"
248 onkeyup="appendOptionTextCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
249 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.value,this.value,'<?php echo $TextSeperator ?>',
250 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')"
251 onchange="appendOptionTextCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
252 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.value,this.value,'<?php echo $TextSeperator ?>',
253 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')"
254 size="15" autocomplete="off" /></td>
255 </tr>
256 </table>
257 <?php
260 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' ||
261 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
263 <table width="150" border="0" cellspacing="0" cellpadding="0"
264 id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
265 <tr>
266 <td class='text criteria_class2' width="150" ><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></td>
267 </tr>
268 <?php
269 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio') {
270 $RadioSeperator=' = ';
273 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
274 $RadioSeperator=' like ';
277 for ($ThisPageSearchCriteriaRadioIndex=0;
278 $ThisPageSearchCriteriaRadioIndex<sizeof($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]);
279 $ThisPageSearchCriteriaRadioIndex++) {
280 $RadioNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
281 if ($_REQUEST["radio_".$RadioNamePart]==
282 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) {
283 $Checked=' checked ';
284 } else {
285 $Checked='';
288 <tr>
289 <td class='text'><input type="radio" name="radio_<?php echo attr($RadioNamePart) ?>"
290 id="radio_<?php echo attr($RadioNamePart.$ThisPageSearchCriteriaRadioIndex) ?>"
291 value="<?php echo attr($ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>"
292 <?php echo $Checked;?>
293 onClick="appendOptionRadioCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
294 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',
295 '<?php echo attr($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>',
296 '<?php echo $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex] ?>',
297 '<?php echo $RadioSeperator ?>','<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />
298 <?php echo text($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>
299 </td>
300 </tr>
301 <?php
304 </table>
305 <?php
308 <?php
311 </td>
312 </tr>
313 </table>
314 </fieldset>
315 </td>
316 <td valign="top"><fieldset style="border-color:#000000; border-width:1px;padding-left:5px;padding-right:0px;padding-top:0px;padding-bottom:0px;" >
317 <legend class='text'><b><?php echo htmlspecialchars(xl('Current Criteria'), ENT_QUOTES) ?></b></legend>
318 <table width="260" border="0" cellspacing="0" cellpadding="0">
319 <tr>
320 <td width="117" class='text'><?php echo htmlspecialchars(xl('Criteria'), ENT_QUOTES) ?></td>
321 <td width="118" class='text'><?php echo htmlspecialchars(xl('Set To'), ENT_QUOTES) ?></td>
322 <td width="25" class='text'></td>
323 </tr>
324 <tr>
325 <td colspan="2"><select name='final_this_page_criteria[]' id='final_this_page_criteria'
326 size='8' style="width:235px;" class='text' title='Criteria' multiple="multiple" >
327 <?php
328 for ($final_this_page_criteria_index=0; $final_this_page_criteria_index<sizeof($_REQUEST['final_this_page_criteria']);
329 $final_this_page_criteria_index++) {
331 <option value="<?php echo attr($_REQUEST['final_this_page_criteria'][$final_this_page_criteria_index]) ?>" >
332 <?php echo xlt($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?></option>
333 <?php
337 </select>
338 <select name='final_this_page_criteria_text[]' id='final_this_page_criteria_text' style="display:none" multiple="multiple" >
339 <?php
340 for ($final_this_page_criteria_index=0; $final_this_page_criteria_index<sizeof($_REQUEST['final_this_page_criteria']);
341 $final_this_page_criteria_index++) {
343 <option value="<?php echo attr($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?>" >1</option>
344 <?php
348 </select>
349 </td>
350 <td valign="top"><a href="#" onClick="removeOptionSelected()"><img src="<?php echo $web_root ?>/interface/pic/Delete.gif" border="0" /></a></td>
351 </tr>
352 </table>
353 </fieldset>
354 </td>
355 </tr>
356 </table><?php //print_r($_REQUEST['final_this_page_criteria']); ?>
357 <!-- ============================================================================================================================================= -->
358 <!-- Criteria section Ends -->
359 <!-- ============================================================================================================================================= -->