Feat openemr fix 7480 7494 email prescription (#7495)
[openemr.git] / interface / reports / criteria.tab.php
blob4ac4dff0569cae62412a682a20897923e60611cc
1 <?php
3 /**
4 * This displays the search criteria. The master processing is done here. This page
5 * is included in the billing_report.php
7 * @package OpenEMR
8 * @link http://www.open-emr.org
9 * @author Eldho Chacko <eldho@zhservices.com>
10 * @author Paul Simon K <paul@zhservices.com>
11 * @author Brady Miller <brady.g.miller@gmail.com>
12 * @copyright Copyright (c) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
13 * @copyright Copyright (c) 2019 Brady Miller <brady.g.miller@gmail.com>
14 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
17 use OpenEMR\Billing\BillingReport;
21 <?php
23 // TPS = This Page Search
25 $TPSCriteriaKey = array();
26 $TPSCriteriaDataType = array();
27 $TPSCriteriaDisplay = array();
28 $TPSCriteriaRadioKey = array();
29 $TPSCriteriaDisplayRadio = array();
30 $TPSCriteriaQueryDropDown = array();
31 $TPSCriteriaQueryDropDownDefault = array();
32 $TPSCriteriaQueryDropDownDefaultKey = array();
33 $TPSCriteriaInclude = array();
34 // Filling the input array.
35 $TPSCriteriaDisplay = $TPSCriteriaDisplayMaster;
36 $TPSCriteriaKey = explode(',', $TPSCriteriaKeyMaster);
37 $TPSCriteriaDataType = explode(',', $TPSCriteriaDataTypeMaster);
38 // --------------------------------------------------------------
39 // Filling the input array.
40 // --------------------------------------------------------------
41 $NumberOfRadioTPSCriteria = 0;
42 $NumberOfQueryDropDownTPSCriteria = 0;
43 $NumberOfIncludeTPSCriteria = 0;
44 for ($TPSCriteriaIndex = 0; $TPSCriteriaIndex < sizeof($TPSCriteriaDataType); $TPSCriteriaIndex++) {
45 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio' || $TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio_like') {
46 $NumberOfRadioTPSCriteria++;
47 $TPSCriteriaDisplayRadio[$TPSCriteriaIndex] = $TPSCriteriaDisplayRadioMaster[$NumberOfRadioTPSCriteria];
48 $TPSCriteriaRadioKey[$TPSCriteriaIndex] = explode(',', $TPSCriteriaRadioKeyMaster[$NumberOfRadioTPSCriteria]);
50 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'query_drop_down') {
51 $NumberOfQueryDropDownTPSCriteria++;
52 $TPSCriteriaQueryDropDown[$TPSCriteriaIndex] = $NumberOfQueryDropDownTPSCriteria;
53 $TPSCriteriaQueryDropDownDefault[$TPSCriteriaIndex] = $TPSCriteriaQueryDropDownMasterDefault[$NumberOfQueryDropDownTPSCriteria];
54 $TPSCriteriaQueryDropDownDefaultKey[$TPSCriteriaIndex] = $TPSCriteriaQueryDropDownMasterDefaultKey[$NumberOfQueryDropDownTPSCriteria];
56 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'include') {
57 $NumberOfIncludeTPSCriteria++;
58 $TPSCriteriaInclude[$TPSCriteriaIndex] = $NumberOfIncludeTPSCriteria;
61 //------------------------------------------------------------------------------
63 <div class="row">
64 <div class="col-md">
65 <div class="card bg-light">
66 <div class="card-header pb-0"><h4><?php echo xlt('Choose Criteria'); ?></h4></div>
67 <div class="card-body">
68 <div class="form-group px-2">
69 <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="form-control" onChange="CriteriaVisible()" size='8'>
71 <?php
72 for ($TPSCriteriaIndex = 0; $TPSCriteriaIndex < sizeof($TPSCriteriaKey); $TPSCriteriaIndex++) {
73 $optionValue = $TPSCriteriaKey[$TPSCriteriaIndex];
74 echo "<option value='" . attr($optionValue) . "'";
75 $optionLabel = $TPSCriteriaDisplay[$TPSCriteriaIndex];
76 echo ">" . text($optionLabel) . "</option>\n";
79 </select>
80 </div>
81 </div>
82 <div class="card-footer">
83 <!-- Below section comes as per the defined criteria arrays. Initially all are hidden. As per the click the corresponding items gets visible. -->
84 <?php
85 for ($TPSCriteriaIndex = 0; $TPSCriteriaIndex < sizeof($TPSCriteriaKey); $TPSCriteriaIndex++) {
86 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'date' || $TPSCriteriaDataType[$TPSCriteriaIndex] == 'datetime') {
87 $DateNamePart = str_replace('.', '_', $TPSCriteriaKey[$TPSCriteriaIndex]);
89 <div class="form-group px-2" id="table_<?php echo attr($TPSCriteriaKey[$TPSCriteriaIndex]) ?>" style="display: none">
90 <label for="choose_this_page_criteria"><?php echo text($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?></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($TPSCriteriaDisplay[$TPSCriteriaIndex]) . ',' .
100 attr_js($TPSCriteriaKey[$TPSCriteriaIndex]) . ',this.options[this.selectedIndex].text,' .
101 'this.options[this.selectedIndex].value,' . attr_js('=') . ',' . attr_js('master_from_date_' . $DateNamePart) . ',' . attr_js('master_to_date_' . $DateNamePart) . ',
102 ' . attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]) . ')'
105 <label class="control-label" for="master_from_date_<?php echo attr($DateNamePart); ?>'"><?php echo xlt('From'); ?>:</label>
106 <input type='text' name='master_from_date_<?php echo attr($DateNamePart); ?>' id='master_from_date_<?php echo attr($DateNamePart); ?>' class="text form-control datepicker" value="<?php echo attr($_REQUEST["master_from_date_$DateNamePart"] ?? '') ?>"
107 onChange="SetDateCriteriaCustom(<?php echo attr_js('date_master_criteria_' . $DateNamePart); ?>); appendOptionDateCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]);?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]);?>, <?php echo attr(xlj('Custom')); ?>, <?php echo attr(xlj('Custom')); ?>, ' = ', <?php echo attr_js('master_from_date_' . $DateNamePart); ?>, <?php echo attr_js('master_to_date_' . $DateNamePart); ?>, <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)" />
109 <label class="control-label" for="check_date"><?php echo xlt('To{{Range}}'); ?>:</label>
110 <input type='text' name='master_to_date_<?php echo attr($DateNamePart); ?>' id='master_to_date_<?php echo attr($DateNamePart); ?>' class="text form-control datepicker" value="<?php echo attr($_REQUEST["master_to_date_$DateNamePart"] ?? '') ?>"
111 onChange="SetDateCriteriaCustom(<?php echo attr_js('date_master_criteria_' . $DateNamePart); ?>); appendOptionDateCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]);?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]); ?>, <?php echo attr(xlj('Custom')); ?>, <?php echo attr(xlj('Custom')); ?>, ' = ', <?php echo attr_js('master_from_date_' . $DateNamePart); ?>, <?php echo attr_js('master_to_date_' . $DateNamePart); ?>, <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)" />
112 </div>
113 <?php
114 } //end of if
116 <?php
117 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'query_drop_down') {
118 $array_query_drop_down = BillingReport::buildArrayForReport($TPSCriteriaQueryDropDownMaster[$TPSCriteriaQueryDropDown[$TPSCriteriaIndex]]);
119 $QueryDropDownNamePart = str_replace('.', '_', $TPSCriteriaKey[$TPSCriteriaIndex]);
121 <div class="form-group px-2" id="table_<?php echo attr($TPSCriteriaKey[$TPSCriteriaIndex]) ?>" style="display: none">
122 <label class="control-label" for="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>"><?php echo text($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>:</label>
123 <select class="form-control" name="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>" id="query_drop_down_master_<?php echo attr($QueryDropDownNamePart); ?>"
124 onchange="appendOptionRadioCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]); ?>,this.options[this.selectedIndex].text, this.options[this.selectedIndex].value,' = ', <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)">
125 <option value="<?php echo attr($TPSCriteriaQueryDropDownDefaultKey[$TPSCriteriaIndex]) ?>" ><?php echo text($TPSCriteriaQueryDropDownDefault[$TPSCriteriaIndex]) ?></option>
126 <?php
127 foreach ($array_query_drop_down as $array_query_drop_down_key => $array_query_drop_down_value) {
128 if ($_REQUEST["query_drop_down_master_" . $QueryDropDownNamePart] == $array_query_drop_down_key) {
129 $Selected = ' selected ';
130 } else {
131 $Selected = '';
134 <option value="<?php echo attr($array_query_drop_down_key) ?>" <?php echo $Selected ?>><?php echo text($array_query_drop_down_value) ?></option>
135 <?php
138 </select>
139 </div>
140 <?php
141 } //end of if
143 <?php
144 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'include') {
145 $IncludeNamePart = str_replace('.', '_', $TPSCriteriaKey[$TPSCriteriaIndex]);
147 <div class="form-group px-2" id="table_<?php echo attr($TPSCriteriaKey[$TPSCriteriaIndex]) ?>" style="display: none">
148 <label class="control-label" for=""><?php echo text($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>:</label>
149 <div <?php //Don't Use class = 'form-control'?>>
150 <?php $FunctionName = $TPSCriteriaIncludeMaster[$TPSCriteriaInclude[$TPSCriteriaIndex]];
151 $FunctionName();?>
152 </div>
153 </div>
154 <?php
155 } //end of if
157 <?php
158 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'text' || $TPSCriteriaDataType[$TPSCriteriaIndex] == 'text_like') {
159 $TextNamePart = str_replace('.', '_', $TPSCriteriaKey[$TPSCriteriaIndex]);
160 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'text') {
161 $TextSeperator = ' = ';
163 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'text_like') {
164 $TextSeperator = ' like ';
167 <div class="form-group px-2" id="table_<?php echo attr($TPSCriteriaKey[$TPSCriteriaIndex]) ?>" style="display: none">
168 <label class="control-label" for="text_master_<?php echo attr($TextNamePart);?>"><?php echo text($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>:</label>
169 <input type="text" name="text_master_<?php echo attr($TextNamePart);?>" id="text_master_<?php echo attr($TextNamePart);?>" value="<?php echo attr($_REQUEST["text_master_$TextNamePart"] ?? '') ?>" onkeyup="appendOptionTextCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]); ?>, this.value, this.value, <?php echo attr_js($TextSeperator); ?>, <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)" onchange="appendOptionTextCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]); ?>,this.value,this.value,<?php echo attr_js($TextSeperator); ?>, <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)" class="form-control" autocomplete="off" />
170 </div>
171 <?php
172 } //end of if
174 <?php
175 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio' || $TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio_like') {
177 <div class="form-group px-2" id="table_<?php echo attr($TPSCriteriaKey[$TPSCriteriaIndex]) ?>" style="display: none">
178 <label class="control-label" for="radio_<?php echo attr($RadioNamePart ?? ''); ?>"><?php echo text($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>:</label>
179 <?php
180 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio') {
181 $RadioSeperator = ' = ';
183 if ($TPSCriteriaDataType[$TPSCriteriaIndex] == 'radio_like') {
184 $RadioSeperator = ' like ';
186 for ($TPSCriteriaRadioIndex = 0; $TPSCriteriaRadioIndex < sizeof($TPSCriteriaDisplayRadio[$TPSCriteriaIndex]); $TPSCriteriaRadioIndex++) {
187 $RadioNamePart = str_replace('.', '_', $TPSCriteriaKey[$TPSCriteriaIndex]);
188 if (!empty($_REQUEST["radio_" . $RadioNamePart]) && ($_REQUEST["radio_" . $RadioNamePart] == $TPSCriteriaRadioKey[$TPSCriteriaIndex][$TPSCriteriaRadioIndex])) {
189 $Checked = ' checked ';
190 } else {
191 $Checked = '';
194 <div class="radio">
195 <input type="radio" name="radio_<?php echo attr($RadioNamePart) ?>" id="radio_<?php echo attr($RadioNamePart . $TPSCriteriaRadioIndex) ?>" value="<?php echo attr($TPSCriteriaRadioKey[$TPSCriteriaIndex][$TPSCriteriaRadioIndex]) ?>" <?php echo $Checked;?> onClick="appendOptionRadioCriteria(<?php echo attr_js($TPSCriteriaDisplay[$TPSCriteriaIndex]); ?>, <?php echo attr_js($TPSCriteriaKey[$TPSCriteriaIndex]); ?>, <?php echo attr_js($TPSCriteriaDisplayRadio[$TPSCriteriaIndex][$TPSCriteriaRadioIndex]); ?>, <?php echo attr_js($TPSCriteriaRadioKey[$TPSCriteriaIndex][$TPSCriteriaRadioIndex]); ?>, <?php echo attr_js($RadioSeperator); ?>, <?php echo attr_js($TPSCriteriaDataType[$TPSCriteriaIndex]); ?>)" />
196 <?php echo text($TPSCriteriaDisplayRadio[$TPSCriteriaIndex][$TPSCriteriaRadioIndex]);
197 echo "</div>";
198 } // end of for
200 </div>
201 <?php
202 } //end of if
203 } //end of for
205 </div>
206 </div>
207 </div>
208 <!-- Current Criteria -->
209 <div class="col-md">
210 <div class="card bg-light">
211 <div class="card-header pb-0"><h4><?php echo xlt('Current Criteria'); ?></h4></div>
212 <div class="card-body">
213 <div class="form-group px-2">
214 <label for="final_this_page_criteria"><?php echo xlt('Criteria Actions') . ':'; ?></label>
215 <span class="float-right">
216 <i class="fa fa-trash fa-2x text-warning" aria-hidden="true" onclick="removeOptionSelected()" title="<?php echo xla('Click here to delete the selection'); ?>"></i>&nbsp;
217 <i class="fa fa-trash fa-2x text-danger" aria-hidden="true" onclick="removeOptionsAll()" title="<?php echo xla('Click here to delete all options'); ?>"></i>
218 </span>
219 <select name='final_this_page_criteria[]' id='final_this_page_criteria' class='form-control' size="8" title='Criteria' multiple="multiple">
220 <?php
221 if (!empty($_REQUEST['final_this_page_criteria'])) {
222 for ($final_this_page_criteria_index = 0; $final_this_page_criteria_index < sizeof($_REQUEST['final_this_page_criteria']); $final_this_page_criteria_index++) {
224 <option value="<?php echo attr($_REQUEST['final_this_page_criteria'][$final_this_page_criteria_index]) ?>">
225 <?php echo xlt($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?></option>
226 <?php
230 </select>
231 <select name='final_this_page_criteria_text[]' id='final_this_page_criteria_text' style="display: none" multiple="multiple">
232 <?php
233 if (!empty($_REQUEST['final_this_page_criteria'])) {
234 for ($final_this_page_criteria_index = 0; $final_this_page_criteria_index < sizeof($_REQUEST['final_this_page_criteria']); $final_this_page_criteria_index++) {
236 <option value="<?php echo attr($_REQUEST['final_this_page_criteria_text'][$final_this_page_criteria_index]) ?>">
238 </option>
239 <?php
243 </select>
244 </div>
245 </div>
246 </div>
247 </div>
248 <div class="col-md">
249 <div class="card bg-light">
250 <div class="card-header pb-0"><h4><?php echo xlt('Select Action'); ?></h4></div>
251 <div class="card-body">
252 <div class="form-group">
253 <ul class="list-group list-group-flush">
254 <li class="list-group-item bg-light d-flex justify-content-between align-items-center">
255 <a class="link_submit" href="#" onclick="javascript:return SubmitTheScreen();"><strong><?php echo xlt('Update List') ?></strong></a><i id='update-tooltip' class="fa fa-info-circle fa-lg text-primary" aria-hidden="true"></i>
256 </li>
257 <?php if (file_exists("$webserver_root/custom/BillingExport.php")) { ?>
258 <li class="list-group-item bg-light">
259 <a class='link_submit' href="#" onclick="javascript:return SubmitTheScreenExportOFX();"><strong><?php echo xlt('Export OFX'); ?></strong></a>
260 </li>
261 <?php } ?>
262 <li class="list-group-item bg-light">
263 <a class='link_submit' href="#" onclick="javascript:return SubmitTheScreenPrint();"><strong><?php echo xlt('View Printable Report'); ?></strong></a>
264 </li>
265 <span>
266 <?php if ($daysheet) { ?>
267 <li class="list-group-item bg-light"><a class='link_submit' href="#" onclick="javascript:return SubmitTheEndDayPrint();"><strong><?php echo xlt('End Of Day Report') . ' - ' ?></strong></a>
268 <?php if ($daysheet_total) { ?>
269 <span class="text"><strong><?php echo xlt('Totals'); ?></strong></span>
270 <input name="end_of_day_totals_only" type="checkbox" value="1">
271 <?php } ?>
272 <?php if ($provider_run) { ?>
273 <span class="text"><strong><?php echo xlt('Provider'); ?></strong></span>
274 <input name="end_of_day_provider_only" type="checkbox" value="1">
275 <?php } ?>
276 </li>
277 <?php } ?>
278 </span>
279 <?php if (!file_exists($EXPORT_INC)) { ?>
280 <li class="list-group-item bg-light"><a href='#' id="view-log-link" data-toggle="modal" data-target="#myModal" class='link_submit' title='<?php echo xla('See messages from the last set of generated claims'); ?>'><strong><?php echo xlt('View Log'); ?></strong></a>
281 </li>
282 <?php } ?>
283 <li class="list-group-item bg-light"><a href="<?php echo $webroot ?>/interface/billing/customize_log.php" rel="noopener" target="_blank" onclick="top.restoreSession()"><strong><?php echo xlt('Tab Log') ?></strong></a>
284 </li>
285 <li class="list-group-item bg-light"><a class="link_submit" href="JavaScript:void(0);" onclick="select_all(); return false;"><strong><?php echo xlt('Select All'); ?></strong></a>
286 </li>
287 <li class="list-group-item bg-light"><a id="clear-log" href="#" title='<?php xla('Clear the log'); ?>'><strong><?php echo xlt('Clear Log') ?></strong></a>
288 </li>
289 </ul>
290 </div>
291 </div>
292 </div>
293 </div>
294 </div>
295 <!-- Criteria section Ends -->