another billing class and moved reports to billing (#2683)
[openemr.git] / interface / reports / criteria.tab.php
bloba10ec980d25a953483ec5215b75257e62b097471
1 <?php
2 /**
3 * This displays the search criteria.The master processing is done here.This page
4 * is included in the billing_report.php
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Eldho Chacko <eldho@zhservices.com>
9 * @author Paul Simon K <paul@zhservices.com>
10 * @author Brady Miller <brady.g.miller@gmail.com>
11 * @copyright Copyright (c) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
12 * @copyright Copyright (c) 2018 Brady Miller <brady.g.miller@gmail.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 use OpenEMR\Billing\BillingReport;
19 <style>
20 .criteria_class1{width:125px;}
21 .criteria_class2{padding-left:5px;}
22 </style>
23 <?php
25 $ThisPageSearchCriteriaKey=array();
26 $ThisPageSearchCriteriaDataType=array();
27 $ThisPageSearchCriteriaDisplay=array();
28 $ThisPageSearchCriteriaRadioKey=array();
29 $ThisPageSearchCriteriaDisplayRadio=array();
30 $ThisPageSearchCriteriaQueryDropDown=array();
31 $ThisPageSearchCriteriaQueryDropDownDefault=array();
32 $ThisPageSearchCriteriaQueryDropDownDefaultKey=array();
33 $ThisPageSearchCriteriaInclude=array();
34 //Filling the input array.
35 $ThisPageSearchCriteriaDisplay=$ThisPageSearchCriteriaDisplayMaster;
36 $ThisPageSearchCriteriaKey=explode(',', $ThisPageSearchCriteriaKeyMaster);
37 $ThisPageSearchCriteriaDataType=explode(',', $ThisPageSearchCriteriaDataTypeMaster);
38 //--------------------------------------------------------------
39 //Filling the input array.
40 $NumberOfRadioThisPageSearchCriteria=0;
41 $NumberOfQueryDropDownThisPageSearchCriteria=0;
42 $NumberOfIncludeThisPageSearchCriteria=0;
43 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaDataType); $ThisPageSearchCriteriaIndex++) {
44 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' || $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
45 $NumberOfRadioThisPageSearchCriteria++;
46 $ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]=$ThisPageSearchCriteriaDisplayRadioMaster[$NumberOfRadioThisPageSearchCriteria];
47 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex]=explode(',', $ThisPageSearchCriteriaRadioKeyMaster[$NumberOfRadioThisPageSearchCriteria]);
49 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
50 $NumberOfQueryDropDownThisPageSearchCriteria++;
51 $ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]=$NumberOfQueryDropDownThisPageSearchCriteria;
52 $ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]=
53 $ThisPageSearchCriteriaQueryDropDownMasterDefault[$NumberOfQueryDropDownThisPageSearchCriteria];
54 $ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]=
55 $ThisPageSearchCriteriaQueryDropDownMasterDefaultKey[$NumberOfQueryDropDownThisPageSearchCriteria];
57 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
58 $NumberOfIncludeThisPageSearchCriteria++;
59 $ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]=$NumberOfIncludeThisPageSearchCriteria;
62 //------------------------------------------------------------------------------
64 <div class="form-group col-xs-8">
65 <fieldset>
66 <legend><?php echo xlt('Choose Criteria'); ?></legend>
67 <div class="form-group col-xs-6">
68 <label for="choose_this_page_criteria"><?php echo xlt('Select list'); ?>:</label>
70 <select name="choose_this_page_criteria" id="choose_this_page_criteria" title="Choose Criteria" class="text col-xs-12" onChange="CriteriaVisible()" size='8' >
71 <?php
72 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
73 $optionValue = $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex];
74 echo "<option value='".attr($optionValue)."'";
75 $optionLabel = $ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex];
76 echo ">".text($optionLabel)."</option>\n";
79 </select>
80 </div>
81 <!-- Below section comes as per the defined criteria arrays.Initially all are hidden.As per the click the corresponding items gets visible. -->
82 <?php
83 for ($ThisPageSearchCriteriaIndex=0; $ThisPageSearchCriteriaIndex<sizeof($ThisPageSearchCriteriaKey); $ThisPageSearchCriteriaIndex++) {
84 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='date' ||
85 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='datetime') {
86 $DateNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
88 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
89 <div class= "col-xs-12">
90 <label for="choose_this_page_criteria"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?></label>
91 <?php echo generate_select_list(
92 "date_master_criteria_$DateNamePart",
93 "date_master_criteria",
94 $_REQUEST["date_master_criteria_$DateNamePart"],
95 "Date Criteria",
96 "",
97 "form-control",
98 'calendar_function(this.value,' . attr_js('master_from_date_'.$DateNamePart) . ',' . attr_js('master_to_date_'.$DateNamePart) . ');
99 appendOptionDateCriteria(' . attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]) . ',' .
100 attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) . ',this.options[this.selectedIndex].text,' .
101 'this.options[this.selectedIndex].value," = ",' . attr_js('master_from_date_'.$DateNamePart) . ',' . attr_js('master_to_date_'.$DateNamePart) . ',
102 ' . attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]) . ')'
105 </div>
106 <div class= "col-xs-12">
107 <label class="control-label" for="master_from_date_<?php echo attr($DateNamePart); ?>'"><?php echo xlt('From'); ?>:</label>
108 <input type='text'
109 name='master_from_date_<?php echo attr($DateNamePart); ?>'
110 id='master_from_date_<?php echo attr($DateNamePart); ?>' class="text form-control datepicker"
111 value="<?php echo attr($_REQUEST["master_from_date_$DateNamePart"]) ?>"
112 onChange="SetDateCriteriaCustom(<?php echo attr_js('date_master_criteria_'.$DateNamePart); ?>);
113 appendOptionDateCriteria(<?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>,
114 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);?>,
115 <?php echo attr(xlj('Custom')); ?>,
116 <?php echo attr(xlj('Custom')); ?>,
117 ' = ',<?php echo attr_js('master_from_date_'.$DateNamePart); ?>,<?php echo attr_js('master_to_date_'.$DateNamePart); ?>,
118 <?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)" />
119 </div>
120 <div class= "col-xs-12">
121 <label class="control-label" for="check_date"><?php echo xlt('To{{Range}}'); ?>:</label>
122 <input type='text'
123 name='master_to_date_<?php echo attr($DateNamePart); ?>'
124 id='master_to_date_<?php echo attr($DateNamePart); ?>' class="text form-control datepicker"
125 value="<?php echo attr($_REQUEST["master_to_date_$DateNamePart"]) ?>"
126 onChange="SetDateCriteriaCustom(<?php echo attr_js('date_master_criteria_'.$DateNamePart); ?>);
127 appendOptionDateCriteria(<?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]);?>,
128 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]); ?>,
129 <?php echo attr(xlj('Custom')); ?>,
130 <?php echo attr(xlj('Custom')); ?>,
131 ' = ',<?php echo attr_js('master_from_date_'.$DateNamePart); ?>,<?php echo attr_js('master_to_date_'.$DateNamePart); ?>,
132 <?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)" />
133 </div>
134 </div>
135 <?php
136 } //end of if
138 <?php
139 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='query_drop_down') {
140 $array_query_drop_down = BillingReport::BuildArrayForReport($ThisPageSearchCriteriaQueryDropDownMaster[$ThisPageSearchCriteriaQueryDropDown[$ThisPageSearchCriteriaIndex]]);
141 $QueryDropDownNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
143 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
144 <div class= "col-xs-12">
145 <label class="control-label" for="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
146 <select name="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>"
147 id="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>" onchange="appendOptionRadioCriteria(
148 <?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>,
149 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]); ?>,this.options[this.selectedIndex].text,
150 this.options[this.selectedIndex].value,' = ',
151 <?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)">
152 <option value="<?php echo attr($ThisPageSearchCriteriaQueryDropDownDefaultKey[$ThisPageSearchCriteriaIndex]) ?>" ><?php echo text($ThisPageSearchCriteriaQueryDropDownDefault[$ThisPageSearchCriteriaIndex]) ?></option>
153 <?php
154 foreach ($array_query_drop_down as $array_query_drop_down_key => $array_query_drop_down_value) {
155 if ($_REQUEST["query_drop_down_master_".$QueryDropDownNamePart]==$array_query_drop_down_key) {
156 $Selected=' selected ';
157 } else {
158 $Selected='';
161 <option value="<?php echo attr($array_query_drop_down_key) ?>" <?php echo $Selected ?>><?php echo text($array_query_drop_down_value) ?></option>
162 <?php
165 </select>
166 </div>
167 </div>
168 <?php
169 } //end of if
171 <?php
172 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='include') {
173 $IncludeNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
175 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
176 <div class= "col-xs-12">
177 <label class="control-label" for=""><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
178 <div <?php //Don't Use class = 'form-control'?>>
179 <?php $FunctionName = $ThisPageSearchCriteriaIncludeMaster[$ThisPageSearchCriteriaInclude[$ThisPageSearchCriteriaIndex]];
180 $FunctionName();?>
181 </div>
182 </div>
183 </div>
184 <?php
185 } //end of if
187 <?php
188 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text' ||
189 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
190 $TextNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
191 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text') {
192 $TextSeperator=' = ';
194 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='text_like') {
195 $TextSeperator=' like ';
198 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
199 <div class= "col-xs-12">
200 <label class="control-label" for="text_master_<?php echo attr($TextNamePart);?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
201 <input type="text" name="text_master_<?php echo attr($TextNamePart);?>"
202 id="text_master_<?php echo attr($TextNamePart);?>" value="<?php echo attr($_REQUEST["text_master_$TextNamePart"]) ?>"
203 onkeyup="appendOptionTextCriteria(<?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>,
204 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]); ?>,this.value,this.value,<?php echo attr_js($TextSeperator); ?>,
205 <?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)"
206 onchange="appendOptionTextCriteria(<?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>,
207 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]); ?>,this.value,this.value,<?php echo attr_js($TextSeperator); ?>,
208 <?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)"
209 class = "form-control" autocomplete="off" />
210 </div>
211 </div>
212 <?php
213 } //end of if
215 <?php
216 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio' ||
217 $ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
219 <div class="form-group col-xs-6" id="table_<?php echo attr($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]) ?>" style="display:none">
220 <div class= "col-xs-12">
221 <label class="control-label" for="radio_<?php echo attr($RadioNamePart) ?>"><?php echo text($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>:</label>
222 <?php
223 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio') {
224 $RadioSeperator=' = ';
226 if ($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]=='radio_like') {
227 $RadioSeperator=' like ';
229 for ($ThisPageSearchCriteriaRadioIndex=0; $ThisPageSearchCriteriaRadioIndex<sizeof($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex]); $ThisPageSearchCriteriaRadioIndex++) {
230 $RadioNamePart=str_replace('.', '_', $ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]);
231 if ($_REQUEST["radio_".$RadioNamePart]==
232 $ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) {
233 $Checked=' checked ';
234 } else {
235 $Checked='';
238 <div class="radio">
239 <input type="radio" name="radio_<?php echo attr($RadioNamePart) ?>"
240 id="radio_<?php echo attr($RadioNamePart.$ThisPageSearchCriteriaRadioIndex) ?>"
241 value="<?php echo attr($ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>"
242 <?php echo $Checked;?>
243 onClick="appendOptionRadioCriteria(<?php echo attr_js($ThisPageSearchCriteriaDisplay[$ThisPageSearchCriteriaIndex]); ?>,
244 <?php echo attr_js($ThisPageSearchCriteriaKey[$ThisPageSearchCriteriaIndex]); ?>,
245 <?php echo attr_js($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]); ?>,
246 <?php echo attr_js($ThisPageSearchCriteriaRadioKey[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]); ?>,
247 <?php echo attr_js($RadioSeperator); ?>,<?php echo attr_js($ThisPageSearchCriteriaDataType[$ThisPageSearchCriteriaIndex]); ?>)" />
248 <?php echo text($ThisPageSearchCriteriaDisplayRadio[$ThisPageSearchCriteriaIndex][$ThisPageSearchCriteriaRadioIndex]) ?>
249 <?php echo "</div>";
250 } // end of for
252 </div>
253 </div>
254 <?php
255 } //end of if
257 <?php
258 } //end of for
260 </fieldset>
261 </div>
262 <div class="form-group col-xs-4">
263 <fieldset>
264 <legend><?php echo xlt('Current Criteria'); ?></legend>
265 <div class="form-group col-xs-12">
266 <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 xla('Click here to delete the selection'); ?>"></i></label>
267 <select name='final_this_page_criteria[]' id='final_this_page_criteria' size='8' class='text col-xs-12' title='Criteria' multiple="multiple" >
268 <?php
269 if ($_REQUEST['final_this_page_criteria']) {
270 for ($final_this_page_criteria_index=0; $final_this_page_criteria_index<sizeof($_REQUEST['final_this_page_criteria']); $final_this_page_criteria_index++) {
272 <option value="<?php echo attr($_REQUEST['final_this_page_criteria'][$final_this_page_criteria_index]) ?>" >
273 <?php echo xlt($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?></option>
274 <?php
278 </select>
279 <select name='final_this_page_criteria_text[]' id='final_this_page_criteria_text' style="display:none" multiple="multiple" >
280 <?php
281 if ($_REQUEST['final_this_page_criteria']) {
282 for ($final_this_page_criteria_index = 0; $final_this_page_criteria_index < sizeof($_REQUEST['final_this_page_criteria']); $final_this_page_criteria_index++) {
284 <option value="<?php echo attr($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?>">
286 </option>
287 <?php
291 </select>
292 </div>
293 </fieldset>
294 </div>
295 <?php //print_r($_REQUEST['final_this_page_criteria']); ?>
296 <!-- ============================================================================================================================================= -->
297 <!-- Criteria section Ends -->
298 <!-- ============================================================================================================================================= -->