minor changes to prior commit
[openemr.git] / interface / reports / criteria.tab.php
blob837460d009b7708cc024e8b026427b754b642ec4
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();
37 $ThisPageSearchCriteriaRadioKey=array();
38 $ThisPageSearchCriteriaDisplayRadio=array();
39 $ThisPageSearchCriteriaQueryDropDown=array();
40 $ThisPageSearchCriteriaQueryDropDownDefault=array();
41 $ThisPageSearchCriteriaQueryDropDownDefaultKey=array();
42 $ThisPageSearchCriteriaInclude=array();
43 //Filling the input array.
44 $ThisPageSearchCriteriaDisplay=$ThisPageSearchCriteriaDisplayMaster;
45 $ThisPageSearchCriteriaKey=explode(',', $ThisPageSearchCriteriaKeyMaster);
46 $ThisPageSearchCriteriaDataType=explode(',', $ThisPageSearchCriteriaDataTypeMaster);
47 //--------------------------------------------------------------
48 //Filling the input array.
49 $NumberOfRadioThisPageSearchCriteria=0;
50 $NumberOfQueryDropDownThisPageSearchCriteria=0;
51 $NumberOfIncludeThisPageSearchCriteria=0;
52 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaDataType); $ThisPageSearchCriteriaIndex++) {
53 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' || $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
54 $NumberOfRadioThisPageSearchCriteria++;
55 $ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]=$ThisPageSearchCriteriaDisplayRadioMaster[$NumberOfRadioThisPageSearchCriteria];
56 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex]=explode(',', $ThisPageSearchCriteriaRadioKeyMaster[$NumberOfRadioThisPageSearchCriteria]);
58 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
59 $NumberOfQueryDropDownThisPageSearchCriteria++;
60 $ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]=$NumberOfQueryDropDownThisPageSearchCriteria;
61 $ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]=
62 $ThisPageSearchCriteriaQueryDropDownMasterDefault[$NumberOfQueryDropDownThisPageSearchCriteria];
63 $ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]=
64 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[$NumberOfQueryDropDownThisPageSearchCriteria];
66 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
67 $NumberOfIncludeThisPageSearchCriteria++;
68 $ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]=$NumberOfIncludeThisPageSearchCriteria;
71 //------------------------------------------------------------------------------
73 <div class="form-group col-xs-8">
74 <fieldset>
75 <legend><?php echo xlt('Choose Criteria'); ?></legend>
76 <div class="form-group col-xs-6">
77 <label for="choose_this_page_criteria"><?php echo xlt('Select list'); ?>:</label>
79 <select name="choose_this_page_criteria" id="choose_this_page_criteria" title="Choose Criteria" class="text col-xs-12" onChange="CriteriaVisible()" size='8' >
80 <?php
81 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
82 $optionValue = $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];
83 echo "<option value='".attr($optionValue)."'";
84 $optionLabel = $ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex];
85 echo ">".text($optionLabel)."</option>\n";
88 </select>
89 </div>
90 <!-- Below section comes as per the defined criteria arrays.Initially all are hidden.As per the click the corresponding items gets visible. -->
91 <?php
92 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
93 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='date' ||
94 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='datetime') {
95 $DateNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
97 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
98 <div class= "col-xs-12">
99 <label for="choose_this_page_criteria"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></label>
100 <?php echo generate_select_list(
101 "date_master_criteria_$DateNamePart",
102 "date_master_criteria",
103 $_REQUEST["date_master_criteria_$DateNamePart"],
104 "Date Criteria",
106 "form-control",
107 'calendar_function(this.value,"master_from_date_'.$DateNamePart.'","master_to_date_'.$DateNamePart.'");
108 appendOptionDateCriteria("'.attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]).'","'.
109 $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex].'",this.options[this.selectedIndex].text,'.
110 'this.options[this.selectedIndex].value," = ","master_from_date_'.$DateNamePart.'","master_to_date_'.$DateNamePart.'",
111 "'.$ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex].'")'
114 </div>
115 <div class= "col-xs-12">
116 <label class="control-label" for="master_from_date_<?php echo $DateNamePart;?>'"><?php echo xlt('From'); ?>:</label>
117 <input type='text'
118 name='master_from_date_<?php echo $DateNamePart;?>'
119 id='master_from_date_<?php echo $DateNamePart;?>' class="text form-control datepicker"
120 value="<?php echo attr($_REQUEST["master_from_date_$DateNamePart"]) ?>"
121 onChange="SetDateCriteriaCustom('date_master_criteria_<?php echo $DateNamePart;?>');
122 appendOptionDateCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>',
123 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];?>',
124 '<?php echo xla('Custom'); ?>',
125 '<?php echo xla('Custom'); ?>',
126 ' = ','master_from_date_<?php echo $DateNamePart;?>','master_to_date_<?php echo $DateNamePart;?>',
127 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />
128 </div>
129 <div class= "col-xs-12">
130 <label class="control-label" for="check_date"><?php echo xlt('To'); ?>:</label>
131 <input type='text'
132 name='master_to_date_<?php echo $DateNamePart;?>'
133 id='master_to_date_<?php echo $DateNamePart;?>' class="text form-control datepicker"
134 value="<?php echo attr($_REQUEST["master_to_date_$DateNamePart"]) ?>"
135 onChange="SetDateCriteriaCustom('date_master_criteria_<?php echo $DateNamePart;?>');
136 appendOptionDateCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>',
137 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];?>',
138 '<?php echo xla('Custom'); ?>',
139 '<?php echo xla('Custom'); ?>',
140 ' = ','master_from_date_<?php echo $DateNamePart;?>','master_to_date_<?php echo $DateNamePart;?>',
141 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />
142 </div>
143 </div>
144 <?php
145 } //end of if
147 <?php
148 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
149 $array_query_drop_down=BuildArrayForReport($ThisPageSearchCriteriaQueryDropDownMaster[$ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]]);
150 $QueryDropDownNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
152 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
153 <div class= "col-xs-12">
154 <label class="control-label" for="query_drop_down_master_<?php echo $QueryDropDownNamePart;?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
155 <select name="query_drop_down_master_<?php echo $QueryDropDownNamePart;?>"
156 id="query_drop_down_master_<?php echo $QueryDropDownNamePart;?>" onchange="appendOptionRadioCriteria(
157 '<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
158 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.options[this.selectedIndex].text,
159 this.options[this.selectedIndex].value,' = ',
160 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')">
161 <option value="<?php echo attr($ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]) ?>" ><?php echo text($ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]) ?></option>
162 <?php
163 foreach ($array_query_drop_down as $array_query_drop_down_key => $array_query_drop_down_value) {
164 if ($_REQUEST["query_drop_down_master_".$QueryDropDownNamePart]==$array_query_drop_down_key) {
165 $Selected=' selected ';
166 } else {
167 $Selected='';
170 <option value="<?php echo attr($array_query_drop_down_key) ?>" <?php echo $Selected ?>><?php echo text($array_query_drop_down_value) ?></option>
171 <?php
174 </select>
175 </div>
176 </div>
177 <?php
178 } //end of if
180 <?php
181 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
182 $IncludeNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
184 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
185 <div class= "col-xs-12">
186 <label class="control-label" for=""><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
187 <div <?php //Don't Use class = 'form-control'?>>
188 <?php $FunctionName=$ThisPageSearchCriteriaIncludeMaster[$ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]];
189 $FunctionName();?>
190 </div>
191 </div>
192 </div>
193 <?php
194 } //end of if
196 <?php
197 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text' ||
198 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
199 $TextNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
200 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text') {
201 $TextSeperator=' = ';
203 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
204 $TextSeperator=' like ';
207 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
208 <div class= "col-xs-12">
209 <label class="control-label" for="text_master_<?php echo attr($TextNamePart);?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
210 <input type="text" name="text_master_<?php echo attr($TextNamePart);?>"
211 id="text_master_<?php echo attr($TextNamePart);?>" value="<?php echo attr($_REQUEST["text_master_$TextNamePart"]) ?>"
212 onkeyup="appendOptionTextCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
213 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.value,this.value,'<?php echo $TextSeperator ?>',
214 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')"
215 onchange="appendOptionTextCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
216 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',this.value,this.value,'<?php echo $TextSeperator ?>',
217 '<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')"
218 class = "form-control" autocomplete="off" />
219 </div>
220 </div>
221 <?php
222 } //end of if
224 <?php
225 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' ||
226 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
228 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
229 <div class= "col-xs-12">
230 <label class="control-label" for="radio_<?php echo attr($RadioNamePart) ?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
231 <?php
232 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio') {
233 $RadioSeperator=' = ';
235 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
236 $RadioSeperator=' like ';
238 for ($ThisPageSearchCriteriaRadioIndex=0;
239 $ThisPageSearchCriteriaRadioIndex<sizeof($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]);
240 $ThisPageSearchCriteriaRadioIndex++) {
241 $RadioNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
242 if ($_REQUEST["radio_".$RadioNamePart]==
243 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) {
244 $Checked=' checked ';
245 } else {
246 $Checked='';
249 <div class="radio">
250 <input type="radio" name="radio_<?php echo attr($RadioNamePart) ?>"
251 id="radio_<?php echo attr($RadioNamePart.$ThisPageSearchCriteriaRadioIndex) ?>"
252 value="<?php echo attr($ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>"
253 <?php echo $Checked;?>
254 onClick="appendOptionRadioCriteria('<?php echo attr($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) ?>',
255 '<?php echo $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex] ?>',
256 '<?php echo attr($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>',
257 '<?php echo $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex] ?>',
258 '<?php echo $RadioSeperator ?>','<?php echo $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex] ?>')" />
259 <?php echo text($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>
260 <?php echo "</div>";
261 } // end of for
263 </div>
264 </div>
265 <?php
266 } //end of if
268 <?php
269 } //end of for
271 </fieldset>
272 </div>
273 <div class="form-group col-xs-4">
274 <fieldset>
275 <legend><?php echo xlt('Current Criteria'); ?></legend>
276 <div class="form-group col-xs-12">
277 <label for="final_this_page_criteria" class="col-xs-12"><?php echo xlt('Criteria'); ?> <?php echo xlt('Set To'); ?>: <i class="fa fa-times-circle fa-2x text-danger pull-right" style="margin-top:-7px" aria-hidden="true" onclick="removeOptionSelected()" title="<?php echo xlt('Click here to delete the selection'); ?>"></i></label>
278 <select name='final_this_page_criteria[]' id='final_this_page_criteria' size='8' class='text col-xs-12' title='Criteria' multiple="multiple" >
279 <?php
280 for ($final_this_page_criteria_index=0; $final_this_page_criteria_index<sizeof($_REQUEST['final_this_page_criteria']);
281 $final_this_page_criteria_index++) {
283 <option value="<?php echo attr($_REQUEST['final_this_page_criteria'][$final_this_page_criteria_index]) ?>" >
284 <?php echo xlt($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?></option>
285 <?php
288 </select>
289 <select name='final_this_page_criteria_text[]' id='final_this_page_criteria_text' style="display:none" multiple="multiple" >
290 <?php
291 for ($final_this_page_criteria_index=0; $final_this_page_criteria_index<sizeof($_REQUEST['final_this_page_criteria']);
292 $final_this_page_criteria_index++) {
294 <option value="<?php echo attr($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?>" >1</option>
295 <?php
298 </select>
299 </div>
300 </fieldset>
301 </div>
302 <?php //print_r($_REQUEST['final_this_page_criteria']); ?>
303 <!-- ============================================================================================================================================= -->
304 <!-- Criteria section Ends -->
305 <!-- ============================================================================================================================================= -->