4 * interface/billing/print_daysheet_report.php Genetating an end of day report.
6 * Program for Generating an End of Day report
10 * @link http://www.open-emr.org
11 * @author Terry Hill <terry@lillysystems.com>
12 * @copyright Copyright (c) 2014 Terry Hill <terry@lillysystems.com>
13 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 /* TODO: Code Cleanup */
19 require_once("../globals.php");
20 require_once("$srcdir/patient.inc.php");
21 require_once("$srcdir/daysheet.inc.php");
23 use OpenEMR\Billing\BillingReport
;
24 use OpenEMR\Common\Acl\AclMain
;
25 use OpenEMR\Common\Twig\TwigContainer
;
26 use OpenEMR\Core\Header
;
28 //ensure user has proper access
29 if (!AclMain
::aclCheckCore('acct', 'eob', '', 'write') && !AclMain
::aclCheckCore('acct', 'bill', '', 'write')) {
30 echo (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Billing Manager")]);
35 if (!isset($_GET["mode"])) {
36 if (!isset($_GET["from_date"])) {
37 $from_date = date("Y-m-d");
39 $from_date = $_GET["from_date"];
42 if (!isset($_GET["to_date"])) {
43 $to_date = date("Y-m-d");
45 $to_date = $_GET["to_date"];
48 if (!isset($_GET["code_type"])) {
51 $code_type = $_GET["code_type"];
54 if (!isset($_GET["unbilled"])) {
57 $unbilled = $_GET["unbilled"];
60 if (!isset($_GET["authorized"])) {
61 $my_authorized = "on";
63 $my_authorized = $_GET["authorized"];
66 $from_date = $_GET["from_date"];
67 $to_date = $_GET["to_date"];
68 $code_type = $_GET["code_type"];
69 $unbilled = $_GET["unbilled"];
70 $my_authorized = $_GET["authorized"];
78 <?php Header
::setupHeader(); ?
>
81 <body topmargin
="0" rightmargin
="0" leftmargin
="2" bottommargin
="0" marginwidth
="2" marginheight
="0">
83 <a href
="javascript:window.close();" target
="Main"><font
class="title"><?php
echo xlt('Day Sheet Report')?
></font
></a
>
87 if ($my_authorized === 'on') {
88 $my_authorized = true;
93 if ($unbilled === 'on') {
99 if ($code_type === 'all') {
103 if (!isset($_GET["mode"])) {
104 if (!isset($_GET["from_date"])) {
105 $from_date = date("Y-m-d");
107 $from_date = $_GET["from_date"];
110 if (!isset($_GET["to_date"])) {
111 $to_date = date("Y-m-d");
113 $to_date = $_GET["to_date"];
116 if (!isset($_GET["code_type"])) {
119 $code_type = $_GET["code_type"];
122 if (!isset($_GET["unbilled"])) {
125 $unbilled = $_GET["unbilled"];
128 if (!isset($_GET["authorized"])) {
129 $my_authorized = "on";
131 $my_authorized = $_GET["authorized"];
134 $from_date = $_GET["from_date"];
135 $to_date = $_GET["to_date"];
136 $code_type = $_GET["code_type"];
137 $unbilled = $_GET["unbilled"];
138 $my_authorized = $_GET["authorized"];
141 if ($my_authorized === 'on') {
142 $my_authorized = true;
144 $my_authorized = '%';
147 if ($unbilled === 'on') {
153 if ($code_type === 'all') {
157 if (isset($_GET["mode"]) && $_GET["mode"] === 'bill') {
158 billCodesList($list);
168 if ($ret = getBillsBetweendayReport($code_type)) {
169 // checking to see if there is any information in the array if not display a message (located after this if statment)
170 $anypats = count($ret);
177 // $iter has encounter information
179 // this loop gathers the user numbers
180 foreach ($ret as $iter) {
181 $catch_user[] = $iter['user'];
184 //This statment uniques the array removing duplicates
185 $user_list = array_unique($catch_user);
186 // reorder the list starting with array element zero
187 $final_list = array_values($user_list);
188 // sort array in assending order
191 $all4 = array_natsort($ret, pid
, fulname
, asc
);
193 if ($_POST['end_of_day_totals_only'] == 1) {
197 foreach ($all4 as $iter) {
198 // Case statment to tally information by user
199 switch ($iter['user']) {
200 case $iter['user'] = $final_list[0]:
201 $us0_user = $iter['user'];
202 $us0_fee = $us0_fee +
$iter['fee'];
203 $us0_inspay = $us0_inspay +
$iter['ins_code'];
204 $us0_insadj = $us0_insadj +
$iter['ins_adjust_dollar'];
205 $us0_patadj = $us0_patadj +
$iter['pat_adjust_dollar'];
206 $us0_patpay = $us0_patpay +
$iter['pat_code'];
208 case $iter['user'] = $final_list[1]:
209 $us1_user = $iter['user'];
210 $us1_fee = $us1_fee +
$iter['fee'];
211 $us1_inspay = $us1_inspay +
$iter['ins_code'];
212 $us1_insadj = $us1_insadj +
$iter['ins_adjust_dollar'];
213 $us1_patadj = $us1_patadj +
$iter['pat_adjust_dollar'];
214 $us1_patpay = $us1_patpay +
$iter['pat_code'];
216 case $iter['user'] = $final_list[2]:
217 $us2_user = $iter['user'];
218 $us2_fee = $us2_fee +
$iter['fee'];
219 $us2_inspay = $us2_inspay +
$iter['ins_code'];
220 $us2_insadj = $us2_insadj +
$iter['ins_adjust_dollar'];
221 $us2_patadj = $us2_patadj +
$iter['pat_adjust_dollar'];
222 $us2_patpay = $us2_patpay +
$iter['pat_code'];
224 case $iter['user'] = $final_list[3]:
225 $us3_user = $iter['user'];
226 $us3_fee = $us3_fee +
$iter['fee'];
227 $us3_inspay = $us3_inspay +
$iter['ins_code'];
228 $us3_insadj = $us3_insadj +
$iter['ins_adjust_dollar'];
229 $us3_patadj = $us3_patadj +
$iter['pat_adjust_dollar'];
230 $us3_patpay = $us3_patpay +
$iter['pat_code'];
232 case $iter['user'] = $final_list[4]:
233 $us4_user = $iter['user'];
234 $us4_fee = $us4_fee +
$iter['fee'];
235 $us4_inspay = $us4_inspay +
$iter['ins_code'];
236 $us4_insadj = $us4_insadj +
$iter['ins_adjust_dollar'];
237 $us4_patadj = $us4_patadj +
$iter['pat_adjust_dollar'];
238 $us4_patpay = $us4_patpay +
$iter['pat_code'];
240 case $iter['user'] = $final_list[5]:
241 $us5_user = $iter['user'];
242 $us5_fee = $us5_fee +
$iter['fee'];
243 $us5_inspay = $us5_inspay +
$iter['ins_code'];
244 $us5_insadj = $us5_insadj +
$iter['ins_adjust_dollar'];
245 $us5_patadj = $us5_patadj +
$iter['pat_adjust_dollar'];
246 $us5_patpay = $us5_patpay +
$iter['pat_code'];
248 case $iter['user'] = $final_list[6]:
249 $us6_user = $iter['user'];
250 $us6_fee = $us6_fee +
$iter['fee'];
251 $us6_inspay = $us6_inspay +
$iter['ins_code'];
252 $us6_insadj = $us6_insadj +
$iter['ins_adjust_dollar'];
253 $us6_patadj = $us6_patadj +
$iter['pat_adjust_dollar'];
254 $us6_patpay = $us6_patpay +
$iter['pat_code'];
256 case $iter['user'] = $final_list[7]:
257 $us7_user = $iter['user'];
258 $us7_fee = $us7_fee +
$iter['fee'];
259 $us7_inspay = $us7_inspay +
$iter['ins_code'];
260 $us7_insadj = $us7_insadj +
$iter['ins_adjust_dollar'];
261 $us7_patadj = $us7_patadj +
$iter['pat_adjust_dollar'];
262 $us7_patpay = $us7_patpay +
$iter['pat_code'];
264 case $iter['user'] = $final_list[8]:
265 $us8_user = $iter['user'];
266 $us8_fee = $us8_fee +
$iter['fee'];
267 $us8_inspay = $us8_inspay +
$iter['ins_code'];
268 $us8_insadj = $us8_insadj +
$iter['ins_adjust_dollar'];
269 $us8_patadj = $us8_patadj +
$iter['pat_adjust_dollar'];
270 $us8_patpay = $us8_patpay +
$iter['pat_code'];
272 case $iter['user'] = $final_list[9]:
273 $us9_user = $iter['user'];
274 $us9_fee = $us9_fee +
$iter['fee'];
275 $us9_inspay = $us9_inspay +
$iter['ins_code'];
276 $us9_insadj = $us9_insadj +
$iter['ins_adjust_dollar'];
277 $us9_patadj = $us9_patadj +
$iter['pat_adjust_dollar'];
278 $us9_patpay = $us9_patpay +
$iter['pat_code'];
280 case $iter['user'] = $final_list[10]:
281 $us10_user = $iter['user'];
282 $us10_fee = $us10_fee +
$iter['fee'];
283 $us10_inspay = $us10_inspay +
$iter['ins_code'];
284 $us10_insadj = $us10_insadj +
$iter['ins_adjust_dollar'];
285 $us10_patadj = $us10_patadj +
$iter['pat_adjust_dollar'];
286 $us10_patpay = $us10_patpay +
$iter['pat_code'];
288 case $iter['user'] = $final_list[11]:
289 $us11_user = $iter['user'];
290 $us11_fee = $us11_fee +
$iter['fee'];
291 $us11_inspay = $us11_inspay +
$iter['ins_code'];
292 $us11_insadj = $us11_insadj +
$iter['ins_adjust_dollar'];
293 $us11_patadj = $us11_patadj +
$iter['pat_adjust_dollar'];
294 $us11_patpay = $us11_patpay +
$iter['pat_code'];
296 case $iter['user'] = $final_list[12]:
297 $us12_user = $iter['user'];
298 $us12_fee = $us12_fee +
$iter['fee'];
299 $us12_inspay = $us12_inspay +
$iter['ins_code'];
300 $us12_insadj = $us12_insadj +
$iter['ins_adjust_dollar'];
301 $us12_patadj = $us12_patadj +
$iter['pat_adjust_dollar'];
302 $us12_patpay = $us12_patpay +
$iter['pat_code'];
304 case $iter['user'] = $final_list[13]:
305 $us13_user = $iter['user'];
306 $us13_fee = $us13_fee +
$iter['fee'];
307 $us13_inspay = $us13_inspay +
$iter['ins_code'];
308 $us13_insadj = $us13_insadj +
$iter['ins_adjust_dollar'];
309 $us13_patadj = $us13_patadj +
$iter['pat_adjust_dollar'];
310 $us13_patpay = $us13_patpay +
$iter['pat_code'];
312 case $iter['user'] = $final_list[14]:
313 $us14_user = $iter['user'];
314 $us14_fee = $us14_fee +
$iter['fee'];
315 $us14_inspay = $us14_inspay +
$iter['ins_code'];
316 $us14_insadj = $us14_insadj +
$iter['ins_adjust_dollar'];
317 $us14_patadj = $us14_patadj +
$iter['pat_adjust_dollar'];
318 $us14_patpay = $us14_patpay +
$iter['pat_code'];
320 case $iter['user'] = $final_list[15]:
321 $us15_user = $iter['user'];
322 $us15_fee = $us15_fee +
$iter['fee'];
323 $us15_inspay = $us15_inspay +
$iter['ins_code'];
324 $us15_insadj = $us15_insadj +
$iter['ins_adjust_dollar'];
325 $us15_patadj = $us15_patadj +
$iter['pat_adjust_dollar'];
326 $us15_patpay = $us15_patpay +
$iter['pat_code'];
328 case $iter['user'] = $final_list[16]:
329 $us16_user = $iter['user'];
330 $us16_fee = $us16_fee +
$iter['fee'];
331 $us16_inspay = $us16_inspay +
$iter['ins_code'];
332 $us16_insadj = $us16_insadj +
$iter['ins_adjust_dollar'];
333 $us16_patadj = $us16_patadj +
$iter['pat_adjust_dollar'];
334 $us16_patpay = $us16_patpay +
$iter['pat_code'];
336 case $iter['user'] = $final_list[17]:
337 $us17_user = $iter['user'];
338 $us17_fee = $us17_fee +
$iter['fee'];
339 $us17_inspay = $us17_inspay +
$iter['ins_code'];
340 $us17_insadj = $us17_insadj +
$iter['ins_adjust_dollar'];
341 $us17_patadj = $us17_patadj +
$iter['pat_adjust_dollar'];
342 $us17_patpay = $us17_patpay +
$iter['pat_code'];
344 case $iter['user'] = $final_list[18]:
345 $us18_user = $iter['user'];
346 $us18_fee = $us18_fee +
$iter['fee'];
347 $us18_inspay = $us18_inspay +
$iter['ins_code'];
348 $us18_insadj = $us18_insadj +
$iter['ins_adjust_dollar'];
349 $us18_patadj = $us18_patadj +
$iter['pat_adjust_dollar'];
350 $us18_patpay = $us18_patpay +
$iter['pat_code'];
352 case $iter['user'] = $final_list[19]:
353 $us19_user = $iter['user'];
354 $us19_fee = $us19_fee +
$iter['fee'];
355 $us19_inspay = $us19_inspay +
$iter['ins_code'];
356 $us19_insadj = $us19_insadj +
$iter['ins_adjust_dollar'];
357 $us19_patadj = $us19_patadj +
$iter['pat_adjust_dollar'];
358 $us19_patpay = $us19_patpay +
$iter['pat_code'];
362 if ($the_first_time == 1) {
363 $user = $iter['user'];
364 $first_user = $iter['user'];
368 if ($totals_only != 1) {
369 if ($old_pid != $iter['pid'] and ($iter['code_type'] != 'payment_info')) {
370 // $name has patient information
371 $name = getPatientData($iter["pid"]);
373 // formats the displayed text
376 print "<table border=0><tr>\n"; // small table
381 print "<tr><td colspan=50><hr><span class=bold>" . " " . text($name["fname"]) . " " . text($name["lname"]) . "</span><br /><br /></td></tr><tr>\n";
382 //==================================
384 if ($iter['code_type'] === 'COPAY' ||
$iter['code_type'] === 'Patient Payment' ||
$iter['code_type'] === 'Insurance Payment') {
385 print "<td width=40><span class=text><center><b>" . xlt("Units") . "</b></center>";
386 print "</span></td><td width=100><span class=text><center><b>" . xlt("Fee") . "</b></center>" ;
387 print "</span></td><td width=100><span class=text><center><b>" . xlt("Code") . "</b></center>" ;
388 print "</span></td><td width=100><span class=text><b>";
389 print "</span></td><td width=100><span class=text><center><b>" . xlt("User") . "</b></center>";
390 print "</span></td><td width=100><span class=small><b>";
391 print "</span></td><td width=100><span class=small><center><b>" . xlt("Post Date") . "</b></center>";
392 print "</span></td><td></tr><tr>\n";
394 print "<td width=40><span class=text><b><center>" . xlt("Units") . "</b></center>";
395 print "</span></td><td width=100><span class=text><center><b>" . xlt("Fee") . "</b></center>";
396 print "</span></td><td width=100><span class=text><center><b>" . xlt("Code") . "</b></center>";
397 print "</span></td><td width=100><span class=text><b><center>" . xlt("Provider Id") . "</b></center>";
398 print "</span></td><td width=100><span class=text><b><center>" . xlt("User") . "</b></center>";
399 print "</span></td><td width=100><span class=small><center><b>" . xlt("Bill Date") . "</b></center>";
400 print "</span></td><td width=100><span class=small><center><b>" . xlt("Date of Service") . "</b></center>";
401 print "</span></td><td width=100><span class=small><center><b>" . xlt("Encounter") . "</b></center>";
402 print "</span></td><td></tr><tr>\n";
406 $old_pid = $iter["pid"];
409 // get dollar amounts to appear on pat,ins payments and copays
411 if ($iter['code_type'] != 'payment_info') {
412 if ($iter['code_type'] === 'COPAY' ||
$iter['code_type'] === 'Patient Payment' ||
$iter['code_type'] === 'Insurance Payment') {
413 print "<td width=40><span class=text><center>" . "1" . "</center>" ;
416 // [pat_code] => 0.00
417 // [ins_code] => 0.00
418 // [pat_adjust_dollar] => 0.00
419 // [ins_adjust_dollar] => 0.00
420 if (($iter['ins_adjust_dollar']) != 0 and ($iter['code_type']) === 'Insurance Payment') {
421 print "</span></td><td width=100><span class=text><center>" . text("(" . $iter['ins_adjust_dollar'] . ")") . "</center>";
424 if (($iter['ins_code']) != 0 and ($iter['code_type']) === 'Insurance Payment') {
425 print "</span></td><td width=100><span class=text><center>" . text("(" . $iter['ins_code'] . ")") . "</center>";
428 if (($iter['code_type']) != "Patient Payment" and ($iter['code_type']) != 'Insurance Payment') {
429 print "</span></td><td width=100><span class=text><center>" . text("(" . $iter["code"] . ")") . "</center>";
432 if (($iter['pat_adjust_dollar']) != 0 and ($iter['code_type']) === 'Patient Payment') {
433 print "</span></td><td width=100><span class=text><center>" . text("(" . $iter['pat_adjust_dollar'] . ")") . "</center>";
436 if (($iter['pat_code']) != 0 and ($iter['code_type']) === 'Patient Payment') {
437 print "</span></td><td width=100><span class=text><center>" . text("(" . $iter['pat_code'] . ")") . "</center>";
442 if (($iter['ins_adjust_dollar']) != 0 and ($iter['code_type']) === 'Insurance Payment') {
443 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Adjustment') . "</center>";
446 if (($iter['pat_adjust_dollar']) != 0 and ($iter['code_type']) === 'Patient Payment') {
447 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Adjustment') . "</center>";
450 if (($iter['ins_code']) > 0 and ($iter['code_type']) === 'Insurance Payment') {
451 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Payment') . "</center>";
454 if (($iter['pat_code']) > 0 and ($iter['code_type']) === 'Patient Payment' and $iter['paytype'] != 'PCP') {
455 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Payment') . "</center>";
458 if (($iter['ins_code']) < 0 and ($iter['code_type']) === 'Insurance Payment') {
459 print "</span></td><td width=250><span class=text><center>" . xlt('Insurance Credit') . "</center>";
462 if (($iter['pat_code']) < 0 and ($iter['code_type']) === 'Patient Payment' and $iter['paytype'] != 'PCP') {
463 print "</span></td><td width=250><span class=text><center>" . xlt('Patient Credit') . "</center>";
466 if ($iter['paytype'] === 'PCP') {
467 print "</span></td><td width=250><span class=text><center>" . xlt('COPAY') . "</center>";
470 if (($iter['code_type']) != 'Insurance Payment' and ($iter['code_type']) != 'Patient Payment' and $iter['paytype'] != 'PCP') {
471 print "</span></td><td width=100><span class=text><center>" . text($iter['code_type']) . "</center>";
474 print "</span></td><td width=100><span class=text><center>" . text($iter['provider_id']) . "</center>";
475 print "</span></td><td width=100><span class=text><center>" . text($iter['user']) . "</center>" ;
476 print "</span></td><td width=100><span class=text>";
477 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter["date"]))) . "</center>";
478 print "</span></td>\n";
480 if (date("Y-m-d", strtotime($iter['bill_date'])) === '1969-12-31') {
481 print "<td width=40><span class=text><center>" . text($iter['units']) . "</center>" ;
482 print "</span></td><td width=100><span class=text><center>" . text($iter['fee']) . "</center>";
483 if ($GLOBALS['language_default'] === 'English (Standard)') {
484 print "</span></td><td width=250><span class=text><center>" . text(ucwords(strtolower(substr($iter['code_text'], 0, 38)))) . "</center>";
486 print "</span></td><td width=250><span class=text><center>" . text(substr($iter['code_text'], 0, 38)) . "</center>";
489 print "</span></td><td width=100><span class=text><center>" . text($iter['provider_id']) . "</center>" ;
490 print "</span></td><td width=100><span class=text><center>" . text($iter['user']) . "</center>" ;
491 print "</span></td><td width=100><span class=text><center>" . xlt("Not Billed") . "</center>";
492 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter['date']))) . "</center>";
493 print "</span></td><td width=100><span class=small><center>" . text($iter['encounter']) . "</center>";
494 print "</span></td>\n";
496 if ($iter['fee'] != 0) {
497 print "<td width=40><span class=text><center>" . text($iter["units"]) . "</center>";
498 print "</span></td><td width=100><span class=text><center>" . text($iter['fee']) . "</center>";
499 if ($GLOBALS['language_default'] === 'English (Standard)') {
500 print "</span></td><td width=250><span class=text><center>" . text(ucwords(strtolower(substr($iter['code_text'], 0, 38)))) . "</center>";
502 print "</span></td><td width=250><span class=text><center>" . text(substr($iter['code_text'], 0, 38)) . "</center>";
505 print "</span></td><td width=100><span class=text><center>" . text($iter['provider_id']) . "</center>";
506 print "</span></td><td width=100><span class=text><center>" . text($iter['user']) . "</center>";
507 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter['bill_date']))) . "</center>";
508 print "</span></td><td width=100><span class=small><center>" . text(date("Y-m-d", strtotime($iter['date']))) . "</center>";
509 print "</span></td><td width=100><span class=small><center>" . text($iter['encounter']) . "</center>";
510 print "</span></td>\n";
517 if ($res_count == $N) {
534 ?
><font size
= 5 ><?php
echo xlt('No Data to Process')?
></font
><?php
537 // TEST TO SEE IF THERE IS INFORMATION IN THE VARAIBLES THEN ADD TO AN ARRAY FOR PRINTING
539 if ($us0_fee != 0 ||
$us0_inspay != 0 ||
$us0_insadj != 0 ||
$us0_patadj != 0 ||
$us0_patpay != 0) {
540 $user_info['user'][$k] = $us0_user;
541 $user_info['fee'][$k] = $us0_fee;
542 $user_info['inspay'][$k] = $us0_inspay;
543 $user_info['insadj'][$k] = $us0_insadj;
544 $user_info['patadj'][$k] = $us0_patadj;
545 $user_info['patpay'][$k] = $us0_patpay;
549 if ($us1_fee != 0 ||
$us1_inspay != 0 ||
$us1_insadj != 0 ||
$us1_patadj != 0 ||
$us1_patpay != 0) {
550 $user_info['user'][$k] = $us1_user;
551 $user_info['fee'][$k] = $us1_fee;
552 $user_info['inspay'][$k] = $us1_inspay;
553 $user_info['insadj'][$k] = $us1_insadj;
554 $user_info['patadj'][$k] = $us1_patadj;
555 $user_info['patpay'][$k] = $us1_patpay;
559 if ($us2_fee != 0 ||
$us2_inspay != 0 ||
$us2_insadj != 0 ||
$us2_patadj != 0 ||
$us2_patpay != 0) {
560 $user_info['user'][$k] = $us2_user;
561 $user_info['fee'][$k] = $us2_fee;
562 $user_info['inspay'][$k] = $us2_inspay;
563 $user_info['insadj'][$k] = $us2_insadj;
564 $user_info['patadj'][$k] = $us2_patadj;
565 $user_info['patpay'][$k] = $us2_patpay;
569 if ($us3_fee != 0 ||
$us3_inspay != 0 ||
$us3_insadj != 0 ||
$us3_patadj != 0 ||
$us3_patpay != 0) {
570 $user_info['user'][$k] = $us3_user;
571 $user_info['fee'][$k] = $us3_fee;
572 $user_info['inspay'][$k] = $us3_inspay;
573 $user_info['insadj'][$k] = $us3_insadj;
574 $user_info['patadj'][$k] = $us3_patadj;
575 $user_info['patpay'][$k] = $us3_patpay;
579 if ($us4_fee != 0 ||
$us4_inspay != 0 ||
$us4_insadj != 0 ||
$us4_patadj != 0 ||
$us4_patpay != 0) {
580 $user_info['user'][$k] = $us4_user;
581 $user_info['fee'][$k] = $us4_fee;
582 $user_info['inspay'][$k] = $us4_inspay;
583 $user_info['insadj'][$k] = $us4_insadj;
584 $user_info['patadj'][$k] = $us4_patadj;
585 $user_info['patpay'][$k] = $us4_patpay;
589 if ($us5_fee != 0 ||
$us5_inspay != 0 ||
$us5_insadj != 0 ||
$us5_patadj != 0 ||
$us5_patpay != 0) {
590 $user_info['user'][$k] = $us5_user;
591 $user_info['fee'][$k] = $us5_fee;
592 $user_info['inspay'][$k] = $us5_inspay;
593 $user_info['insadj'][$k] = $us5_insadj;
594 $user_info['patadj'][$k] = $us5_patadj;
595 $user_info['patpay'][$k] = $us5_patpay;
599 if ($us6_fee != 0 ||
$us6_inspay != 0 ||
$us6_insadj != 0 ||
$us6_patadj != 0 ||
$us6_patpay != 0) {
600 $user_info['user'][$k] = $us6_user;
601 $user_info['fee'][$k] = $us6_fee;
602 $user_info['inspay'][$k] = $us6_inspay;
603 $user_info['insadj'][$k] = $us6_insadj;
604 $user_info['patadj'][$k] = $us6_patadj;
605 $user_info['patpay'][$k] = $us6_patpay;
609 if ($us7_fee != 0 ||
$us7_inspay != 0 ||
$us7_insadj != 0 ||
$us7_patadj != 0 ||
$us7_patpay != 0) {
610 $user_info['user'][$k] = $us7_user;
611 $user_info['fee'][$k] = $us7_fee;
612 $user_info['inspay'][$k] = $us7_inspay;
613 $user_info['insadj'][$k] = $us7_insadj;
614 $user_info['patadj'][$k] = $us7_patadj;
615 $user_info['patpay'][$k] = $us7_patpay;
619 if ($us8_fee != 0 ||
$us8_inspay != 0 ||
$us8_insadj != 0 ||
$us8_patadj != 0 ||
$us8_patpay != 0) {
620 $user_info['user'][$k] = $us8_user;
621 $user_info['fee'][$k] = $us8_fee;
622 $user_info['inspay'][$k] = $us8_inspay;
623 $user_info['insadj'][$k] = $us8_insadj;
624 $user_info['patadj'][$k] = $us8_patadj;
625 $user_info['patpay'][$k] = $us8_patpay;
629 if ($us9_fee != 0 ||
$us9_inspay != 0 ||
$us9_insadj != 0 ||
$us9_patadj != 0 ||
$us9_patpay != 0) {
630 $user_info['user'][$k] = $us9_user;
631 $user_info['fee'][$k] = $us9_fee;
632 $user_info['inspay'][$k] = $us9_inspay;
633 $user_info['insadj'][$k] = $us9_insadj;
634 $user_info['patadj'][$k] = $us9_patadj;
635 $user_info['patpay'][$k] = $us9_patpay;
639 if ($us10_fee != 0 ||
$us10_inspay != 0 ||
$us10_insadj != 0 ||
$us10_patadj != 0 ||
$us10_patpay != 0) {
640 $user_info['user'][$k] = $us10_user;
641 $user_info['fee'][$k] = $us10_fee;
642 $user_info['inspay'][$k] = $us10_inspay;
643 $user_info['insadj'][$k] = $us10_insadj;
644 $user_info['patadj'][$k] = $us10_patadj;
645 $user_info['patpay'][$k] = $us10_patpay;
649 if ($us11_fee != 0 ||
$us11_inspay != 0 ||
$us11_insadj != 0 ||
$us11_patadj != 0 ||
$us11_patpay != 0) {
650 $user_info['user'][$k] = $us11_user;
651 $user_info['fee'][$k] = $us11_fee;
652 $user_info['inspay'][$k] = $us11_inspay;
653 $user_info['insadj'][$k] = $us11_insadj;
654 $user_info['patadj'][$k] = $us11_patadj;
655 $user_info['patpay'][$k] = $us11_patpay;
659 if ($us12_fee != 0 ||
$us12_inspay != 0 ||
$us12_insadj != 0 ||
$us12_patadj != 0 ||
$us12_patpay != 0) {
660 $user_info['user'][$k] = $us12_user;
661 $user_info['fee'][$k] = $us12_fee;
662 $user_info['inspay'][$k] = $us12_inspay;
663 $user_info['insadj'][$k] = $us12_insadj;
664 $user_info['patadj'][$k] = $us12_patadj;
665 $user_info['patpay'][$k] = $us12_patpay;
669 if ($us13_fee != 0 ||
$us13_inspay != 0 ||
$us13_insadj != 0 ||
$us13_patadj != 0 ||
$us13_patpay != 0) {
670 $user_info['user'][$k] = $us13_user;
671 $user_info['fee'][$k] = $us13_fee;
672 $user_info['inspay'][$k] = $us13_inspay;
673 $user_info['insadj'][$k] = $us13_insadj;
674 $user_info['patadj'][$k] = $us13_patadj;
675 $user_info['patpay'][$k] = $us13_patpay;
679 if ($us14_fee != 0 ||
$us14_inspay != 0 ||
$us14_insadj != 0 ||
$us14_patadj != 0 ||
$us14_patpay != 0) {
680 $user_info['user'][$k] = $us14_user;
681 $user_info['fee'][$k] = $us14_fee;
682 $user_info['inspay'][$k] = $us14_inspay;
683 $user_info['insadj'][$k] = $us14_insadj;
684 $user_info['patadj'][$k] = $us14_patadj;
685 $user_info['patpay'][$k] = $us14_patpay;
689 if ($us15_fee != 0 ||
$us15_inspay != 0 ||
$us15_insadj != 0 ||
$us15_patadj != 0 ||
$us15_patpay != 0) {
690 $user_info['user'][$k] = $us15_user;
691 $user_info['fee'][$k] = $us15_fee;
692 $user_info['inspay'][$k] = $us15_inspay;
693 $user_info['insadj'][$k] = $us15_insadj;
694 $user_info['patadj'][$k] = $us15_patadj;
695 $user_info['patpay'][$k] = $us15_patpay;
699 if ($us16_fee != 0 ||
$us16_inspay != 0 ||
$us16_insadj != 0 ||
$us16_patadj != 0 ||
$us16_patpay != 0) {
700 $user_info['user'][$k] = $us16_user;
701 $user_info['fee'][$k] = $us16_fee;
702 $user_info['inspay'][$k] = $us16_inspay;
703 $user_info['insadj'][$k] = $us16_insadj;
704 $user_info['patadj'][$k] = $us16_patadj;
705 $user_info['patpay'][$k] = $us16_patpay;
709 if ($us17_fee != 0 ||
$us17_inspay != 0 ||
$us17_insadj != 0 ||
$us17_patadj != 0 ||
$us17_patpay != 0) {
710 $user_info['user'][$k] = $us17_user;
711 $user_info['fee'][$k] = $us17_fee;
712 $user_info['inspay'][$k] = $us17_inspay;
713 $user_info['insadj'][$k] = $us17_insadj;
714 $user_info['patadj'][$k] = $us17_patadj;
715 $user_info['patpay'][$k] = $us17_patpay;
719 if ($us18_fee != 0 ||
$us18_inspay != 0 ||
$us18_insadj != 0 ||
$us18_patadj != 0 ||
$us18_patpay != 0) {
720 $user_info['user'][$k] = $us18_user;
721 $user_info['fee'][$k] = $us18_fee;
722 $user_info['inspay'][$k] = $us18_inspay;
723 $user_info['insadj'][$k] = $us18_insadj;
724 $user_info['patadj'][$k] = $us18_patadj;
725 $user_info['patpay'][$k] = $us18_patpay;
729 if ($us19_fee != 0 ||
$us19_inspay != 0 ||
$us19_insadj != 0 ||
$us19_patadj != 0 ||
$us19_patpay != 0) {
730 $user_info['user'][$k] = $us19_user;
731 $user_info['fee'][$k] = $us19_fee;
732 $user_info['inspay'][$k] = $us19_inspay;
733 $user_info['insadj'][$k] = $us19_insadj;
734 $user_info['patadj'][$k] = $us19_patadj;
735 $user_info['patpay'][$k] = $us19_patpay;
739 if ($totals_only == 1) {
740 $from_date = oeFormatShortDate(substr($query_part_day, 37, 10));
741 $to_date = oeFormatShortDate(substr($query_part_day, 63, 10));
742 print "<br /><br />";
743 ?
><font size
= 5 ><?php
echo xlt('Totals for ') . text($from_date) . ' ' . xlt('To{{Range}}') . ' ' . text($to_date) ?
></font
><?php
746 for ($i = 1; $i < $k;) {
747 print "<table border=1><tr>\n";
748 print "<br /><br />";
750 Printf("<td width=70><span class=text><b>" . xlt("User ") . "</center></b><center>" . text($user_info['user'][$i])) . "</center>";
751 Printf("<td width=140><span class=text><b><center>" . xlt("Charges") . ' ' . "</center></b><center>" . " %1\$.2f", text($user_info['fee'][$i])) . "</center>";
752 Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($user_info['insadj'][$i])) . "</center>";
753 Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($user_info['inspay'][$i])) . "</center>";
754 Printf("<td width=140><span class=text><b><center>" . xlt("Patient Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($user_info['patadj'][$i])) . "</center>";
755 Printf("<td width=140><span class=text><b><center>" . xlt("Patient Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($user_info['patpay'][$i])) . "</center>";
757 $gtotal_fee = $gtotal_fee +
$user_info['fee'][$i];
758 $gtotal_insadj = $gtotal_insadj +
$user_info['insadj'][$i];
759 $gtotal_inspay = $gtotal_inspay +
$user_info['inspay'][$i];
760 $gtotal_patadj = $gtotal_patadj +
$user_info['patadj'][$i];
761 $gtotal_patpay = $gtotal_patpay +
$user_info['patpay'][$i];
768 print "<table border=1><tr>\n";
769 print "<br /><br />";
771 Printf("<td width=70><span class=text><b><center>" . xlt("Grand Totals") . ' ');
772 Printf("<td width=140><span class=text><b><center>" . xlt("Total Charges") . ' ' . "</center></b><center>" . " %1\$.2f", text($gtotal_fee)) . "</center>";
773 Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($gtotal_insadj)) . "</center>";
774 Printf("<td width=140><span class=text><b><center>" . xlt("Insurance Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($gtotal_inspay)) . "</center>";
775 Printf("<td width=140><span class=text><b><center>" . xlt("Patient Adj") . '. ' . "</center></b><center>" . "%1\$.2f", text($gtotal_patadj)) . "</center>";
776 Printf("<td width=140><span class=text><b><center>" . xlt("Patient Payments") . ' ' . "</center></b><center>" . "%1\$.2f", text($gtotal_patpay)) . "</center>";