Fully responsive globals.php with vertical menu (#2460)
[openemr.git] / interface / billing / print_daysheet_report_num2.php
blob460011b5f1c1ab8635e790c3963a26ecc53ffafb
1 <?php
2 /*
3 * interface/billing/print_daysheet_report.php Genetating an end of day report.
5 * Program for Generating an End of Day report
8 * @package OpenEMR
9 * @link http://www.open-emr.org
10 * @author Terry Hill <terry@lillysystems.com>
11 * @copyright Copyright (c) 2014 Terry Hill <terry@lillysystems.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 require_once("../globals.php");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/../interface/reports/report.inc.php");
20 require_once("$srcdir/daysheet.inc.php");
22 //global variables:
23 if (!isset($_GET["mode"])) {
24 if (!isset($_GET["from_date"])) {
25 $from_date=date("Y-m-d");
26 } else {
27 $from_date = $_GET["from_date"];
30 if (!isset($_GET["to_date"])) {
31 $to_date = date("Y-m-d");
32 } else {
33 $to_date = $_GET["to_date"];
36 if (!isset($_GET["code_type"])) {
37 $code_type="all";
38 } else {
39 $code_type = $_GET["code_type"];
42 if (!isset($_GET["unbilled"])) {
43 $unbilled = "on";
44 } else {
45 $unbilled = $_GET["unbilled"];
48 if (!isset($_GET["authorized"])) {
49 $my_authorized = "on";
50 } else {
51 $my_authorized = $_GET["authorized"];
53 } else {
54 $from_date = $_GET["from_date"];
55 $to_date = $_GET["to_date"];
56 $code_type = $_GET["code_type"];
57 $unbilled = $_GET["unbilled"];
58 $my_authorized = $_GET["authorized"];
63 <html>
64 <head>
66 <link rel=stylesheet href="<?php echo $css_header;?>" type="text/css">
68 </head>
69 <body bgcolor="#ffffff" topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
71 <a href="javascript:window.close();" target=Main><font class=title><?php echo xlt('Day Sheet Report')?></font></a>
72 <br>
74 <?php
75 if ($my_authorized === 'on') {
76 $my_authorized = true;
77 } else {
78 $my_authorized = '%';
81 if ($unbilled === 'on') {
82 $unbilled = '0';
83 } else {
84 $unbilled = '%';
87 if ($code_type === 'all') {
88 $code_type = '%';
91 if (!isset($_GET["mode"])) {
92 if (!isset($_GET["from_date"])) {
93 $from_date=date("Y-m-d");
94 } else {
95 $from_date = $_GET["from_date"];
98 if (!isset($_GET["to_date"])) {
99 $to_date = date("Y-m-d");
100 } else {
101 $to_date = $_GET["to_date"];
104 if (!isset($_GET["code_type"])) {
105 $code_type="all";
106 } else {
107 $code_type = $_GET["code_type"];
110 if (!isset($_GET["unbilled"])) {
111 $unbilled = "on";
112 } else {
113 $unbilled = $_GET["unbilled"];
116 if (!isset($_GET["authorized"])) {
117 $my_authorized = "on";
118 } else {
119 $my_authorized = $_GET["authorized"];
121 } else {
122 $from_date = $_GET["from_date"];
123 $to_date = $_GET["to_date"];
124 $code_type = $_GET["code_type"];
125 $unbilled = $_GET["unbilled"];
126 $my_authorized = $_GET["authorized"];
129 if ($my_authorized === 'on') {
130 $my_authorized = true;
131 } else {
132 $my_authorized = '%';
135 if ($unbilled === 'on') {
136 $unbilled = '0';
137 } else {
138 $unbilled = '%';
141 if ($code_type === 'all') {
142 $code_type = '%';
145 if (isset($_GET["mode"]) && $_GET["mode"] === 'bill') {
146 billCodesList($list);
149 $res_count = 0;
150 $N = 1;
151 $k = 1;
152 $anypats = 0;
153 $the_first_time = 1;
154 $itero = array();
156 if ($ret = getBillsBetweendayReport($code_type)) {
157 // checking to see if there is any information in the array if not display a message (located after this if statment)
158 $anypats = count($ret);
161 $old_pid = -1;
162 $first_time = 1;
165 // $iter has encounter information
167 // this loop gathers the user numbers
168 foreach ($ret as $iter) {
169 $catch_user[] = $iter{'user'};
172 //This statment uniques the array removing duplicates
173 $user_list = array_unique($catch_user);
174 // reorder the list starting with array element zero
175 $final_list = array_values($user_list);
176 // sort array in assending order
177 sort($final_list);
179 $all4 = array_natsort($ret, pid, fulname, asc);
181 if ($_POST['end_of_day_totals_only'] == 1) {
182 $totals_only = 1;
185 foreach ($all4 as $iter) {
186 // Case statment to tally information by user
187 switch ($iter{'user'}) {
188 case $iter{'user'} = $final_list[0]:
189 $us0_user = $iter{'user'};
190 $us0_fee = $us0_fee + $iter{'fee'};
191 $us0_inspay = $us0_inspay + $iter{'ins_code'};
192 $us0_insadj = $us0_insadj + $iter{'ins_adjust_dollar'};
193 $us0_patadj = $us0_patadj + $iter{'pat_adjust_dollar'};
194 $us0_patpay = $us0_patpay + $iter{'pat_code'};
195 break;
196 case $iter{'user'} = $final_list[1]:
197 $us1_user = $iter{'user'};
198 $us1_fee = $us1_fee + $iter{'fee'};
199 $us1_inspay = $us1_inspay + $iter{'ins_code'};
200 $us1_insadj = $us1_insadj + $iter{'ins_adjust_dollar'};
201 $us1_patadj = $us1_patadj + $iter{'pat_adjust_dollar'};
202 $us1_patpay = $us1_patpay + $iter{'pat_code'};
203 break;
204 case $iter{'user'} = $final_list[2]:
205 $us2_user = $iter{'user'};
206 $us2_fee = $us2_fee + $iter{'fee'};
207 $us2_inspay = $us2_inspay + $iter{'ins_code'};
208 $us2_insadj = $us2_insadj + $iter{'ins_adjust_dollar'};
209 $us2_patadj = $us2_patadj + $iter{'pat_adjust_dollar'};
210 $us2_patpay = $us2_patpay + $iter{'pat_code'};
211 break;
212 case $iter{'user'} = $final_list[3]:
213 $us3_user = $iter{'user'};
214 $us3_fee = $us3_fee + $iter{'fee'};
215 $us3_inspay = $us3_inspay + $iter{'ins_code'};
216 $us3_insadj = $us3_insadj + $iter{'ins_adjust_dollar'};
217 $us3_patadj = $us3_patadj + $iter{'pat_adjust_dollar'};
218 $us3_patpay = $us3_patpay + $iter{'pat_code'};
219 break;
220 case $iter{'user'} = $final_list[4]:
221 $us4_user = $iter{'user'};
222 $us4_fee = $us4_fee + $iter{'fee'};
223 $us4_inspay = $us4_inspay + $iter{'ins_code'};
224 $us4_insadj = $us4_insadj + $iter{'ins_adjust_dollar'};
225 $us4_patadj = $us4_patadj + $iter{'pat_adjust_dollar'};
226 $us4_patpay = $us4_patpay + $iter{'pat_code'};
227 break;
228 case $iter{'user'} = $final_list[5]:
229 $us5_user = $iter{'user'};
230 $us5_fee = $us5_fee + $iter{'fee'};
231 $us5_inspay = $us5_inspay + $iter{'ins_code'};
232 $us5_insadj = $us5_insadj + $iter{'ins_adjust_dollar'};
233 $us5_patadj = $us5_patadj + $iter{'pat_adjust_dollar'};
234 $us5_patpay = $us5_patpay + $iter{'pat_code'};
235 break;
236 case $iter{'user'} = $final_list[6]:
237 $us6_user = $iter{'user'};
238 $us6_fee = $us6_fee + $iter{'fee'};
239 $us6_inspay = $us6_inspay + $iter{'ins_code'};
240 $us6_insadj = $us6_insadj + $iter{'ins_adjust_dollar'};
241 $us6_patadj = $us6_patadj + $iter{'pat_adjust_dollar'};
242 $us6_patpay = $us6_patpay + $iter{'pat_code'};
243 break;
244 case $iter{'user'} = $final_list[7]:
245 $us7_user = $iter{'user'};
246 $us7_fee = $us7_fee + $iter{'fee'};
247 $us7_inspay = $us7_inspay + $iter{'ins_code'};
248 $us7_insadj = $us7_insadj + $iter{'ins_adjust_dollar'};
249 $us7_patadj = $us7_patadj + $iter{'pat_adjust_dollar'};
250 $us7_patpay = $us7_patpay + $iter{'pat_code'};
251 break;
252 case $iter{'user'} = $final_list[8]:
253 $us8_user = $iter{'user'};
254 $us8_fee = $us8_fee + $iter{'fee'};
255 $us8_inspay = $us8_inspay + $iter{'ins_code'};
256 $us8_insadj = $us8_insadj + $iter{'ins_adjust_dollar'};
257 $us8_patadj = $us8_patadj + $iter{'pat_adjust_dollar'};
258 $us8_patpay = $us8_patpay + $iter{'pat_code'};
259 break;
260 case $iter{'user'} = $final_list[9]:
261 $us9_user = $iter{'user'};
262 $us9_fee = $us9_fee + $iter{'fee'};
263 $us9_inspay = $us9_inspay + $iter{'ins_code'};
264 $us9_insadj = $us9_insadj + $iter{'ins_adjust_dollar'};
265 $us9_patadj = $us9_patadj + $iter{'pat_adjust_dollar'};
266 $us9_patpay = $us9_patpay + $iter{'pat_code'};
267 break;
268 case $iter{'user'} = $final_list[10]:
269 $us10_user = $iter{'user'};
270 $us10_fee = $us10_fee + $iter{'fee'};
271 $us10_inspay = $us10_inspay + $iter{'ins_code'};
272 $us10_insadj = $us10_insadj + $iter{'ins_adjust_dollar'};
273 $us10_patadj = $us10_patadj + $iter{'pat_adjust_dollar'};
274 $us10_patpay = $us10_patpay + $iter{'pat_code'};
275 break;
276 case $iter{'user'} = $final_list[11]:
277 $us11_user = $iter{'user'};
278 $us11_fee = $us11_fee + $iter{'fee'};
279 $us11_inspay = $us11_inspay + $iter{'ins_code'};
280 $us11_insadj = $us11_insadj + $iter{'ins_adjust_dollar'};
281 $us11_patadj = $us11_patadj + $iter{'pat_adjust_dollar'};
282 $us11_patpay = $us11_patpay + $iter{'pat_code'};
283 break;
284 case $iter{'user'} = $final_list[12]:
285 $us12_user = $iter{'user'};
286 $us12_fee = $us12_fee + $iter{'fee'};
287 $us12_inspay = $us12_inspay + $iter{'ins_code'};
288 $us12_insadj = $us12_insadj + $iter{'ins_adjust_dollar'};
289 $us12_patadj = $us12_patadj + $iter{'pat_adjust_dollar'};
290 $us12_patpay = $us12_patpay + $iter{'pat_code'};
291 break;
292 case $iter{'user'} = $final_list[13]:
293 $us13_user = $iter{'user'};
294 $us13_fee = $us13_fee + $iter{'fee'};
295 $us13_inspay = $us13_inspay + $iter{'ins_code'};
296 $us13_insadj = $us13_insadj + $iter{'ins_adjust_dollar'};
297 $us13_patadj = $us13_patadj + $iter{'pat_adjust_dollar'};
298 $us13_patpay = $us13_patpay + $iter{'pat_code'};
299 break;
300 case $iter{'user'} = $final_list[14]:
301 $us14_user = $iter{'user'};
302 $us14_fee = $us14_fee + $iter{'fee'};
303 $us14_inspay = $us14_inspay + $iter{'ins_code'};
304 $us14_insadj = $us14_insadj + $iter{'ins_adjust_dollar'};
305 $us14_patadj = $us14_patadj + $iter{'pat_adjust_dollar'};
306 $us14_patpay = $us14_patpay + $iter{'pat_code'};
307 break;
308 case $iter{'user'} = $final_list[15]:
309 $us15_user = $iter{'user'};
310 $us15_fee = $us15_fee + $iter{'fee'};
311 $us15_inspay = $us15_inspay + $iter{'ins_code'};
312 $us15_insadj = $us15_insadj + $iter{'ins_adjust_dollar'};
313 $us15_patadj = $us15_patadj + $iter{'pat_adjust_dollar'};
314 $us15_patpay = $us15_patpay + $iter{'pat_code'};
315 break;
316 case $iter{'user'} = $final_list[16]:
317 $us16_user = $iter{'user'};
318 $us16_fee = $us16_fee + $iter{'fee'};
319 $us16_inspay = $us16_inspay + $iter{'ins_code'};
320 $us16_insadj = $us16_insadj + $iter{'ins_adjust_dollar'};
321 $us16_patadj = $us16_patadj + $iter{'pat_adjust_dollar'};
322 $us16_patpay = $us16_patpay + $iter{'pat_code'};
323 break;
324 case $iter{'user'} = $final_list[17]:
325 $us17_user = $iter{'user'};
326 $us17_fee = $us17_fee + $iter{'fee'};
327 $us17_inspay = $us17_inspay + $iter{'ins_code'};
328 $us17_insadj = $us17_insadj + $iter{'ins_adjust_dollar'};
329 $us17_patadj = $us17_patadj + $iter{'pat_adjust_dollar'};
330 $us17_patpay = $us17_patpay + $iter{'pat_code'};
331 break;
332 case $iter{'user'} = $final_list[18]:
333 $us18_user = $iter{'user'};
334 $us18_fee = $us18_fee + $iter{'fee'};
335 $us18_inspay = $us18_inspay + $iter{'ins_code'};
336 $us18_insadj = $us18_insadj + $iter{'ins_adjust_dollar'};
337 $us18_patadj = $us18_patadj + $iter{'pat_adjust_dollar'};
338 $us18_patpay = $us18_patpay + $iter{'pat_code'};
339 break;
340 case $iter{'user'} = $final_list[19]:
341 $us19_user = $iter{'user'};
342 $us19_fee = $us19_fee + $iter{'fee'};
343 $us19_inspay = $us19_inspay + $iter{'ins_code'};
344 $us19_insadj = $us19_insadj + $iter{'ins_adjust_dollar'};
345 $us19_patadj = $us19_patadj + $iter{'pat_adjust_dollar'};
346 $us19_patpay = $us19_patpay + $iter{'pat_code'};
347 break;
350 if ($the_first_time == 1) {
351 $user = $iter{'user'};
352 $first_user = $iter{'user'};
353 $the_first_time = 0;
356 if ($totals_only != 1) {
357 if ($old_pid != $iter{'pid'} and ($iter{'code_type'} != 'payment_info')) {
358 // $name has patient information
359 $name = getPatientData($iter{"pid"});
361 // formats the displayed text
363 if ($first_time) {
364 print "<table border=0><tr>\n"; // small table
365 $first_time=0;
368 // Displays name
369 print "<tr><td colspan=50><hr><span class=bold>" . " " . text($name{"fname"}) . " " . text($name{"lname"}) . "</span><br><br></td></tr><tr>\n";
370 //==================================
372 if ($iter{'code_type'} === 'COPAY' || $iter{'code_type'} === 'Patient Payment' || $iter{'code_type'} === 'Insurance Payment') {
373 print "<td width=40><span class=text><center><b>" . xlt("Units") . "</b></center>";
374 print "</span></td><td width=100><span class=text><center><b>" . xlt("Fee"). "</b></center>" ;
375 print "</span></td><td width=100><span class=text><center><b>" . xlt("Code"). "</b></center>" ;
376 print "</span></td><td width=100><span class=text><b>";
377 print "</span></td><td width=100><span class=text><center><b>" . xlt("User"). "</b></center>";
378 print "</span></td><td width=100><span class=small><b>";
379 print "</span></td><td width=100><span class=small><center><b>". xlt("Post Date"). "</b></center>";
380 print "</span></td><td></tr><tr>\n";
381 } else {
382 print "<td width=40><span class=text><b><center>" . xlt("Units"). "</b></center>";
383 print "</span></td><td width=100><span class=text><center><b>" . xlt("Fee"). "</b></center>";
384 print "</span></td><td width=100><span class=text><center><b>" . xlt("Code") . "</b></center>";
385 print "</span></td><td width=100><span class=text><b><center>" . xlt("Provider Id"). "</b></center>";
386 print "</span></td><td width=100><span class=text><b><center>" . xlt("User"). "</b></center>";
387 print "</span></td><td width=100><span class=small><center><b>" . xlt("Bill Date"). "</b></center>";
388 print "</span></td><td width=100><span class=small><center><b>". xlt("Date of Service"). "</b></center>";
389 print "</span></td><td width=100><span class=small><center><b>". xlt("Encounter"). "</b></center>";
390 print "</span></td><td></tr><tr>\n";
393 //Next patient
394 $old_pid = $iter{"pid"};
397 // get dollar amounts to appear on pat,ins payments and copays
399 if ($iter{'code_type'} != 'payment_info') {
400 if ($iter{'code_type'} === 'COPAY' || $iter{'code_type'} === 'Patient Payment' || $iter{'code_type'} === 'Insurance Payment') {
401 print "<td width=40><span class=text><center>" . "1". "</center>" ;
403 // start fee output
404 // [pat_code] => 0.00
405 // [ins_code] => 0.00
406 // [pat_adjust_dollar] => 0.00
407 // [ins_adjust_dollar] => 0.00
408 if (($iter{'ins_adjust_dollar'}) != 0 and ($iter{'code_type'}) === 'Insurance Payment') {
409 print "</span></td><td width=100><span class=text><center>" . text("(". $iter{'ins_adjust_dollar'}.")"). "</center>";
412 if (($iter{'ins_code'}) != 0 and ($iter{'code_type'}) === 'Insurance Payment') {
413 print "</span></td><td width=100><span class=text><center>" . text("(". $iter{'ins_code'}.")"). "</center>";
416 if (($iter{'code_type'}) != "Patient Payment" and ($iter{'code_type'}) != 'Insurance Payment') {
417 print "</span></td><td width=100><span class=text><center>" . text("(". $iter{"code"}.")"). "</center>";
420 if (($iter{'pat_adjust_dollar'}) != 0 and ($iter{'code_type'}) === 'Patient Payment') {
421 print "</span></td><td width=100><span class=text><center>" . text("(". $iter{'pat_adjust_dollar'}.")"). "</center>";
424 if (($iter{'pat_code'}) != 0 and ($iter{'code_type'}) === 'Patient Payment') {
425 print "</span></td><td width=100><span class=text><center>" . text("(". $iter{'pat_code'}.")"). "</center>";
428 // end fee output
430 if (($iter{'ins_adjust_dollar'}) != 0 and ($iter{'code_type'}) === 'Insurance Payment') {
431 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Adjustment'). "</center>";
434 if (($iter{'pat_adjust_dollar'}) != 0 and ($iter{'code_type'}) === 'Patient Payment') {
435 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Adjustment'). "</center>";
438 if (($iter{'ins_code'}) > 0 and ($iter{'code_type'}) === 'Insurance Payment') {
439 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Payment'). "</center>";
442 if (($iter{'pat_code'}) > 0 and ($iter{'code_type'}) === 'Patient Payment' and $iter{'paytype'} != 'PCP') {
443 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Payment'). "</center>";
446 if (($iter{'ins_code'}) < 0 and ($iter{'code_type'}) === 'Insurance Payment') {
447 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Credit'). "</center>";
450 if (($iter{'pat_code'}) < 0 and ($iter{'code_type'}) === 'Patient Payment' and $iter{'paytype'} != 'PCP') {
451 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Credit'). "</center>";
454 if ($iter{'paytype'} === 'PCP') {
455 print "</span></td><td width=250><span class=text><center>" . xlt('COPAY'). "</center>";
458 if (($iter{'code_type'}) != 'Insurance Payment' and ($iter{'code_type'}) != 'Patient Payment' and $iter{'paytype'} != 'PCP') {
459 print "</span></td><td width=100><span class=text><center>" . text($iter{'code_type'}). "</center>";
462 print "</span></td><td width=100><span class=text><center>" . text($iter{'provider_id'}). "</center>";
463 print "</span></td><td width=100><span class=text><center>" . text($iter{'user'}). "</center>" ;
464 print "</span></td><td width=100><span class=text>";
465 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter{"date"}))). "</center>";
466 print "</span></td>\n";
467 } else {
468 if (date("Y-m-d", strtotime($iter{'bill_date'})) === '1969-12-31') {
469 print "<td width=40><span class=text><center>" . text($iter{'units'}) . "</center>" ;
470 print "</span></td><td width=100><span class=text><center>" . text($iter{'fee'}) . "</center>";
471 if ($GLOBALS['language_default'] === 'English (Standard)') {
472 print "</span></td><td width=250><span class=text><center>" . text(ucwords(strtolower(substr($iter{'code_text'}, 0, 38)))) . "</center>";
473 } else {
474 print "</span></td><td width=250><span class=text><center>" . text(substr($iter{'code_text'}, 0, 38)) . "</center>";
477 print "</span></td><td width=100><span class=text><center>" . text($iter{'provider_id'}) . "</center>" ;
478 print "</span></td><td width=100><span class=text><center>" . text($iter{'user'}) . "</center>" ;
479 print "</span></td><td width=100><span class=text><center>" . xlt("Not Billed"). "</center>";
480 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter{'date'}))). "</center>";
481 print "</span></td><td width=100><span class=small><center>" . text($iter{'encounter'}). "</center>";
482 print "</span></td>\n";
483 } else {
484 if ($iter{'fee'} != 0) {
485 print "<td width=40><span class=text><center>" . text($iter{"units"}) . "</center>";
486 print "</span></td><td width=100><span class=text><center>" . text($iter{'fee'}) . "</center>";
487 if ($GLOBALS['language_default'] === 'English (Standard)') {
488 print "</span></td><td width=250><span class=text><center>" . text(ucwords(strtolower(substr($iter{'code_text'}, 0, 38)))) . "</center>";
489 } else {
490 print "</span></td><td width=250><span class=text><center>" . text(substr($iter{'code_text'}, 0, 38)) . "</center>";
493 print "</span></td><td width=100><span class=text><center>" . text($iter{'provider_id'}) . "</center>";
494 print "</span></td><td width=100><span class=text><center>" . text($iter{'user'}) . "</center>";
495 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter{'bill_date'}))) . "</center>";
496 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter{'date'}))). "</center>";
497 print "</span></td><td width=100><span class=small><center>" . text($iter{'encounter'}). "</center>";
498 print "</span></td>\n";
503 $res_count++;
505 if ($res_count == $N) {
506 print "</tr><tr>\n";
507 $res_count = 0;
510 $itero = $iter;
514 // end totals only
517 // end for
521 if ($anypats == 0) {
522 ?><font size = 5 ><?php echo xlt('No Data to Process')?></font><?php
525 // TEST TO SEE IF THERE IS INFORMATION IN THE VARAIBLES THEN ADD TO AN ARRAY FOR PRINTING
527 if ($us0_fee != 0 || $us0_inspay != 0 || $us0_insadj != 0 || $us0_patadj != 0 || $us0_patpay != 0) {
528 $user_info['user'][$k] = $us0_user;
529 $user_info['fee'][$k] = $us0_fee;
530 $user_info['inspay'][$k] = $us0_inspay;
531 $user_info['insadj'][$k] = $us0_insadj;
532 $user_info['patadj'][$k] = $us0_patadj;
533 $user_info['patpay'][$k] = $us0_patpay;
534 ++$k;
537 if ($us1_fee != 0 || $us1_inspay != 0 || $us1_insadj != 0 || $us1_patadj != 0 || $us1_patpay != 0) {
538 $user_info['user'][$k] = $us1_user;
539 $user_info['fee'][$k] = $us1_fee;
540 $user_info['inspay'][$k] = $us1_inspay;
541 $user_info['insadj'][$k] = $us1_insadj;
542 $user_info['patadj'][$k] = $us1_patadj;
543 $user_info['patpay'][$k] = $us1_patpay;
544 ++$k;
547 if ($us2_fee != 0 || $us2_inspay != 0 || $us2_insadj != 0 || $us2_patadj != 0 || $us2_patpay != 0) {
548 $user_info['user'][$k] = $us2_user;
549 $user_info['fee'][$k] = $us2_fee;
550 $user_info['inspay'][$k] = $us2_inspay;
551 $user_info['insadj'][$k] = $us2_insadj;
552 $user_info['patadj'][$k] = $us2_patadj;
553 $user_info['patpay'][$k] = $us2_patpay;
554 ++$k;
557 if ($us3_fee != 0 || $us3_inspay != 0 || $us3_insadj != 0 || $us3_patadj != 0 || $us3_patpay != 0) {
558 $user_info['user'][$k] = $us3_user;
559 $user_info['fee'][$k] = $us3_fee;
560 $user_info['inspay'][$k] = $us3_inspay;
561 $user_info['insadj'][$k] = $us3_insadj;
562 $user_info['patadj'][$k] = $us3_patadj;
563 $user_info['patpay'][$k] = $us3_patpay;
564 ++$k;
567 if ($us4_fee != 0 || $us4_inspay != 0 || $us4_insadj != 0 || $us4_patadj != 0 || $us4_patpay != 0) {
568 $user_info['user'][$k] = $us4_user;
569 $user_info['fee'][$k] = $us4_fee;
570 $user_info['inspay'][$k] = $us4_inspay;
571 $user_info['insadj'][$k] = $us4_insadj;
572 $user_info['patadj'][$k] = $us4_patadj;
573 $user_info['patpay'][$k] = $us4_patpay;
574 ++$k;
577 if ($us5_fee != 0 || $us5_inspay != 0 || $us5_insadj != 0 || $us5_patadj != 0 || $us5_patpay != 0) {
578 $user_info['user'][$k] = $us5_user;
579 $user_info['fee'][$k] = $us5_fee;
580 $user_info['inspay'][$k] = $us5_inspay;
581 $user_info['insadj'][$k] = $us5_insadj;
582 $user_info['patadj'][$k] = $us5_patadj;
583 $user_info['patpay'][$k] = $us5_patpay;
584 ++$k;
587 if ($us6_fee != 0 || $us6_inspay != 0 || $us6_insadj != 0 || $us6_patadj != 0 || $us6_patpay != 0) {
588 $user_info['user'][$k] = $us6_user;
589 $user_info['fee'][$k] = $us6_fee;
590 $user_info['inspay'][$k] = $us6_inspay;
591 $user_info['insadj'][$k] = $us6_insadj;
592 $user_info['patadj'][$k] = $us6_patadj;
593 $user_info['patpay'][$k] = $us6_patpay;
594 ++$k;
597 if ($us7_fee != 0 || $us7_inspay != 0 || $us7_insadj != 0 || $us7_patadj != 0 || $us7_patpay != 0) {
598 $user_info['user'][$k] = $us7_user;
599 $user_info['fee'][$k] = $us7_fee;
600 $user_info['inspay'][$k] = $us7_inspay;
601 $user_info['insadj'][$k] = $us7_insadj;
602 $user_info['patadj'][$k] = $us7_patadj;
603 $user_info['patpay'][$k] = $us7_patpay;
604 ++$k;
607 if ($us8_fee != 0 || $us8_inspay != 0 || $us8_insadj != 0 || $us8_patadj != 0 || $us8_patpay != 0) {
608 $user_info['user'][$k] = $us8_user;
609 $user_info['fee'][$k] = $us8_fee;
610 $user_info['inspay'][$k] = $us8_inspay;
611 $user_info['insadj'][$k] = $us8_insadj;
612 $user_info['patadj'][$k] = $us8_patadj;
613 $user_info['patpay'][$k] = $us8_patpay;
614 ++$k;
617 if ($us9_fee != 0 || $us9_inspay != 0 || $us9_insadj != 0 || $us9_patadj != 0 || $us9_patpay != 0) {
618 $user_info['user'][$k] = $us9_user;
619 $user_info['fee'][$k] = $us9_fee;
620 $user_info['inspay'][$k] = $us9_inspay;
621 $user_info['insadj'][$k] = $us9_insadj;
622 $user_info['patadj'][$k] = $us9_patadj;
623 $user_info['patpay'][$k] = $us9_patpay;
624 ++$k;
627 if ($us10_fee != 0 || $us10_inspay != 0 || $us10_insadj != 0 || $us10_patadj != 0 || $us10_patpay != 0) {
628 $user_info['user'][$k] = $us10_user;
629 $user_info['fee'][$k] = $us10_fee;
630 $user_info['inspay'][$k] = $us10_inspay;
631 $user_info['insadj'][$k] = $us10_insadj;
632 $user_info['patadj'][$k] = $us10_patadj;
633 $user_info['patpay'][$k] = $us10_patpay;
634 ++$k;
637 if ($us11_fee != 0 || $us11_inspay != 0 || $us11_insadj != 0 || $us11_patadj != 0 || $us11_patpay != 0) {
638 $user_info['user'][$k] = $us11_user;
639 $user_info['fee'][$k] = $us11_fee;
640 $user_info['inspay'][$k] = $us11_inspay;
641 $user_info['insadj'][$k] = $us11_insadj;
642 $user_info['patadj'][$k] = $us11_patadj;
643 $user_info['patpay'][$k] = $us11_patpay;
644 ++$k;
647 if ($us12_fee != 0 || $us12_inspay != 0 || $us12_insadj != 0 || $us12_patadj != 0 || $us12_patpay != 0) {
648 $user_info['user'][$k] = $us12_user;
649 $user_info['fee'][$k] = $us12_fee;
650 $user_info['inspay'][$k] = $us12_inspay;
651 $user_info['insadj'][$k] = $us12_insadj;
652 $user_info['patadj'][$k] = $us12_patadj;
653 $user_info['patpay'][$k] = $us12_patpay;
654 ++$k;
657 if ($us13_fee != 0 || $us13_inspay != 0 || $us13_insadj != 0 || $us13_patadj != 0 || $us13_patpay != 0) {
658 $user_info['user'][$k] = $us13_user;
659 $user_info['fee'][$k] = $us13_fee;
660 $user_info['inspay'][$k] = $us13_inspay;
661 $user_info['insadj'][$k] = $us13_insadj;
662 $user_info['patadj'][$k] = $us13_patadj;
663 $user_info['patpay'][$k] = $us13_patpay;
664 ++$k;
667 if ($us14_fee != 0 || $us14_inspay != 0 || $us14_insadj != 0 || $us14_patadj != 0 || $us14_patpay != 0) {
668 $user_info['user'][$k] = $us14_user;
669 $user_info['fee'][$k] = $us14_fee;
670 $user_info['inspay'][$k] = $us14_inspay;
671 $user_info['insadj'][$k] = $us14_insadj;
672 $user_info['patadj'][$k] = $us14_patadj;
673 $user_info['patpay'][$k] = $us14_patpay;
674 ++$k;
677 if ($us15_fee != 0 || $us15_inspay != 0 || $us15_insadj != 0 || $us15_patadj != 0 || $us15_patpay != 0) {
678 $user_info['user'][$k] = $us15_user;
679 $user_info['fee'][$k] = $us15_fee;
680 $user_info['inspay'][$k] = $us15_inspay;
681 $user_info['insadj'][$k] = $us15_insadj;
682 $user_info['patadj'][$k] = $us15_patadj;
683 $user_info['patpay'][$k] = $us15_patpay;
684 ++$k;
687 if ($us16_fee != 0 || $us16_inspay != 0 || $us16_insadj != 0 || $us16_patadj != 0 || $us16_patpay != 0) {
688 $user_info['user'][$k] = $us16_user;
689 $user_info['fee'][$k] = $us16_fee;
690 $user_info['inspay'][$k] = $us16_inspay;
691 $user_info['insadj'][$k] = $us16_insadj;
692 $user_info['patadj'][$k] = $us16_patadj;
693 $user_info['patpay'][$k] = $us16_patpay;
694 ++$k;
697 if ($us17_fee != 0 || $us17_inspay != 0 || $us17_insadj != 0 || $us17_patadj != 0 || $us17_patpay != 0) {
698 $user_info['user'][$k] = $us17_user;
699 $user_info['fee'][$k] = $us17_fee;
700 $user_info['inspay'][$k] = $us17_inspay;
701 $user_info['insadj'][$k] = $us17_insadj;
702 $user_info['patadj'][$k] = $us17_patadj;
703 $user_info['patpay'][$k] = $us17_patpay;
704 ++$k;
707 if ($us18_fee != 0 || $us18_inspay != 0 || $us18_insadj != 0 || $us18_patadj != 0 || $us18_patpay != 0) {
708 $user_info['user'][$k] = $us18_user;
709 $user_info['fee'][$k] = $us18_fee;
710 $user_info['inspay'][$k] = $us18_inspay;
711 $user_info['insadj'][$k] = $us18_insadj;
712 $user_info['patadj'][$k] = $us18_patadj;
713 $user_info['patpay'][$k] = $us18_patpay;
714 ++$k;
717 if ($us19_fee != 0 || $us19_inspay != 0 || $us19_insadj != 0 || $us19_patadj != 0 || $us19_patpay != 0) {
718 $user_info['user'][$k] = $us19_user;
719 $user_info['fee'][$k] = $us19_fee;
720 $user_info['inspay'][$k] = $us19_inspay;
721 $user_info['insadj'][$k] = $us19_insadj;
722 $user_info['patadj'][$k] = $us19_patadj;
723 $user_info['patpay'][$k] = $us19_patpay;
724 ++$k;
727 if ($totals_only == 1) {
728 $from_date = oeFormatShortDate(substr($query_part_day, 37, 10));
729 $to_date = oeFormatShortDate(substr($query_part_day, 63, 10));
730 print "<br><br>";
731 ?><font size = 5 ><?php echo xlt('Totals for '). text($from_date) . ' ' . xlt('To') . ' ' . text($to_date) ?></font><?php
734 for ($i=1; $i<$k;) {
735 print "<table border=1><tr>\n";
736 print "<br><br>";
738 Printf("<td width=70><span class=text><b>". xlt("User "). "</center></b><center>".text($user_info[user][$i])). "</center>";
739 Printf("<td width=140><span class=text><b><center>". xlt("Charges") . ' ' ."</center></b><center>"." %1\$.2f", text($user_info[fee][$i])). "</center>";
740 Printf("<td width=140><span class=text><b><center>". xlt("Insurance Adj").'. '."</center></b><center>"."%1\$.2f", text($user_info[insadj][$i])). "</center>";
741 Printf("<td width=140><span class=text><b><center>". xlt("Insurance Payments") . ' ' . "</center></b><center>"."%1\$.2f", text($user_info[inspay][$i])). "</center>";
742 Printf("<td width=140><span class=text><b><center>". xlt("Patient Adj").'. '."</center></b><center>"."%1\$.2f", text($user_info[patadj][$i])). "</center>";
743 Printf("<td width=140><span class=text><b><center>". xlt("Patient Payments"). ' ' ."</center></b><center>"."%1\$.2f", text($user_info[patpay][$i])). "</center>";
745 $gtotal_fee = $gtotal_fee + $user_info[fee][$i];
746 $gtotal_insadj = $gtotal_insadj + $user_info[insadj][$i];
747 $gtotal_inspay = $gtotal_inspay + $user_info[inspay][$i];
748 $gtotal_patadj = $gtotal_patadj + $user_info[patadj][$i];
749 $gtotal_patpay = $gtotal_patpay + $user_info[patpay][$i];
751 ++$i;
753 print "</br></td>";
756 print "<table border=1><tr>\n";
757 print "<br><br>";
759 Printf("<td width=70><span class=text><b><center>". xlt("Grand Totals").' ');
760 Printf("<td width=140><span class=text><b><center>". xlt("Total Charges").' '."</center></b><center>"." %1\$.2f", text($gtotal_fee)). "</center>";
761 Printf("<td width=140><span class=text><b><center>". xlt("Insurance Adj").'. '."</center></b><center>"."%1\$.2f", text($gtotal_insadj)). "</center>";
762 Printf("<td width=140><span class=text><b><center>". xlt("Insurance Payments") . ' ' ."</center></b><center>"."%1\$.2f", text($gtotal_inspay)). "</center>";
763 Printf("<td width=140><span class=text><b><center>". xlt("Patient Adj").'. '."</center></b><center>"."%1\$.2f", text($gtotal_patadj)). "</center>";
764 Printf("<td width=140><span class=text><b><center>". xlt("Patient Payments"). ' ' . "</center></b><center>"."%1\$.2f", text($gtotal_patpay)). "</center>";
766 print "</br></td>";
767 print "</table>";
770 </body>
771 </html>