6 * @link http://www.open-emr.org
7 * @author Rod Roark <rod@sunsetsystems.com>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2006-2016 Rod Roark <rod@sunsetsystems.com>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 require_once("../globals.php");
15 require_once("$srcdir/acl.inc");
16 require_once("$srcdir/patient.inc");
17 require_once("$srcdir/payment.inc.php");
18 require_once("$srcdir/forms.inc");
19 require_once("$srcdir/invoice_summary.inc.php");
20 require_once("../../custom/code_types.inc.php");
21 require_once("$srcdir/options.inc.php");
22 require_once("$srcdir/encounter_events.inc.php");
24 use OpenEMR\Billing\BillingUtilities
;
25 use OpenEMR\Common\Csrf\CsrfUtils
;
26 use OpenEMR\Core\Header
;
27 use OpenEMR\OeUI\OemrUI
;
28 use OpenEMR\Services\FacilityService
;
30 $pid = $_REQUEST['hidden_patient_code'] > 0 ?
$_REQUEST['hidden_patient_code'] : $pid;
32 $facilityService = new FacilityService();
38 <?php Header
::setupHeader(['opener']);?
>
41 // Format dollars for display.
43 function bucks($amount)
46 $amount = oeFormatMoney($amount);
52 function rawbucks($amount)
55 $amount = sprintf("%.2f", $amount);
61 // Display a row of data for an encounter.
64 function echoLine($iname, $date, $charges, $ptpaid, $inspaid, $duept, $encounter = 0, $copay = 0, $patcopay = 0)
68 $balance = bucks($charges - $ptpaid - $inspaid);
69 $balance = (round($duept, 2) != 0) ?
0 : $balance;//if balance is due from patient, then insurance balance is displayed as zero
70 $encounter = $encounter ?
$encounter : '';
71 echo " <tr id='tr_" . attr($var_index) . "' >\n";
72 echo " <td class='detail'>" . text(oeFormatShortDate($date)) . "</td>\n";
73 echo " <td class='detail' id='" . attr($date) . "' align='center'>" . text($encounter) . "</td>\n";
74 echo " <td class='detail' align='center' id='td_charges_$var_index' >" . text(bucks($charges)) . "</td>\n";
75 echo " <td class='detail' align='center' id='td_inspaid_$var_index' >" . text(bucks($inspaid * -1)) . "</td>\n";
76 echo " <td class='detail' align='center' id='td_ptpaid_$var_index' >" . text(bucks($ptpaid * -1)) . "</td>\n";
77 echo " <td class='detail' align='center' id='td_patient_copay_$var_index' >" . text(bucks($patcopay)) . "</td>\n";
78 echo " <td class='detail' align='center' id='td_copay_$var_index' >" . text(bucks($copay)) . "</td>\n";
79 echo " <td class='detail' align='center' id='balance_$var_index'>" . text(bucks($balance)) . "</td>\n";
80 echo " <td class='detail' align='center' id='duept_$var_index'>" . text(bucks(round($duept, 2) * 1)) . "</td>\n";
81 echo " <td class='detail' align='right'><input type='text' name='" . attr($iname) . "' id='paying_" . attr($var_index) . "' " .
82 " value='' onchange='coloring();calctotal()' autocomplete='off' " .
83 "onkeyup='calctotal()' style='width:50px'/></td>\n";
87 // We use this to put dashes, colons, etc. back into a timestamp.
89 function decorateString($fmt, $str)
93 $fc = substr($fmt, 0, 1);
94 $fmt = substr($fmt, 1);
96 $res .= substr($str, 0, 1);
97 $str = substr($str, 1);
106 // Compute taxes from a tax rate string and a possibly taxable amount.
108 function calcTaxes($row, $amount)
111 if (empty($row['taxrates'])) {
115 $arates = explode(':', $row['taxrates']);
116 if (empty($arates)) {
120 foreach ($arates as $value) {
125 $trow = sqlQuery("SELECT option_value FROM list_options WHERE " .
126 "list_id = 'taxrate' AND option_id = ? AND activity = 1 LIMIT 1", array($value));
127 if (empty($trow['option_value'])) {
128 echo "<!-- Missing tax rate '" . text($value) . "'! -->\n";
132 $tax = sprintf("%01.2f", $amount * $trow['option_value']);
133 // echo "<!-- Rate = '$value', amount = '$amount', tax = '$tax' -->\n";
141 $today = date('Y-m-d', $now);
142 $timestamp = date('Y-m-d H:i:s', $now);
145 // $patdata = getPatientData($pid, 'fname,lname,pubpid');
147 $patdata = sqlQuery("SELECT " .
148 "p.fname, p.mname, p.lname, p.pubpid,p.pid, i.copay " .
149 "FROM patient_data AS p " .
150 "LEFT OUTER JOIN insurance_data AS i ON " .
151 "i.pid = p.pid AND i.type = 'primary' " .
152 "WHERE p.pid = ? ORDER BY i.date DESC LIMIT 1", array($pid));
154 $alertmsg = ''; // anything here pops up in an alert box
156 // If the Save button was clicked...
157 if ($_POST['form_save']) {
158 if (!CsrfUtils
::verifyCsrfToken($_POST["csrf_token_form"])) {
159 CsrfUtils
::csrfNotVerified();
162 $form_pid = $_POST['form_pid'];
163 $form_method = trim($_POST['form_method']);
164 $form_source = trim($_POST['form_source']);
165 $patdata = getPatientData($form_pid, 'fname,mname,lname,pubpid');
166 $NameNew = $patdata['fname'] . " " . $patdata['lname'] . " " . $patdata['mname'];
168 if ($_REQUEST['radio_type_of_payment'] == 'pre_payment') {
169 $payment_id = sqlInsert(
170 "insert into ar_session set " .
176 ", check_date = now() , deposit_date = now() " .
178 ", payment_type = 'patient'" .
179 ", description = ?" .
180 ", adjustment_code = 'pre_payment'" .
181 ", post_to_date = now() " .
182 ", payment_method = ?",
183 array(0, $form_pid, $_SESSION['authUserID'], 0, $form_source, $_REQUEST['form_prepayment'], $NameNew, $form_method)
186 frontPayment($form_pid, 0, $form_method, $form_source, $_REQUEST['form_prepayment'], 0, $timestamp);//insertion to 'payments' table.
189 if ($_POST['form_upay'] && $_REQUEST['radio_type_of_payment'] != 'pre_payment') {
190 foreach ($_POST['form_upay'] as $enc => $payment) {
191 if ($amount = 0 +
$payment) {
193 if ($_REQUEST['radio_type_of_payment'] == 'invoice_balance') {
195 $enc = calendar_arrived($form_pid);
199 $enc = calendar_arrived($form_pid);
203 //----------------------------------------------------------------------------------------------------
204 //Fetching the existing code and modifier
205 $ResultSearchNew = sqlStatement(
206 "SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key ".
207 "WHERE code_types.ct_fee=1 AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier",
208 array($form_pid, $enc)
210 if ($RowSearch = sqlFetchArray($ResultSearchNew)) {
211 $Codetype = $RowSearch['code_type'];
212 $Code = $RowSearch['code'];
213 $Modifier = $RowSearch['modifier'];
220 //----------------------------------------------------------------------------------------------------
221 if ($_REQUEST['radio_type_of_payment'] == 'copay') {//copay saving to ar_session and ar_activity tables
222 $session_id = sqlInsert(
223 "INSERT INTO ar_session (payer_id,user_id,reference,check_date,deposit_date,pay_total," .
224 " global_amount,payment_type,description,patient_id,payment_method,adjustment_code,post_to_date) " .
225 " VALUES ('0',?,?,now(),now(),?,'','patient','COPAY',?,?,'patient_payment',now())",
226 array($_SESSION['authId'], $form_source, $amount, $form_pid, $form_method)
230 $sequence_no = sqlQuery("SELECT IFNULL(MAX(sequence_no),0) + 1 AS increment FROM ar_activity WHERE pid = ? AND encounter = ?", array($form_pid, $enc));
232 "INSERT INTO ar_activity (pid,encounter,sequence_no,code_type,code,modifier,payer_type,post_time,post_user,session_id,pay_amount,account_code)".
233 " VALUES (?,?,?,?,?,?,0,now(),?,?,?,'PCP')",
234 array($form_pid, $enc, $sequence_no['increment'], $Codetype, $Code, $Modifier, $_SESSION['authId'], $session_id, $amount)
238 frontPayment($form_pid, $enc, $form_method, $form_source, $amount, 0, $timestamp);//insertion to 'payments' table.
241 if ($_REQUEST['radio_type_of_payment'] == 'invoice_balance' ||
$_REQUEST['radio_type_of_payment'] == 'cash') { //Payment by patient after insurance paid, cash patients similar to do not bill insurance in feesheet.
242 if ($_REQUEST['radio_type_of_payment'] == 'cash') {
244 "update form_encounter set last_level_closed=? where encounter=? and pid=? ",
245 array(4, $enc, $form_pid)
248 "update billing set billed=? where encounter=? and pid=?",
249 array(1, $enc, $form_pid)
253 $adjustment_code = 'patient_payment';
254 $payment_id = sqlInsert(
255 "insert into ar_session set " .
261 ", check_date = now() , deposit_date = now() " .
263 ", payment_type = 'patient'" .
264 ", description = ?" .
265 ", adjustment_code = ?" .
266 ", post_to_date = now() " .
267 ", payment_method = ?",
268 array(0, $form_pid, $_SESSION['authUserID'], 0, $form_source, $amount, $NameNew, $adjustment_code, $form_method)
271 //--------------------------------------------------------------------------------------------------------------------
273 frontPayment($form_pid, $enc, $form_method, $form_source, 0, $amount, $timestamp);//insertion to 'payments' table.
275 //--------------------------------------------------------------------------------------------------------------------
277 $resMoneyGot = sqlStatement(
278 "SELECT sum(pay_amount) as PatientPay FROM ar_activity where pid =? and " .
279 "encounter =? and payer_type=0 and account_code='PCP'",
280 array($form_pid, $enc)
281 );//new fees screen copay gives account_code='PCP'
282 $rowMoneyGot = sqlFetchArray($resMoneyGot);
283 $Copay = $rowMoneyGot['PatientPay'];
285 //--------------------------------------------------------------------------------------------------------------------
287 //Looping the existing code and modifier
288 $ResultSearchNew = sqlStatement(
289 "SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key WHERE code_types.ct_fee=1 " .
290 "AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier",
291 array($form_pid, $enc)
293 while ($RowSearch = sqlFetchArray($ResultSearchNew)) {
294 $Codetype = $RowSearch['code_type'];
295 $Code = $RowSearch['code'];
296 $Modifier = $RowSearch['modifier'];
297 $Fee = $RowSearch['fee'];
299 $resMoneyGot = sqlStatement(
300 "SELECT sum(pay_amount) as MoneyGot FROM ar_activity where pid =? " .
301 "and code_type=? and code=? and modifier=? and encounter =? and !(payer_type=0 and account_code='PCP')",
302 array($form_pid, $Codetype, $Code, $Modifier, $enc)
304 //new fees screen copay gives account_code='PCP'
305 $rowMoneyGot = sqlFetchArray($resMoneyGot);
306 $MoneyGot = $rowMoneyGot['MoneyGot'];
308 $resMoneyAdjusted = sqlStatement(
309 "SELECT sum(adj_amount) as MoneyAdjusted FROM ar_activity where " .
310 "pid =? and code_type=? and code=? and modifier=? and encounter =?",
311 array($form_pid, $Codetype, $Code, $Modifier, $enc)
313 $rowMoneyAdjusted = sqlFetchArray($resMoneyAdjusted);
314 $MoneyAdjusted = $rowMoneyAdjusted['MoneyAdjusted'];
316 $Remainder = $Fee - $Copay - $MoneyGot - $MoneyAdjusted;
318 if (round($Remainder, 2) != 0 && $amount != 0) {
319 if ($amount - $Remainder >= 0) {
320 $insert_value = $Remainder;
321 $amount = $amount - $Remainder;
323 $insert_value = $amount;
328 $sequence_no = sqlQuery("SELECT IFNULL(MAX(sequence_no),0) + 1 AS increment FROM ar_activity WHERE pid = ? AND encounter = ?", array($form_pid, $enc));
330 "insert into ar_activity set " .
333 ", sequence_no = ?" .
338 ", post_time = now() " .
343 ", account_code = 'PP'",
344 array($form_pid, $enc, $sequence_no['increment'], $Codetype, $Code, $Modifier, 0, $_SESSION['authUserID'], $payment_id, $insert_value, 0)
349 if ($amount!=0) {//if any excess is there.
351 $sequence_no = sqlQuery("SELECT IFNULL(MAX(sequence_no),0) + 1 AS increment FROM ar_activity WHERE pid = ? AND encounter = ?", array($form_pid, $enc));
353 "insert into ar_activity set " .
356 ", sequence_no = ?" .
361 ", post_time = now() " .
366 ", account_code = 'PP'",
367 array($form_pid, $enc, $sequence_no['increment'], $Codetype, $Code, $Modifier, 0, $_SESSION['authUserID'], $payment_id, $amount, 0)
372 //--------------------------------------------------------------------------------------------------------------------
374 }//if ($amount = 0 + $payment)
376 }//if ($_POST['form_upay'])
377 }//if ($_POST['form_save'])
379 if ($_POST['form_save'] ||
$_REQUEST['receipt']) {
380 if ($_REQUEST['receipt']) {
381 $form_pid = $_GET['patient'];
382 $timestamp = decorateString('....-..-.. ..:..:..', $_GET['time']);
385 // Get details for what we guess is the primary facility.
386 $frow = $facilityService->getPrimaryBusinessEntity(array("useLegacyImplementation" => true));
388 // Get the patient's name and chart number.
389 $patdata = getPatientData($form_pid, 'fname,mname,lname,pubpid');
391 // Re-fetch payment info.
392 $payrow = sqlQuery("SELECT " .
393 "SUM(amount1) AS amount1, " .
394 "SUM(amount2) AS amount2, " .
395 "MAX(method) AS method, " .
396 "MAX(source) AS source, " .
397 "MAX(dtime) AS dtime, " .
398 // "MAX(user) AS user " .
399 "MAX(user) AS user, " .
400 "MAX(encounter) as encounter " .
401 "FROM payments WHERE " .
402 "pid = ? AND dtime = ?", array($form_pid, $timestamp));
404 // Create key for deleting, just in case.
405 $ref_id = ($_REQUEST['radio_type_of_payment'] == 'copay') ?
$session_id : $payment_id;
406 $payment_key = $form_pid . '.' . preg_replace('/[^0-9]/', '', $timestamp) . '.' . $ref_id;
408 if ($_REQUEST['radio_type_of_payment'] != 'pre_payment') {
409 // get facility from encounter
410 $tmprow = sqlQuery("SELECT `facility_id` FROM `form_encounter` WHERE `encounter` = ?", array($payrow['encounter']));
411 $frow = $facilityService->getById($tmprow['facility_id']);
413 // if pre_payment, then no encounter yet, so get main office address
414 $frow = $facilityService->getPrimaryBillingLocation();
417 // Now proceed with printing the receipt.
420 <title
><?php
echo xlt('Receipt for Payment'); ?
></title
>
421 <?php Header
::setupHeader(['jquery-ui']); ?
>
422 <script language
="JavaScript">
424 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
426 $
(document
).ready(function () {
427 var win
= top
.printLogSetup ? top
: opener
.top
;
428 win
.printLogSetup(document
.getElementById('printbutton'));
431 function closeHow(e
) {
433 top
.activateTabByName('pat', true);
434 top
.tabCloseByName(window
.name
);
437 if (opener
.name
=== "left_nav") {
442 window
.history
.back();
446 // This is action to take before printing and is called from restoreSession.php.
447 function printlog_before_print() {
448 let divstyle
= document
.getElementById('hideonprint').style
;
449 divstyle
.display
= 'none';
450 // currently exit is not hidden by default in case receipt print is not needed
451 // and left here for future option to force users to print via global etc..
452 // can still print later via reports.
453 divstyle
= document
.getElementById('showonprint').style
;
454 divstyle
.display
= '';
457 // Process click on Delete button.
458 function deleteme() {
459 dlgopen('deleter.php?payment=' +
<?php
echo js_url($payment_key); ?
> +
'&csrf_token_form=' +
<?php
echo js_url(CsrfUtils
::collectCsrfToken()); ?
>, '_blank', 500, 450);
463 // Called by the deleteme.php window on a successful delete.
464 function imdeleted() {
466 dlgclose(); // we're in reports/leftnav and callback reloads.
468 window
.history
.back(); // this is us full screen.
472 // Called to switch to the specified encounter having the specified DOS.
473 // This also closes the popup window.
474 function toencounter(enc
, datestr
, topframe
) {
475 topframe
.restoreSession();
476 // Hard-coding of RBot for this purpose is awkward, but since this is a
477 // pop-up and our openemr is left_nav, we have no good clue as to whether
478 // the top frame is more appropriate.
480 topframe
.left_nav
.forceDual();
481 topframe
.left_nav
.setEncounter(datestr
, enc
, '');
482 topframe
.left_nav
.loadFrame('enc2', 'RBot', 'patient_file/encounter/encounter_top.php?set_encounter=' +
encodeURIComponent(enc
));
484 top
.goToEncounter(enc
);
486 if (opener
) dlgclose();
490 <body bgcolor
='#ffffff'>
493 <p
><h2
><?php
echo xlt('Receipt for Payment'); ?
></h2
>
495 <p
><?php
echo text($frow['name']) ?
>
496 <br
><?php
echo text($frow['street']) ?
>
497 <br
><?php
echo text($frow['city'] . ', ' . $frow['state']) . ' ' .
498 text($frow['postal_code']) ?
>
499 <br
><?php
echo text($frow['phone']) ?
>
502 <table border
='0' cellspacing
='8'>
504 <td
><?php
echo xlt('Date'); ?
>:</td
>
505 <td
><?php
echo text(oeFormatSDFT(strtotime($payrow['dtime']))) ?
></td
>
508 <td
><?php
echo xlt('Patient'); ?
>:</td
>
509 <td
><?php
echo text($patdata['fname']) . " " . text($patdata['mname']) . " " .
510 text($patdata['lname']) . " (" . text($patdata['pubpid']) . ")" ?
></td
>
513 <td
><?php
echo xlt('Paid Via'); ?
>:</td
>
514 <td
><?php
echo generate_display_field(array('data_type' => '1', 'list_id' => 'payment_method'), $payrow['method']); ?
></td
>
517 <td
><?php
echo xlt('Check/Ref Number'); ?
>:</td
>
518 <td
><?php
echo text($payrow['source']) ?
></td
>
521 <td
><?php
echo xlt('Amount for This Visit'); ?
>:</td
>
522 <td
><?php
echo text(oeFormatMoney($payrow['amount1'])) ?
></td
>
527 if ($_REQUEST['radio_type_of_payment']=='pre_payment') {
528 echo xlt('Pre-payment Amount');
530 echo xlt('Amount for Past Balance');
534 <td
><?php
echo text(oeFormatMoney($payrow['amount2'])) ?
></td
>
537 <td
><?php
echo xlt('Received By'); ?
>:</td
>
538 <td
><?php
echo text($payrow['user']) ?
></td
>
542 <div id
='hideonprint'>
544 <input type
='button' value
='<?php echo xla('Print'); ?>' id
='printbutton' />
547 $todaysenc = todaysEncounterIf($pid);
548 if ($todaysenc && $todaysenc != $encounter) {
549 echo " <input type='button' " .
550 "value='" . xla('Open Today`s Visit') . "' " .
551 "onclick='toencounter(" . attr_js($todaysenc) . ", " . attr_js($today) . ", (opener ? opener.top : top))' />\n";
555 <?php
if (acl_check('admin', 'super')) { ?
>
557 <input type
='button' value
='<?php echo xla('Delete
'); ?>' style
='color:red' onclick
='deleteme()' />
561 <div id
='showonprint'>
562 <input type
='button' value
='<?php echo xla('Exit'); ?>' id
='donebutton' onclick
="closeHow(event)"/>
569 // End of receipt printing logic.
573 // Here we display the form for data entry.
576 <title
><?php
echo xlt('Record Payment'); ?
></title
>
578 <style type
="text/css">
579 body
{ font
-family
:sans
-serif
; font
-size
:10pt
; font
-weight
:normal
}
580 .dehead
{ color
:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold }
581 .detail
{ color
:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal }
585 background
-color
: #FBFDD0;
586 border
: 1px solid
#ccc;
590 <!--Removed standard dependencies
12/29/17 as not needed any longer since moved to a tab
/frame not popup
.-->
594 <!-- supporting javascript code
-->
595 <script language
='JavaScript'>
598 <?php
include_once("{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"); ?
>
599 <script language
="javascript" type
="text/javascript">
600 document
.onclick
=HideTheAjaxDivs
;
603 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
605 <script language
="JavaScript">
606 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
607 function closeHow(e
) {
609 top
.activateTabByName('pat', true);
610 top
.tabCloseByName(window
.name
);
613 if (opener
.name
=== "left_nav") {
618 window
.history
.back();
621 function calctotal() {
622 var f
= document
.forms
[0];
624 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
625 var elem
= f
.elements
[i
];
626 var ename
= elem
.name
;
627 if (ename
.indexOf('form_upay[') == 0 || ename
.indexOf('form_bpay[') == 0) {
628 if (elem
.value
.length
> 0) total +
= Number(elem
.value
);
631 f
.form_paytotal
.value
= Number(total
).toFixed(2);
635 function coloring() {
636 for (var i
= 1; ; ++i
) {
637 if (document
.getElementById('paying_' + i
)) {
638 paying
= document
.getElementById('paying_' + i
).value
* 1;
639 patient_balance
= document
.getElementById('duept_' + i
).innerHTML
* 1;
641 //balance=document.getElementById('balance_'+i).innerHTML*1;
642 if (patient_balance
> 0 && paying
> 0) {
643 if (paying
> patient_balance
) {
644 document
.getElementById('paying_' + i
).style
.background
= '#FF0000';
646 else if (paying
< patient_balance
) {
647 document
.getElementById('paying_' + i
).style
.background
= '#99CC00';
649 else if (paying
== patient_balance
) {
650 document
.getElementById('paying_' + i
).style
.background
= '#ffffff';
653 document
.getElementById('paying_' + i
).style
.background
= '#ffffff';
662 function CheckVisible(MakeBlank
) { //Displays and hides the check number text box.
663 if (document
.getElementById('form_method').options
[document
.getElementById(
664 'form_method').selectedIndex
].value
== 'check_payment' || document
.getElementById(
665 'form_method').options
[document
.getElementById('form_method').selectedIndex
]
666 .value
== 'bank_draft') {
667 document
.getElementById('check_number').disabled
= false;
669 document
.getElementById('check_number').disabled
= true;
673 function validate() {
674 var f
= document
.forms
[0];
676 top
.restoreSession();
678 // prevent an empty form submission
680 for (let i
= 0; i
< f
.elements
.length
; ++i
) {
681 let ename
= f
.elements
[i
].name
;
682 if (f
.elements
[i
].value
== 'pre_payment' && f
.elements
[i
].checked
=== true) {
683 if (Number(f
.elements
.namedItem("form_prepayment").value
) !== 0) {
688 if (ename
.indexOf('form_upay[') === 0 || ename
.indexOf('form_bpay[') === 0) {
689 if (Number(f
.elements
[i
].value
) !== 0) flgempty
= false;
693 alert(<?php
echo xlj('A Payment is Required!. Please input a payment line item entry.'); ?
>);
696 // continue validation.
697 if (((document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
== 'check_payment' ||
698 document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
== 'bank_draft') &&
699 document
.getElementById('check_number').value
== '')) {
700 alert(<?php
echo xlj('Please Fill the Check/Ref Number'); ?
>);
701 document
.getElementById('check_number').focus();
704 if (document
.getElementById('radio_type_of_payment_self1').checked
== false &&
705 document
.getElementById('radio_type_of_payment1').checked
== false &&
706 document
.getElementById('radio_type_of_payment2').checked
== false &&
707 document
.getElementById('radio_type_of_payment4').checked
== false) {
708 alert(<?php
echo xlj('Please Select Type Of Payment.'); ?
>);
711 if (document
.getElementById('radio_type_of_payment_self1').checked
== true ||
712 document
.getElementById('radio_type_of_payment1').checked
== true) {
713 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
714 var elem
= f
.elements
[i
];
715 var ename
= elem
.name
;
716 if (ename
.indexOf('form_upay[0') == 0) //Today is this text box.
718 if (elem
.value
* 1 > 0) {//A warning message, if the amount is posted with out encounter.
719 if (confirm(<?php
echo xlj('If patient has appointment click OK to create encounter otherwise, cancel this and then create an encounter for today visit.'); ?
>)) {
731 if (document
.getElementById('radio_type_of_payment1').checked
== true){//CO-PAY
733 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
734 var elem
= f
.elements
[i
];
735 var ename
= elem
.name
;
736 if (ename
.indexOf('form_upay[0]') == 0) {//Today is this text box.
737 if (f
.form_paytotal
.value
* 1 != elem
.value
* 1) {//Total CO-PAY is not posted against today
738 //A warning message, if the amount is posted against an old encounter.
739 if (confirm(<?php
echo xlj('You are posting against an old encounter?'); ?
>)) {
750 else if (document
.getElementById('radio_type_of_payment2').checked
== true) {//Invoice Balance
751 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
752 var elem
= f
.elements
[i
];
753 var ename
= elem
.name
;
754 if (ename
.indexOf('form_upay[0') == 0) {
755 if (elem
.value
* 1 > 0) {
756 alert(<?php
echo xlj('Invoice Balance cannot be posted. No Encounter is created.'); ?
>);
764 if (confirm(<?php
echo xlj('Would you like to save?'); ?
>)) {
773 function cursor_pointer() { //Point the cursor to the latest encounter(Today)
774 var f
= document
.forms
[0];
776 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
777 var elem
= f
.elements
[i
];
778 var ename
= elem
.name
;
779 if (ename
.indexOf('form_upay[') == 0) {
785 //=====================================================
786 function make_it_hide_enc_pay() {
787 document
.getElementById('td_head_insurance_payment').style
.display
= "none";
788 document
.getElementById('td_head_patient_co_pay').style
.display
= "none";
789 document
.getElementById('td_head_co_pay').style
.display
= "none";
790 document
.getElementById('td_head_insurance_balance').style
.display
= "none";
791 for (var i
= 1; ; ++i
) {
792 var td_inspaid_elem
= document
.getElementById('td_inspaid_' + i
)
793 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_' + i
)
794 var td_copay_elem
= document
.getElementById('td_copay_' + i
)
795 var balance_elem
= document
.getElementById('balance_' + i
)
796 if (td_inspaid_elem
) {
797 td_inspaid_elem
.style
.display
= "none";
798 td_patient_copay_elem
.style
.display
= "none";
799 td_copay_elem
.style
.display
= "none";
800 balance_elem
.style
.display
= "none";
805 document
.getElementById('td_total_4').style
.display
= "none";
806 document
.getElementById('td_total_7').style
.display
= "none";
807 document
.getElementById('td_total_8').style
.display
= "none";
808 document
.getElementById('td_total_6').style
.display
= "none";
809 document
.getElementById('table_display').width
= "420px";
811 //=====================================================
812 function make_visible() {
813 document
.getElementById('td_head_rep_doc').style
.display
= "";
814 document
.getElementById('td_head_description').style
.display
= "";
815 document
.getElementById('td_head_total_charge').style
.display
= "none";
816 document
.getElementById('td_head_insurance_payment').style
.display
= "none";
817 document
.getElementById('td_head_patient_payment').style
.display
= "none";
818 document
.getElementById('td_head_patient_co_pay').style
.display
= "none";
819 document
.getElementById('td_head_co_pay').style
.display
= "none";
820 document
.getElementById('td_head_insurance_balance').style
.display
= "none";
821 document
.getElementById('td_head_patient_balance').style
.display
= "none";
822 for (var i
= 1; ; ++i
) {
823 var td_charges_elem
= document
.getElementById('td_charges_' + i
)
824 var td_inspaid_elem
= document
.getElementById('td_inspaid_' + i
)
825 var td_ptpaid_elem
= document
.getElementById('td_ptpaid_' + i
)
826 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_' + i
)
828 var td_copay_elem
= document
.getElementById('td_copay_' + i
)
829 var balance_elem
= document
.getElementById('balance_' + i
)
830 var duept_elem
= document
.getElementById('duept_' + i
)
831 if (td_charges_elem
) {
832 td_charges_elem
.style
.display
= "none";
833 td_inspaid_elem
.style
.display
= "none";
834 td_ptpaid_elem
.style
.display
= "none";
835 td_patient_copay_elem
.style
.display
= "none";
836 td_copay_elem
.style
.display
= "none";
837 balance_elem
.style
.display
= "none";
838 duept_elem
.style
.display
= "none";
843 document
.getElementById('td_total_7').style
.display
= "";
844 document
.getElementById('td_total_8').style
.display
= "";
845 document
.getElementById('td_total_1').style
.display
= "none";
846 document
.getElementById('td_total_2').style
.display
= "none";
847 document
.getElementById('td_total_3').style
.display
= "none";
848 document
.getElementById('td_total_4').style
.display
= "none";
849 document
.getElementById('td_total_5').style
.display
= "none";
850 document
.getElementById('td_total_6').style
.display
= "none";
851 document
.getElementById('table_display').width
= "505px";
854 function make_it_hide() {
855 document
.getElementById('td_head_rep_doc').style
.display
= "none";
856 document
.getElementById('td_head_description').style
.display
= "none";
857 document
.getElementById('td_head_total_charge').style
.display
= "";
858 document
.getElementById('td_head_insurance_payment').style
.display
= "";
859 document
.getElementById('td_head_patient_payment').style
.display
= "";
860 document
.getElementById('td_head_patient_co_pay').style
.display
= "";
861 document
.getElementById('td_head_co_pay').style
.display
= "";
862 document
.getElementById('td_head_insurance_balance').style
.display
= "";
863 document
.getElementById('td_head_patient_balance').style
.display
= "";
864 for (var i
= 1; ; ++i
) {
865 var td_charges_elem
= document
.getElementById('td_charges_' + i
)
866 var td_inspaid_elem
= document
.getElementById('td_inspaid_' + i
)
867 var td_ptpaid_elem
= document
.getElementById('td_ptpaid_' + i
)
868 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_' + i
)
870 var td_copay_elem
= document
.getElementById('td_copay_' + i
)
871 var balance_elem
= document
.getElementById('balance_' + i
)
872 var duept_elem
= document
.getElementById('duept_' + i
)
873 if (td_charges_elem
) {
874 td_charges_elem
.style
.display
= "";
875 td_inspaid_elem
.style
.display
= "";
876 td_ptpaid_elem
.style
.display
= "";
877 td_patient_copay_elem
.style
.display
= "";
878 td_copay_elem
.style
.display
= "";
879 balance_elem
.style
.display
= "";
880 duept_elem
.style
.display
= "";
885 document
.getElementById('td_total_1').style
.display
= "";
886 document
.getElementById('td_total_2').style
.display
= "";
887 document
.getElementById('td_total_3').style
.display
= "";
888 document
.getElementById('td_total_4').style
.display
= "";
889 document
.getElementById('td_total_5').style
.display
= "";
890 document
.getElementById('td_total_6').style
.display
= "";
891 document
.getElementById('td_total_7').style
.display
= "";
892 document
.getElementById('td_total_8').style
.display
= "";
893 document
.getElementById('table_display').width
= "635px";
896 function make_visible_radio() {
897 document
.getElementById('tr_radio1').style
.display
= "";
898 document
.getElementById('tr_radio2').style
.display
= "none";
901 function make_hide_radio() {
902 document
.getElementById('tr_radio1').style
.display
= "none";
903 document
.getElementById('tr_radio2').style
.display
= "";
906 function make_visible_row() {
907 document
.getElementById('table_display').style
.display
= "";
908 document
.getElementById('table_display_prepayment').style
.display
= "none";
911 function make_hide_row() {
912 document
.getElementById('table_display').style
.display
= "none";
913 document
.getElementById('table_display_prepayment').style
.display
= "";
916 function make_self() {
919 make_it_hide_enc_pay();
920 document
.getElementById('radio_type_of_payment_self1').checked
= true;
924 function make_insurance() {
928 document
.getElementById('radio_type_of_payment1').checked
= true;
933 @media only screen
and (max
-width
: 768px
) {
936 text
-align
: left
!Important
;
941 width
: 90%
!important
;
943 @media
(min
-width
: 992px
) {
945 width
: 1000px
!Important
;
949 <title
><?php
echo xlt('Record Payment'); ?
></title
>
950 <?php
$NameNew = $patdata['fname'] . " " . $patdata['lname'] . " " . $patdata['mname']; ?
>
952 $arrOeUiSettings = array(
953 'heading_title' => xl('Accept Payment'),
954 'include_patient_name' => true,// use only in appropriate pages
955 'expandable' => false,
956 'expandable_files' => array(),//all file names need suffix _xpd
957 'action' => "",//conceal, reveal, search, reset, link or back
958 'action_title' => "",
959 'action_href' => "",//only for actions - reset, link or back
960 'show_help_icon' => false,
961 'help_file_name' => ""
963 $oemr_ui = new OemrUI($arrOeUiSettings);
967 <div
class="container"><!--begin container div
for form
-->
969 <div
class="col-sm-12">
970 <div
class="page-header">
971 <?php
echo $oemr_ui->pageHeading() . "\r\n"; ?
>
976 <div
class="col-sm-12">
977 <form method
='post' action
='front_payment.php<?php echo ($payid) ? "?payid=".attr_url($payid) : ""; ?>' onsubmit
='return validate();'>
978 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
979 <input name
='form_pid' type
='hidden' value
='<?php echo attr($pid) ?>'>
981 <legend
><?php
echo xlt('Payment'); ?
></legend
>
982 <div
class="col-xs-12 oe-custom-line">
983 <div
class="col-xs-3 col-lg-offset-3">
984 <label
class="control-label" for="form_method"><?php
echo xlt('Payment Method'); ?
>:</label
>
986 <div
class="col-xs-3">
987 <select
class="form-control" id
="form_method" name
="form_method" onchange
='CheckVisible("yes")'>
989 $query1112 = "SELECT * FROM list_options where list_id=? ORDER BY seq, title ";
990 $bres1112 = sqlStatement($query1112, array('payment_method'));
991 while ($brow1112 = sqlFetchArray($bres1112)) {
992 if ($brow1112['option_id']=='electronic' ||
$brow1112['option_id']=='bank_draft') {
995 echo "<option value='".attr($brow1112['option_id'])."'>".text(xl_list_label($brow1112['title']))."</option>";
1001 <div
class="col-xs-12 oe-custom-line">
1002 <div
class="col-xs-3 col-lg-offset-3">
1003 <label
class="control-label" for="check_number"><?php
echo xlt('Check/Ref Number'); ?
>:</label
>
1005 <div
class="col-xs-3">
1006 <div id
="ajax_div_patient" style
="display:none;"></div
>
1007 <input type
='text' id
="check_number" name
='form_source' class= 'form-control' value
='<?php echo attr($payrow['source
']); ?>'>
1010 <div
class="col-xs-12 oe-custom-line">
1011 <div
class="col-xs-3 col-lg-offset-3">
1012 <label
class="control-label" for="form_discount"><?php
echo xla('Patient Coverage'); ?
>:</label
>
1014 <div
class="col-xs-6">
1015 <div style
="padding-left:15px">
1016 <label
class="radio-inline">
1017 <input id
="radio_type_of_coverage1" name
="radio_type_of_coverage" onclick
="make_visible_radio();make_self();" type
="radio" value
="self"><?php
echo xlt('Self'); ?
>
1019 <label
class="radio-inline">
1020 <input checked
="checked" id
="radio_type_of_coverag2" name
="radio_type_of_coverage" onclick
="make_hide_radio();make_insurance();" type
="radio" value
="insurance"><?php
echo xlt('Insurance'); ?
>
1025 <div
class="col-xs-12 oe-custom-line">
1026 <div
class="col-xs-3 col-lg-offset-3">
1027 <label
class="control-label" for=""><?php
echo xlt('Payment against'); ?
>:</label
>
1029 <div
class="col-xs-6">
1030 <div id
="tr_radio1" style
="padding-left:15px; display:none"><!-- For radio Insurance
-->
1031 <label
class="radio-inline">
1032 <input id
="radio_type_of_payment_self1" name
="radio_type_of_payment" onclick
="make_visible_row();make_it_hide_enc_pay();cursor_pointer();" type
="radio" value
="cash"><?php
echo xlt('Encounter Payment'); ?
>
1035 <div id
="tr_radio2" style
="padding-left:15px"><!-- For radio self
-->
1036 <label
class="radio-inline">
1037 <input checked
="checked" id
="radio_type_of_payment1" name
="radio_type_of_payment" onclick
="make_visible_row();cursor_pointer();" type
="radio" value
="copay"><?php
echo xlt('Co Pay'); ?
>
1039 <label
class="radio-inline">
1040 <input id
="radio_type_of_payment2" name
="radio_type_of_payment" onclick
="make_visible_row();" type
="radio" value
="invoice_balance"><?php
echo xlt('Invoice Balance'); ?
><br
>
1042 <label
class="radio-inline">
1043 <input id
="radio_type_of_payment4" name
="radio_type_of_payment" onclick
="make_hide_row();" type
="radio" value
="pre_payment"><?php
echo xlt('Pre Pay'); ?
>
1048 <div
class="col-xs-12 oe-custom-line">
1049 <div id
="table_display_prepayment" style
="display:none">
1050 <div
class="col-xs-3 col-lg-offset-3">
1051 <label
class="control-label" for="form_prepayment"><?php
echo xlt('Pre Payment'); ?
>:</label
>
1053 <div
class="col-xs-3">
1054 <input name
='form_prepayment' id
='form_prepayment'class='form-control' type
='text' value
=''>
1060 <legend
><?php
echo xlt('Collect For'); ?
></legend
>
1061 <div
class= "table-responsive">
1062 <table
class = "table" id
="table_display">
1064 <tr bgcolor
="#CCCCCC" id
="tr_head">
1065 <td
class="dehead" width
="70"><?php
echo xlt('DOS'); ?
></td
>
1066 <td
class="dehead" width
="65"><?php
echo xlt('Encounter'); ?
></td
>
1067 <td align
="center" class="dehead" id
="td_head_total_charge" width
="80"><?php
echo xlt('Total Charge'); ?
></td
>
1068 <td align
="center" class="dehead" id
="td_head_rep_doc" style
='display:none' width
="70"><?php
echo xlt('Report/ Form'); ?
></td
>
1069 <td align
="center" class="dehead" id
="td_head_description" style
='display:none' width
="200"><?php
echo xlt('Description'); ?
></td
>
1070 <td align
="center" class="dehead" id
="td_head_insurance_payment" width
="80"><?php
echo xlt('Insurance Payment'); ?
></td
>
1071 <td align
="center" class="dehead" id
="td_head_patient_payment" width
="80"><?php
echo xlt('Patient Payment'); ?
></td
>
1072 <td align
="center" class="dehead" id
="td_head_patient_co_pay" width
="55"><?php
echo xlt('Co Pay Paid'); ?
></td
>
1073 <td align
="center" class="dehead" id
="td_head_co_pay" width
="55"><?php
echo xlt('Required Co Pay'); ?
></td
>
1074 <td align
="center" class="dehead" id
="td_head_insurance_balance" width
="80"><?php
echo xlt('Insurance Balance'); ?
></td
>
1075 <td align
="center" class="dehead" id
="td_head_patient_balance" width
="80"><?php
echo xlt('Patient Balance'); ?
></td
>
1076 <td align
="center" class="dehead" width
="50"><?php
echo xlt('Paying'); ?
></td
>
1082 // Get the unbilled service charges and payments by encounter for this patient.
1084 $query = "SELECT fe.encounter, b.code_type, b.code, b.modifier, b.fee, " .
1085 "LEFT(fe.date, 10) AS encdate ,fe.last_level_closed " .
1086 "FROM form_encounter AS fe left join billing AS b on " .
1087 "b.pid = ? AND b.activity = 1 AND " .//AND b.billed = 0
1088 "b.code_type != 'TAX' AND b.fee != 0 " .
1089 "AND fe.pid = b.pid AND fe.encounter = b.encounter " .
1090 "where fe.pid = ? " .
1091 "ORDER BY b.encounter";
1092 $bres = sqlStatement($query, array($pid, $pid));
1094 while ($brow = sqlFetchArray($bres)) {
1095 $key = 0 - $brow['encounter'];
1096 if (empty($encs[$key])) {
1097 $encs[$key] = array(
1098 'encounter' => $brow['encounter'],
1099 'date' => $brow['encdate'],
1100 'last_level_closed' => $brow['last_level_closed'],
1105 if ($brow['code_type'] === 'COPAY') {
1106 //$encs[$key]['payments'] -= $brow['fee'];
1108 $encs[$key]['charges'] +
= $brow['fee'];
1110 $sql_array = array();
1111 $query = "SELECT taxrates FROM codes WHERE " .
1112 "code_type = ? AND " .
1114 array_push($sql_array, $code_types[$brow['code_type']]['id'], $brow['code']);
1115 if ($brow['modifier']) {
1116 $query .= "modifier = ?";
1117 array_push($sql_array, $brow['modifier']);
1119 $query .= "(modifier IS NULL OR modifier = '')";
1122 $query .= " LIMIT 1";
1123 $trow = sqlQuery($query, $sql_array);
1124 $encs[$key]['charges'] +
= calcTaxes($trow, $brow['fee']);
1128 // Do the same for unbilled product sales.
1130 $query = "SELECT fe.encounter, s.drug_id, s.fee, " .
1131 "LEFT(fe.date, 10) AS encdate,fe.last_level_closed " .
1132 "FROM form_encounter AS fe left join drug_sales AS s " .
1133 "on s.pid = ? AND s.fee != 0 " .//AND s.billed = 0
1134 "AND fe.pid = s.pid AND fe.encounter = s.encounter " .
1135 "where fe.pid = ? " .
1136 "ORDER BY s.encounter";
1138 $dres = sqlStatement($query, array($pid, $pid));
1140 while ($drow = sqlFetchArray($dres)) {
1141 $key = 0 - $drow['encounter'];
1142 if (empty($encs[$key])) {
1143 $encs[$key] = array(
1144 'encounter' => $drow['encounter'],
1145 'date' => $drow['encdate'],
1146 'last_level_closed' => $drow['last_level_closed'],
1151 $encs[$key]['charges'] +
= $drow['fee'];
1153 $trow = sqlQuery("SELECT taxrates FROM drug_templates WHERE drug_id = ? " .
1154 "ORDER BY selector LIMIT 1", array($drow['drug_id']));
1155 $encs[$key]['charges'] +
= calcTaxes($trow, $drow['fee']);
1158 ksort($encs, SORT_NUMERIC
);
1160 //Bringing on top the Today always
1161 foreach ($encs as $key => $value) {
1162 $dispdate = $value['date'];
1163 if (strcmp($dispdate, $today) == 0 && !$gottoday) {
1169 // If no billing was entered yet for today, then generate a line for
1170 // entering today's co-pay.
1173 echoLine("form_upay[0]", date("Y-m-d"), 0, 0, 0, 0 /*$duept*/);//No encounter yet defined.
1177 foreach ($encs as $key => $value) {
1178 $enc = $value['encounter'];
1179 $dispdate = $value['date'];
1180 if (strcmp($dispdate, $today) == 0 && !$gottoday) {
1181 $dispdate = date("Y-m-d");
1184 //------------------------------------------------------------------------------------
1185 $inscopay = BillingUtilities
::getCopay($pid, $dispdate);
1186 $patcopay = BillingUtilities
::getPatientCopay($pid, $enc);
1190 "SELECT SUM(pay_amount) AS payments, " .
1191 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1192 "pid = ? and encounter = ? and " .
1193 "payer_type != 0 and account_code!='PCP' ",
1196 $dpayment = $drow['payments'];
1197 $dadjustment = $drow['adjustments'];
1201 "SELECT SUM(pay_amount) AS payments, " .
1202 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1203 "pid = ? and encounter = ? and " .
1204 "payer_type = 0 and account_code!='PCP' ",
1207 $dpayment_pat = $drow['payments'];
1209 //------------------------------------------------------------------------------------
1211 $ResultNumberOfInsurance = sqlStatement("SELECT COUNT( DISTINCT TYPE ) NumberOfInsurance FROM insurance_data
1212 where pid = ? and provider>0 ", array($pid));
1213 $RowNumberOfInsurance = sqlFetchArray($ResultNumberOfInsurance);
1214 $NumberOfInsurance = $RowNumberOfInsurance['NumberOfInsurance'] * 1;
1215 //------------------------------------------------------------------------------------
1217 if ((($NumberOfInsurance == 0 ||
$value['last_level_closed'] == 4 ||
$NumberOfInsurance == $value['last_level_closed']))) {//Patient balance
1218 $brow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " .
1219 "pid = ? and encounter = ? AND activity = 1", array($pid, $enc));
1220 $srow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " .
1221 "pid = ? and encounter = ? ", array($pid, $enc));
1222 $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " .
1223 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1224 "pid = ? and encounter = ? ", array($pid, $enc));
1225 $duept = $brow['amount'] +
$srow['amount'] - $drow['payments'] - $drow['adjustments'];
1233 ($dpayment +
$dadjustment),
1242 // Continue with display of the data entry form.
1245 <tr bgcolor
="#CCCCCC">
1246 <td
class="dehead" id
='td_total_1'></td
>
1247 <td
class="dehead" id
='td_total_2'></td
>
1248 <td
class="dehead" id
='td_total_3'></td
>
1249 <td
class="dehead" id
='td_total_4'></td
>
1250 <td
class="dehead" id
='td_total_5'></td
>
1251 <td
class="dehead" id
='td_total_6'></td
>
1252 <td
class="dehead" id
='td_total_7'></td
>
1253 <td
class="dehead" id
='td_total_8'></td
>
1254 <td align
="right" class="dehead"><?php
echo xlt('Total');?
></td
>
1255 <td align
="right" class="dehead"><input name
='form_paytotal' readonly style
='color:#00aa00;width:50px' type
='text' value
=''></td
>
1260 <div
class="form-group">
1261 <div
class="col-sm-12 text-left position-override">
1262 <div
class="btn-group btn-group-pinch" role
="group">
1263 <button type
='submit' class="btn btn-default btn-save" name
='form_save' value
='<?php echo xla('Generate Invoice
');?>'><?php
echo xlt('Generate Invoice');?
></button
>
1264 <button type
='button' class="btn btn-link btn-cancel btn-separate-left" value
='<?php echo xla('Cancel
'); ?>' onclick
='closeHow(event)'><?php
echo xlt('Cancel'); ?
></button
>
1265 <input type
="hidden" name
="hidden_patient_code" id
="hidden_patient_code" value
="<?php echo attr($pid);?>"/>
1266 <input type
='hidden' name
='ajax_mode' id
='ajax_mode' value
='' />
1267 <input type
='hidden' name
='mode' id
='mode' value
='' />
1274 <script language
="JavaScript">
1277 </div
><!--end of container div of accept payment i
.e the form
-->
1279 $oemr_ui->oeBelowContainerDiv();
1280 } // forms else close