2 // Copyright (C) 2006-2015 Rod Roark <rod@sunsetsystems.com>
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 $fake_register_globals=false;
10 $sanitize_all_escapes=true;
12 require_once("../globals.php");
13 require_once("$srcdir/acl.inc");
14 require_once("$srcdir/patient.inc");
15 require_once("$srcdir/billing.inc");
16 require_once("$srcdir/payment.inc.php");
17 require_once("$srcdir/forms.inc");
18 require_once("$srcdir/sl_eob.inc.php");
19 require_once("$srcdir/invoice_summary.inc.php");
20 require_once("../../custom/code_types.inc.php");
21 require_once("$srcdir/formatting.inc.php");
22 require_once("$srcdir/options.inc.php");
23 require_once("$srcdir/encounter_events.inc.php");
24 $pid = $_REQUEST['hidden_patient_code'] > 0 ?
$_REQUEST['hidden_patient_code'] : $pid;
26 $INTEGRATED_AR = $GLOBALS['oer_config']['ws_accounting']['enabled'] === 2;
30 <?php
html_header_show();?
>
31 <link rel
='stylesheet' href
='<?php echo $css_header ?>' type
='text/css'>
33 // Format dollars for display.
35 function bucks($amount) {
37 $amount = oeFormatMoney($amount);
43 function rawbucks($amount) {
45 $amount = sprintf("%.2f", $amount);
51 // Display a row of data for an encounter.
54 function echoLine($iname, $date, $charges, $ptpaid, $inspaid, $duept,$encounter=0,$copay=0,$patcopay=0) {
57 $balance = bucks($charges - $ptpaid - $inspaid);
58 $balance = (round($duept,2) != 0) ?
0 : $balance;//if balance is due from patient, then insurance balance is displayed as zero
59 $encounter = $encounter ?
$encounter : '';
60 echo " <tr id='tr_".attr($var_index)."' >\n";
61 echo " <td class='detail'>" . text(oeFormatShortDate($date)) . "</td>\n";
62 echo " <td class='detail' id='".attr($date)."' align='center'>" . htmlspecialchars($encounter, ENT_QUOTES
) . "</td>\n";
63 echo " <td class='detail' align='center' id='td_charges_$var_index' >" . htmlspecialchars(bucks($charges), ENT_QUOTES
) . "</td>\n";
64 echo " <td class='detail' align='center' id='td_inspaid_$var_index' >" . htmlspecialchars(bucks($inspaid*-1), ENT_QUOTES
) . "</td>\n";
65 echo " <td class='detail' align='center' id='td_ptpaid_$var_index' >" . htmlspecialchars(bucks($ptpaid*-1), ENT_QUOTES
) . "</td>\n";
66 echo " <td class='detail' align='center' id='td_patient_copay_$var_index' >" . htmlspecialchars(bucks($patcopay), ENT_QUOTES
) . "</td>\n";
67 echo " <td class='detail' align='center' id='td_copay_$var_index' >" . htmlspecialchars(bucks($copay), ENT_QUOTES
) . "</td>\n";
68 echo " <td class='detail' align='center' id='balance_$var_index'>" . htmlspecialchars(bucks($balance), ENT_QUOTES
) . "</td>\n";
69 echo " <td class='detail' align='center' id='duept_$var_index'>" . htmlspecialchars(bucks(round($duept,2)*1), ENT_QUOTES
) . "</td>\n";
70 echo " <td class='detail' align='right'><input type='text' name='".attr($iname)."' id='paying_".attr($var_index)."' " .
71 " value='" . '' . "' onchange='coloring();calctotal()' autocomplete='off' " .
72 "onkeyup='calctotal()' style='width:50px'/></td>\n";
76 // We use this to put dashes, colons, etc. back into a timestamp.
78 function decorateString($fmt, $str) {
81 $fc = substr($fmt, 0, 1);
82 $fmt = substr($fmt, 1);
84 $res .= substr($str, 0, 1);
85 $str = substr($str, 1);
93 // Compute taxes from a tax rate string and a possibly taxable amount.
95 function calcTaxes($row, $amount) {
97 if (empty($row['taxrates'])) return $total;
98 $arates = explode(':', $row['taxrates']);
99 if (empty($arates)) return $total;
100 foreach ($arates as $value) {
101 if (empty($value)) continue;
102 $trow = sqlQuery("SELECT option_value FROM list_options WHERE " .
103 "list_id = 'taxrate' AND option_id = ? LIMIT 1", array($value) );
104 if (empty($trow['option_value'])) {
105 echo "<!-- Missing tax rate '".text($value)."'! -->\n";
108 $tax = sprintf("%01.2f", $amount * $trow['option_value']);
109 // echo "<!-- Rate = '$value', amount = '$amount', tax = '$tax' -->\n";
116 $today = date('Y-m-d', $now);
117 $timestamp = date('Y-m-d H:i:s', $now);
119 if (!$INTEGRATED_AR) slInitialize();
121 // $patdata = getPatientData($pid, 'fname,lname,pubpid');
123 $patdata = sqlQuery("SELECT " .
124 "p.fname, p.mname, p.lname, p.pubpid,p.pid, i.copay " .
125 "FROM patient_data AS p " .
126 "LEFT OUTER JOIN insurance_data AS i ON " .
127 "i.pid = p.pid AND i.type = 'primary' " .
128 "WHERE p.pid = ? ORDER BY i.date DESC LIMIT 1", array($pid) );
130 $alertmsg = ''; // anything here pops up in an alert box
132 // If the Save button was clicked...
133 if ($_POST['form_save']) {
134 $form_pid = $_POST['form_pid'];
135 $form_method = trim($_POST['form_method']);
136 $form_source = trim($_POST['form_source']);
137 $patdata = getPatientData($form_pid, 'fname,mname,lname,pubpid');
138 $NameNew=$patdata['fname'] . " " .$patdata['lname']. " " .$patdata['mname'];
140 if($_REQUEST['radio_type_of_payment']=='pre_payment')
142 $payment_id = idSqlStatement("insert into ar_session set " .
148 ", check_date = now() , deposit_date = now() " .
150 ", payment_type = 'patient'" .
151 ", description = ?" .
152 ", adjustment_code = 'pre_payment'" .
153 ", post_to_date = now() " .
154 ", payment_method = ?",
155 array(0,$form_pid,$_SESSION['authUserID'],0,$form_source,$_REQUEST['form_prepayment'],$NameNew,$form_method));
157 frontPayment($form_pid, 0, $form_method, $form_source, $_REQUEST['form_prepayment'], 0, $timestamp);//insertion to 'payments' table.
160 if ($_POST['form_upay'] && $_REQUEST['radio_type_of_payment']!='pre_payment') {
161 foreach ($_POST['form_upay'] as $enc => $payment) {
162 if ($amount = 0 +
$payment) {
164 if($_REQUEST['radio_type_of_payment']=='invoice_balance')
172 $enc = calendar_arrived($form_pid);
175 //----------------------------------------------------------------------------------------------------
176 //Fetching the existing code and modifier
177 $ResultSearchNew = sqlStatement("SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key ".
178 "WHERE code_types.ct_fee=1 AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier",
179 array($form_pid,$enc));
180 if($RowSearch = sqlFetchArray($ResultSearchNew))
182 $Codetype=$RowSearch['code_type'];
183 $Code=$RowSearch['code'];
184 $Modifier=$RowSearch['modifier'];
192 //----------------------------------------------------------------------------------------------------
193 if($_REQUEST['radio_type_of_payment']=='copay')//copay saving to ar_session and ar_activity tables
195 $session_id=idSqlStatement("INSERT INTO ar_session (payer_id,user_id,reference,check_date,deposit_date,pay_total,".
196 " global_amount,payment_type,description,patient_id,payment_method,adjustment_code,post_to_date) ".
197 " VALUES ('0',?,?,now(),now(),?,'','patient','COPAY',?,?,'patient_payment',now())",
198 array($_SESSION['authId'],$form_source,$amount,$form_pid,$form_method));
200 $insrt_id=idSqlStatement("INSERT INTO ar_activity (pid,encounter,code_type,code,modifier,payer_type,post_time,post_user,session_id,pay_amount,account_code)".
201 " VALUES (?,?,?,?,?,0,now(),?,?,?,'PCP')",
202 array($form_pid,$enc,$Codetype,$Code,$Modifier,$_SESSION['authId'],$session_id,$amount));
204 frontPayment($form_pid, $enc, $form_method, $form_source, $amount, 0, $timestamp);//insertion to 'payments' table.
206 if($_REQUEST['radio_type_of_payment']=='invoice_balance' ||
$_REQUEST['radio_type_of_payment']=='cash')
207 { //Payment by patient after insurance paid, cash patients similar to do not bill insurance in feesheet.
208 if($_REQUEST['radio_type_of_payment']=='cash')
210 sqlStatement("update form_encounter set last_level_closed=? where encounter=? and pid=? ",
211 array(4,$enc,$form_pid));
212 sqlStatement("update billing set billed=? where encounter=? and pid=?",
213 array(1,$enc,$form_pid));
215 $adjustment_code='patient_payment';
216 $payment_id = idSqlStatement("insert into ar_session set " .
222 ", check_date = now() , deposit_date = now() " .
224 ", payment_type = 'patient'" .
225 ", description = ?" .
226 ", adjustment_code = ?" .
227 ", post_to_date = now() " .
228 ", payment_method = ?",
229 array(0,$form_pid,$_SESSION['authUserID'],0,$form_source,$amount,$NameNew,$adjustment_code,$form_method));
231 //--------------------------------------------------------------------------------------------------------------------
233 frontPayment($form_pid, $enc, $form_method, $form_source, 0, $amount, $timestamp);//insertion to 'payments' table.
235 //--------------------------------------------------------------------------------------------------------------------
237 $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as PatientPay FROM ar_activity where pid =? and ".
238 "encounter =? and payer_type=0 and account_code='PCP'",
239 array($form_pid,$enc));//new fees screen copay gives account_code='PCP'
240 $rowMoneyGot = sqlFetchArray($resMoneyGot);
241 $Copay=$rowMoneyGot['PatientPay'];
243 //--------------------------------------------------------------------------------------------------------------------
245 //Looping the existing code and modifier
246 $ResultSearchNew = sqlStatement("SELECT * FROM billing LEFT JOIN code_types ON billing.code_type=code_types.ct_key WHERE code_types.ct_fee=1 ".
247 "AND billing.activity!=0 AND billing.pid =? AND encounter=? ORDER BY billing.code,billing.modifier",
248 array($form_pid,$enc));
249 while($RowSearch = sqlFetchArray($ResultSearchNew))
251 $Codetype=$RowSearch['code_type'];
252 $Code=$RowSearch['code'];
253 $Modifier =$RowSearch['modifier'];
254 $Fee =$RowSearch['fee'];
256 $resMoneyGot = sqlStatement("SELECT sum(pay_amount) as MoneyGot FROM ar_activity where pid =? ".
257 "and code_type=? and code=? and modifier=? and encounter =? and !(payer_type=0 and account_code='PCP')",
258 array($form_pid,$Codetype,$Code,$Modifier,$enc));
259 //new fees screen copay gives account_code='PCP'
260 $rowMoneyGot = sqlFetchArray($resMoneyGot);
261 $MoneyGot=$rowMoneyGot['MoneyGot'];
263 $resMoneyAdjusted = sqlStatement("SELECT sum(adj_amount) as MoneyAdjusted FROM ar_activity where ".
264 "pid =? and code_type=? and code=? and modifier=? and encounter =?",
265 array($form_pid,$Codetype,$Code,$Modifier,$enc));
266 $rowMoneyAdjusted = sqlFetchArray($resMoneyAdjusted);
267 $MoneyAdjusted=$rowMoneyAdjusted['MoneyAdjusted'];
269 $Remainder=$Fee-$Copay-$MoneyGot-$MoneyAdjusted;
271 if(round($Remainder,2)!=0 && $amount!=0)
273 if($amount-$Remainder >= 0)
275 $insert_value=$Remainder;
276 $amount=$amount-$Remainder;
280 $insert_value=$amount;
283 sqlStatement("insert into ar_activity set " .
290 ", post_time = now() " .
295 ", account_code = 'PP'",
296 array($form_pid,$enc,$Codetype,$Code,$Modifier,0,$_SESSION['authUserID'],$payment_id,$insert_value,0));
299 if($amount!=0)//if any excess is there.
301 sqlStatement("insert into ar_activity set " .
308 ", post_time = now() " .
313 ", account_code = 'PP'",
314 array($form_pid,$enc,$Codetype,$Code,$Modifier,0,$_SESSION['authUserID'],$payment_id,$amount,0));
317 //--------------------------------------------------------------------------------------------------------------------
319 }//if ($amount = 0 + $payment)
321 }//if ($_POST['form_upay'])
322 }//if ($_POST['form_save'])
324 if ($_POST['form_save'] ||
$_REQUEST['receipt']) {
326 if ($_REQUEST['receipt']) {
327 $form_pid = $_GET['patient'];
328 $timestamp = decorateString('....-..-.. ..:..:..', $_GET['time']);
331 // Get details for what we guess is the primary facility.
332 $frow = sqlQuery("SELECT * FROM facility " .
333 "ORDER BY billing_location DESC, accepts_assignment DESC, id LIMIT 1");
335 // Get the patient's name and chart number.
336 $patdata = getPatientData($form_pid, 'fname,mname,lname,pubpid');
338 // Re-fetch payment info.
339 $payrow = sqlQuery("SELECT " .
340 "SUM(amount1) AS amount1, " .
341 "SUM(amount2) AS amount2, " .
342 "MAX(method) AS method, " .
343 "MAX(source) AS source, " .
344 "MAX(dtime) AS dtime, " .
345 // "MAX(user) AS user " .
346 "MAX(user) AS user, " .
347 "MAX(encounter) as encounter ".
348 "FROM payments WHERE " .
349 "pid = ? AND dtime = ?", array($form_pid,$timestamp) );
351 // Create key for deleting, just in case.
352 $ref_id = ($_REQUEST['radio_type_of_payment']=='copay') ?
$session_id : $payment_id ;
353 $payment_key = $form_pid . '.' . preg_replace('/[^0-9]/', '', $timestamp).'.'.$ref_id;
355 // get facility from encounter
359 WHERE encounter = ?", array($payrow['encounter']) );
360 $frow = sqlQuery("SELECT * FROM facility " .
361 " WHERE id = ?", array($tmprow['facility_id']) );
363 // Now proceed with printing the receipt.
366 <title
><?php
echo xlt('Receipt for Payment'); ?
></title
>
367 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
368 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
369 <script language
="JavaScript">
371 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
373 $
(document
).ready(function() {
374 opener
.top
.printLogSetup(document
.getElementById('printbutton'));
377 // This is action to take before printing and is called from restoreSession.php.
378 function printlog_before_print() {
379 var divstyle
= document
.getElementById('hideonprint').style
;
380 divstyle
.display
= 'none';
383 // Process click on Delete button.
384 function deleteme() {
385 dlgopen('deleter.php?payment=<?php echo $payment_key ?>', '_blank', 500, 450);
388 // Called by the deleteme.php window on a successful delete.
389 function imdeleted() {
393 // Called to switch to the specified encounter having the specified DOS.
394 // This also closes the popup window.
395 function toencounter(enc
, datestr
, topframe
) {
396 topframe
.restoreSession();
397 <?php
if ($GLOBALS['concurrent_layout']) { ?
>
398 // Hard-coding of RBot for this purpose is awkward, but since this is a
399 // pop-up and our openemr is left_nav, we have no good clue as to whether
400 // the top frame is more appropriate.
401 topframe
.left_nav
.forceDual();
402 topframe
.left_nav
.setEncounter(datestr
, enc
, '');
403 topframe
.left_nav
.setRadio('RBot', 'enc');
404 topframe
.left_nav
.loadFrame('enc2', 'RBot', 'patient_file/encounter/encounter_top.php?set_encounter=' + enc
);
406 topframe
.Title
.location
.href
= 'encounter/encounter_title.php?set_encounter=' + enc
;
407 topframe
.Main
.location
.href
= 'encounter/patient_encounter.php?set_encounter=' + enc
;
414 <body bgcolor
='#ffffff'>
417 <p
><h2
><?php
echo xlt('Receipt for Payment'); ?
></h2
>
419 <p
><?php
echo text($frow['name']) ?
>
420 <br
><?php
echo text($frow['street']) ?
>
421 <br
><?php
echo text($frow['city'] . ', ' . $frow['state']) . ' ' .
422 text($frow['postal_code']) ?
>
423 <br
><?php
echo htmlentities($frow['phone']) ?
>
426 <table border
='0' cellspacing
='8'>
428 <td
><?php
echo xlt('Date'); ?
>:</td
>
429 <td
><?php
echo text(oeFormatSDFT(strtotime($payrow['dtime']))) ?
></td
>
432 <td
><?php
echo xlt('Patient'); ?
>:</td
>
433 <td
><?php
echo text($patdata['fname']) . " " . text($patdata['mname']) . " " .
434 text($patdata['lname']) . " (" . text($patdata['pubpid']) . ")" ?
></td
>
437 <td
><?php
echo xlt('Paid Via'); ?
>:</td
>
438 <td
><?php
echo generate_display_field(array('data_type'=>'1','list_id'=>'payment_method'),$payrow['method']); ?
></td
>
441 <td
><?php
echo xlt('Check/Ref Number'); ?
>:</td
>
442 <td
><?php
echo text($payrow['source']) ?
></td
>
445 <td
><?php
echo xlt('Amount for This Visit'); ?
>:</td
>
446 <td
><?php
echo text(oeFormatMoney($payrow['amount1'])) ?
></td
>
449 <td
><?php
echo xlt('Amount for Past Balance'); ?
>:</td
>
450 <td
><?php
echo text(oeFormatMoney($payrow['amount2'])) ?
></td
>
453 <td
><?php
echo xlt('Received By'); ?
>:</td
>
454 <td
><?php
echo text($payrow['user']) ?
></td
>
458 <div id
='hideonprint'>
460 <input type
='button' value
='<?php echo xla('Print'); ?>' id
='printbutton' />
463 $todaysenc = todaysEncounterIf($pid);
464 if ($todaysenc && $todaysenc != $encounter) {
465 echo " <input type='button' " .
466 "value='" . xla('Open Today`s Visit') . "' " .
467 "onclick='toencounter($todaysenc,\"$today\",opener.top)' />\n";
471 <?php
if (acl_check('admin', 'super')) { ?
>
473 <input type
='button' value
='<?php xl('Delete
','e
'); ?>' style
='color:red' onclick
='deleteme()' />
482 // End of receipt printing logic.
486 // Here we display the form for data entry.
489 <title
><?php
echo xlt('Record Payment'); ?
></title
>
491 <style type
="text/css">
492 body
{ font
-family
:sans
-serif
; font
-size
:10pt
; font
-weight
:normal
}
493 .dehead
{ color
:#000000; font-family:sans-serif; font-size:10pt; font-weight:bold }
494 .detail
{ color
:#000000; font-family:sans-serif; font-size:10pt; font-weight:normal }
498 background
-color
: #FBFDD0;
499 border
: 1px solid
#ccc;
504 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
506 <!-- supporting javascript code
-->
507 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
509 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script
>
513 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
514 <link rel
="stylesheet" type
="text/css" href
="../../library/js/fancybox/jquery.fancybox-1.2.6.css" media
="screen" />
515 <style type
="text/css">@import
url(../../library
/dynarch_calendar
.css
);</style
>
516 <script type
="text/javascript" src
="../../library/textformat.js"></script
>
517 <script type
="text/javascript" src
="../../library/dynarch_calendar.js"></script
>
518 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
519 <script type
="text/javascript" src
="../../library/dynarch_calendar_setup.js"></script
>
520 <script type
="text/javascript" src
="../../library/dialog.js"></script
>
521 <script type
="text/javascript" src
="../../library/js/jquery.1.3.2.js"></script
>
522 <script type
="text/javascript" src
="../../library/js/common.js"></script
>
523 <script type
="text/javascript" src
="../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script
>
524 <script type
="text/javascript" src
="../../library/js/jquery.easydrag.handler.beta2.js"></script
>
525 <script language
='JavaScript'>
528 <?php
include_once("{$GLOBALS['srcdir']}/ajax/payment_ajax_jav.inc.php"); ?
>
529 <script language
="javascript" type
="text/javascript">
530 document
.onclick
=HideTheAjaxDivs
;
533 <script type
="text/javascript" src
="../../library/topdialog.js"></script
>
535 <script language
="JavaScript">
536 <?php
require($GLOBALS['srcdir'] . "/restoreSession.php"); ?
>
538 function calctotal() {
539 var f
= document
.forms
[0];
541 for (var i
= 0; i
< f
.elements
.length
; ++i
) {
542 var elem
= f
.elements
[i
];
543 var ename
= elem
.name
;
544 if (ename
.indexOf('form_upay[') == 0 || ename
.indexOf('form_bpay[') == 0) {
545 if (elem
.value
.length
> 0) total +
= Number(elem
.value
);
548 f
.form_paytotal
.value
= Number(total
).toFixed(2);
553 for (var i
= 1; ; ++i
)
555 if(document
.getElementById('paying_'+i
))
557 paying
=document
.getElementById('paying_'+i
).value
*1;
558 patient_balance
=document
.getElementById('duept_'+i
).innerHTML
*1;
559 //balance=document.getElementById('balance_'+i).innerHTML*1;
560 if(patient_balance
>0 && paying
>0)
562 if(paying
>patient_balance
)
564 document
.getElementById('paying_'+i
).style
.background
='#FF0000';
566 else if(paying
<patient_balance
)
568 document
.getElementById('paying_'+i
).style
.background
='#99CC00';
570 else if(paying
==patient_balance
)
572 document
.getElementById('paying_'+i
).style
.background
='#ffffff';
577 document
.getElementById('paying_'+i
).style
.background
='#ffffff';
586 function CheckVisible(MakeBlank
)
587 {//Displays and hides the check number text box.
588 if(document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
=='check_payment' ||
589 document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
=='bank_draft' )
591 document
.getElementById('check_number').disabled
=false;
595 document
.getElementById('check_number').disabled
=true;
600 var f
= document
.forms
[0];
602 top
.restoreSession();
604 if(((document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
=='check_payment' ||
605 document
.getElementById('form_method').options
[document
.getElementById('form_method').selectedIndex
].value
=='bank_draft') &&
606 document
.getElementById('check_number').value
=='' ))
608 alert("<?php echo addslashes( xl('Please Fill the Check/Ref Number')) ?>");
609 document
.getElementById('check_number').focus();
613 if(document
.getElementById('radio_type_of_payment_self1').checked
==false && document
.getElementById('radio_type_of_payment_self2').checked
==false && document
.getElementById('radio_type_of_payment1').checked
==false && document
.getElementById('radio_type_of_payment2').checked
==false && document
.getElementById('radio_type_of_payment5').checked
==false && document
.getElementById('radio_type_of_payment4').checked
==false)
615 alert("<?php echo addslashes( xl('Please Select Type Of Payment.')) ?>");
618 if(document
.getElementById('radio_type_of_payment_self1').checked
==true || document
.getElementById('radio_type_of_payment_self2').checked
==true || document
.getElementById('radio_type_of_payment1').checked
==true || document
.getElementById('radio_type_of_payment5').checked
==true)
620 for (var i
= 0; i
< f
.elements
.length
; ++i
)
622 var elem
= f
.elements
[i
];
623 var ename
= elem
.name
;
624 if (ename
.indexOf('form_upay[0') == 0) //Today is this text box.
627 {//A warning message, if the amount is posted with out encounter.
628 if(confirm("<?php echo addslashes( xl('Are you sure to post for today?')) ?>"))
643 if(document
.getElementById('radio_type_of_payment1').checked
==true)//CO-PAY
646 for (var i
= 0; i
< f
.elements
.length
; ++i
)
648 var elem
= f
.elements
[i
];
649 var ename
= elem
.name
;
650 if (ename
.indexOf('form_upay[') == 0) //Today is this text box.
652 if(f
.form_paytotal
.value
*1!=elem
.value
*1)//Total CO-PAY is not posted against today
653 {//A warning message, if the amount is posted against an old encounter.
654 if(confirm("<?php echo addslashes( xl('You are posting against an old encounter?')) ?>"))
668 else if(document
.getElementById('radio_type_of_payment2').checked
==true)//Invoice Balance
670 if(document
.getElementById('Today').innerHTML
=='')
672 for (var i
= 0; i
< f
.elements
.length
; ++i
)
674 var elem
= f
.elements
[i
];
675 var ename
= elem
.name
;
676 if (ename
.indexOf('form_upay[') == 0)
678 if (elem
.value
*1 > 0)
680 alert("<?php echo addslashes( xl('Invoice Balance cannot be posted. No Encounter is created.')) ?>");
690 if(confirm("<?php echo addslashes( xl('Would you like to save?')) ?>"))
700 function cursor_pointer()
701 {//Point the cursor to the latest encounter(Today)
702 var f
= document
.forms
[0];
704 for (var i
= 0; i
< f
.elements
.length
; ++i
)
706 var elem
= f
.elements
[i
];
707 var ename
= elem
.name
;
708 if (ename
.indexOf('form_upay[') == 0)
715 //=====================================================
716 function make_it_hide_enc_pay()
718 document
.getElementById('td_head_insurance_payment').style
.display
="none";
719 document
.getElementById('td_head_patient_co_pay').style
.display
="none";
720 document
.getElementById('td_head_co_pay').style
.display
="none";
721 document
.getElementById('td_head_insurance_balance').style
.display
="none";
722 for (var i
= 1; ; ++i
)
724 var td_inspaid_elem
= document
.getElementById('td_inspaid_'+i
)
725 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_'+i
)
726 var td_copay_elem
= document
.getElementById('td_copay_'+i
)
727 var balance_elem
= document
.getElementById('balance_'+i
)
730 td_inspaid_elem
.style
.display
="none";
731 td_patient_copay_elem
.style
.display
="none";
732 td_copay_elem
.style
.display
="none";
733 balance_elem
.style
.display
="none";
740 document
.getElementById('td_total_4').style
.display
="none";
741 document
.getElementById('td_total_7').style
.display
="none";
742 document
.getElementById('td_total_8').style
.display
="none";
743 document
.getElementById('td_total_6').style
.display
="none";
745 document
.getElementById('table_display').width
="420px";
748 //=====================================================
749 function make_visible()
751 document
.getElementById('td_head_rep_doc').style
.display
="";
752 document
.getElementById('td_head_description').style
.display
="";
753 document
.getElementById('td_head_total_charge').style
.display
="none";
754 document
.getElementById('td_head_insurance_payment').style
.display
="none";
755 document
.getElementById('td_head_patient_payment').style
.display
="none";
756 document
.getElementById('td_head_patient_co_pay').style
.display
="none";
757 document
.getElementById('td_head_co_pay').style
.display
="none";
758 document
.getElementById('td_head_insurance_balance').style
.display
="none";
759 document
.getElementById('td_head_patient_balance').style
.display
="none";
760 for (var i
= 1; ; ++i
)
762 var td_charges_elem
= document
.getElementById('td_charges_'+i
)
763 var td_inspaid_elem
= document
.getElementById('td_inspaid_'+i
)
764 var td_ptpaid_elem
= document
.getElementById('td_ptpaid_'+i
)
765 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_'+i
)
766 var td_copay_elem
= document
.getElementById('td_copay_'+i
)
767 var balance_elem
= document
.getElementById('balance_'+i
)
768 var duept_elem
= document
.getElementById('duept_'+i
)
771 td_charges_elem
.style
.display
="none";
772 td_inspaid_elem
.style
.display
="none";
773 td_ptpaid_elem
.style
.display
="none";
774 td_patient_copay_elem
.style
.display
="none";
775 td_copay_elem
.style
.display
="none";
776 balance_elem
.style
.display
="none";
777 duept_elem
.style
.display
="none";
784 document
.getElementById('td_total_7').style
.display
="";
785 document
.getElementById('td_total_8').style
.display
="";
786 document
.getElementById('td_total_1').style
.display
="none";
787 document
.getElementById('td_total_2').style
.display
="none";
788 document
.getElementById('td_total_3').style
.display
="none";
789 document
.getElementById('td_total_4').style
.display
="none";
790 document
.getElementById('td_total_5').style
.display
="none";
791 document
.getElementById('td_total_6').style
.display
="none";
793 document
.getElementById('table_display').width
="505px";
795 function make_it_hide()
797 document
.getElementById('td_head_rep_doc').style
.display
="none";
798 document
.getElementById('td_head_description').style
.display
="none";
799 document
.getElementById('td_head_total_charge').style
.display
="";
800 document
.getElementById('td_head_insurance_payment').style
.display
="";
801 document
.getElementById('td_head_patient_payment').style
.display
="";
802 document
.getElementById('td_head_patient_co_pay').style
.display
="";
803 document
.getElementById('td_head_co_pay').style
.display
="";
804 document
.getElementById('td_head_insurance_balance').style
.display
="";
805 document
.getElementById('td_head_patient_balance').style
.display
="";
806 for (var i
= 1; ; ++i
)
808 var td_charges_elem
= document
.getElementById('td_charges_'+i
)
809 var td_inspaid_elem
= document
.getElementById('td_inspaid_'+i
)
810 var td_ptpaid_elem
= document
.getElementById('td_ptpaid_'+i
)
811 var td_patient_copay_elem
= document
.getElementById('td_patient_copay_'+i
)
812 var td_copay_elem
= document
.getElementById('td_copay_'+i
)
813 var balance_elem
= document
.getElementById('balance_'+i
)
814 var duept_elem
= document
.getElementById('duept_'+i
)
817 td_charges_elem
.style
.display
="";
818 td_inspaid_elem
.style
.display
="";
819 td_ptpaid_elem
.style
.display
="";
820 td_patient_copay_elem
.style
.display
="";
821 td_copay_elem
.style
.display
="";
822 balance_elem
.style
.display
="";
823 duept_elem
.style
.display
="";
830 document
.getElementById('td_total_1').style
.display
="";
831 document
.getElementById('td_total_2').style
.display
="";
832 document
.getElementById('td_total_3').style
.display
="";
833 document
.getElementById('td_total_4').style
.display
="";
834 document
.getElementById('td_total_5').style
.display
="";
835 document
.getElementById('td_total_6').style
.display
="";
836 document
.getElementById('td_total_7').style
.display
="";
837 document
.getElementById('td_total_8').style
.display
="";
839 document
.getElementById('table_display').width
="635px";
841 function make_visible_radio()
843 document
.getElementById('tr_radio1').style
.display
="";
844 document
.getElementById('tr_radio2').style
.display
="none";
846 function make_hide_radio()
848 document
.getElementById('tr_radio1').style
.display
="none";
849 document
.getElementById('tr_radio2').style
.display
="";
851 function make_visible_row()
853 document
.getElementById('table_display').style
.display
="";
854 document
.getElementById('table_display_prepayment').style
.display
="none";
856 function make_hide_row()
858 document
.getElementById('table_display').style
.display
="none";
859 document
.getElementById('table_display_prepayment').style
.display
="";
865 make_it_hide_enc_pay();
866 document
.getElementById('radio_type_of_payment_self1').checked
=true;
869 function make_insurance()
874 document
.getElementById('radio_type_of_payment1').checked
=true;
880 <body
class="body_top" onunload
='imclosing()' onLoad
="cursor_pointer();">
883 <form method
='post' action
='front_payment.php<?php if ($payid) echo "?payid=$payid"; ?>'
884 onsubmit
='return validate();'>
885 <input type
='hidden' name
='form_pid' value
='<?php echo attr($pid) ?>' />
888 <table border
='0' cellspacing
='0' cellpadding
="0">
891 <td colspan
="3"> 
;</td
>
895 <td colspan
='3' align
='center' class='text' >
896 <b
><?php
echo htmlspecialchars(xl('Accept Payment for'), ENT_QUOTES
); ?
> 
;: 
; 
;<?php
echo htmlspecialchars($patdata['fname'], ENT_QUOTES
) . " " .
897 htmlspecialchars($patdata['lname'], ENT_QUOTES
) . " " .htmlspecialchars($patdata['mname'], ENT_QUOTES
). " (" . htmlspecialchars($patdata['pid'], ENT_QUOTES
) . ")" ?
></b
>
898 <?php
$NameNew=$patdata['fname'] . " " .$patdata['lname']. " " .$patdata['mname'];?
>
902 <tr height
="15"><td colspan
='3'></td
></tr
>
907 <?php
echo xlt('Payment Method'); ?
>:
910 <select name
="form_method" id
="form_method" class="text" onChange
='CheckVisible("yes")'>
912 $query1112 = "SELECT * FROM list_options where list_id=? ORDER BY seq, title ";
913 $bres1112 = sqlStatement($query1112,array('payment_method'));
914 while ($brow1112 = sqlFetchArray($bres1112))
916 if($brow1112['option_id']=='electronic' ||
$brow1112['option_id']=='bank_draft')
918 echo "<option value='".htmlspecialchars($brow1112['option_id'], ENT_QUOTES
)."'>".htmlspecialchars(xl_list_label($brow1112['title']), ENT_QUOTES
)."</option>";
925 <tr height
="5"><td colspan
='3'></td
></tr
>
929 <?php
echo xla('Check/Ref Number'); ?
>:
931 <td colspan
='2' ><div id
="ajax_div_patient" style
="display:none;"></div
>
932 <input type
='text' id
="check_number" name
='form_source' style
="width:120px" value
='<?php echo htmlspecialchars($payrow['source
'], ENT_QUOTES); ?>'>
935 <tr height
="5"><td colspan
='3'></td
></tr
>
938 <td
class='text' valign
="middle" >
939 <?php
echo htmlspecialchars(xl('Patient Coverage'), ENT_QUOTES
); ?
>:
941 <td
class='text' colspan
="2" ><input type
="radio" name
="radio_type_of_coverage" id
="radio_type_of_coverage1" value
="self" onClick
="make_visible_radio();make_self();"/><?php
echo htmlspecialchars(xl('Self'), ENT_QUOTES
); ?
><input type
="radio" name
="radio_type_of_coverage" id
="radio_type_of_coverag2" value
="insurance" checked
="checked" onClick
="make_hide_radio();make_insurance();"/><?php
echo htmlspecialchars(xl('Insurance'), ENT_QUOTES
); ?
> </td
>
944 <tr height
="5"><td colspan
='3'></td
></tr
>
946 <tr id
="tr_radio1" style
="display:none"><!-- For radio Insurance
-->
947 <td
class='text' valign
="top" >
948 <?php
echo htmlspecialchars(xl('Payment against'), ENT_QUOTES
); ?
>:
950 <td
class='text' colspan
="2" ><input type
="radio" name
="radio_type_of_payment" id
="radio_type_of_payment_self1" value
="cash" onClick
="make_visible_row();make_it_hide_enc_pay();cursor_pointer();"/><?php
echo htmlspecialchars(xl('Encounter Payment'), ENT_QUOTES
); ?
></td
>
952 <tr id
="tr_radio2"><!-- For radio self
-->
953 <td
class='text' valign
="top" >
954 <?php
echo htmlspecialchars(xl('Payment against'), ENT_QUOTES
); ?
>:
956 <td
class='text' colspan
="2" ><input type
="radio" name
="radio_type_of_payment" id
="radio_type_of_payment1" value
="copay" checked
="checked" onClick
="make_visible_row();cursor_pointer();"/><?php
echo htmlspecialchars(xl('Co Pay'), ENT_QUOTES
); ?
><input type
="radio" name
="radio_type_of_payment" id
="radio_type_of_payment2" value
="invoice_balance" onClick
="make_visible_row();"/><?php
echo htmlspecialchars(xl('Invoice Balance'), ENT_QUOTES
); ?
><br
/><input type
="radio" name
="radio_type_of_payment" id
="radio_type_of_payment4" value
="pre_payment" onClick
="make_hide_row();"/><?php
echo htmlspecialchars(xl('Pre Pay'), ENT_QUOTES
); ?
></td
>
959 <tr height
="15"><td colspan
='3'></td
></tr
>
962 <table width
="200" border
="0" cellspacing
="0" cellpadding
="0" id
="table_display_prepayment" style
="display:none">
964 <td
class='detail'><?php
echo htmlspecialchars(xl('Pre Payment'), ENT_QUOTES
); ?
></td
>
965 <td
><input type
='text' name
='form_prepayment' style
='width:100px' /></td
>
969 <table border
='0' id
="table_display" cellpadding
='0' cellspacing
='0' width
='635'>
970 <tr bgcolor
="#cccccc" id
="tr_head">
971 <td
class="dehead" width
="70">
972 <?php
echo htmlspecialchars( xl('DOS'), ENT_QUOTES
) ?
>
974 <td
class="dehead" width
="65">
975 <?php
echo htmlspecialchars( xl('Encounter'), ENT_QUOTES
) ?
>
977 <td
class="dehead" align
="center" width
="80" id
="td_head_total_charge" >
978 <?php
echo htmlspecialchars( xl('Total Charge'), ENT_QUOTES
) ?
>
980 <td
class="dehead" align
="center" width
="70" id
="td_head_rep_doc" style
='display:none'>
981 <?php
echo htmlspecialchars( xl('Report/ Form'), ENT_QUOTES
) ?
>
983 <td
class="dehead" align
="center" width
="200" id
="td_head_description" style
='display:none'>
984 <?php
echo htmlspecialchars( xl('Description'), ENT_QUOTES
) ?
>
986 <td
class="dehead" align
="center" width
="80" id
="td_head_insurance_payment" >
987 <?php
echo htmlspecialchars( xl('Insurance Payment'), ENT_QUOTES
) ?
>
989 <td
class="dehead" align
="center" width
="80" id
="td_head_patient_payment" >
990 <?php
echo htmlspecialchars( xl('Patient Payment'), ENT_QUOTES
) ?
>
992 <td
class="dehead" align
="center" width
="55" id
="td_head_patient_co_pay" >
993 <?php
echo htmlspecialchars( xl('Co Pay Paid'), ENT_QUOTES
) ?
>
995 <td
class="dehead" align
="center" width
="55" id
="td_head_co_pay" >
996 <?php
echo htmlspecialchars( xl('Required Co Pay'), ENT_QUOTES
) ?
>
998 <td
class="dehead" align
="center" width
="80" id
="td_head_insurance_balance" >
999 <?php
echo htmlspecialchars( xl('Insurance Balance'), ENT_QUOTES
) ?
>
1001 <td
class="dehead" align
="center" width
="80" id
="td_head_patient_balance" >
1002 <?php
echo htmlspecialchars( xl('Patient Balance'), ENT_QUOTES
) ?
>
1004 <td
class="dehead" align
="center" width
="50">
1005 <?php
echo htmlspecialchars( xl('Paying'), ENT_QUOTES
) ?
>
1012 // Get the unbilled service charges and payments by encounter for this patient.
1014 $query = "SELECT fe.encounter, b.code_type, b.code, b.modifier, b.fee, " .
1015 "LEFT(fe.date, 10) AS encdate ,fe.last_level_closed " .
1016 "FROM form_encounter AS fe left join billing AS b on " .
1017 "b.pid = ? AND b.activity = 1 AND " .//AND b.billed = 0
1018 "b.code_type != 'TAX' AND b.fee != 0 " .
1019 "AND fe.pid = b.pid AND fe.encounter = b.encounter " .
1020 "where fe.pid = ? " .
1021 "ORDER BY b.encounter";
1022 $bres = sqlStatement($query,array($pid,$pid));
1024 while ($brow = sqlFetchArray($bres)) {
1025 $key = 0 - $brow['encounter'];
1026 if (empty($encs[$key])) {
1027 $encs[$key] = array(
1028 'encounter' => $brow['encounter'],
1029 'date' => $brow['encdate'],
1030 'last_level_closed' => $brow['last_level_closed'],
1034 if ($brow['code_type'] === 'COPAY') {
1035 //$encs[$key]['payments'] -= $brow['fee'];
1037 $encs[$key]['charges'] +
= $brow['fee'];
1040 $query = "SELECT taxrates FROM codes WHERE " .
1041 "code_type = ? AND " .
1043 array_push($sql_array,$code_types[$brow['code_type']]['id'],$brow['code']);
1044 if ($brow['modifier']) {
1045 $query .= "modifier = ?";
1046 array_push($sql_array,$brow['modifier']);
1048 $query .= "(modifier IS NULL OR modifier = '')";
1050 $query .= " LIMIT 1";
1051 $trow = sqlQuery($query,$sql_array);
1052 $encs[$key]['charges'] +
= calcTaxes($trow, $brow['fee']);
1056 // Do the same for unbilled product sales.
1058 $query = "SELECT fe.encounter, s.drug_id, s.fee, " .
1059 "LEFT(fe.date, 10) AS encdate,fe.last_level_closed " .
1060 "FROM form_encounter AS fe left join drug_sales AS s " .
1061 "on s.pid = ? AND s.fee != 0 " .//AND s.billed = 0
1062 "AND fe.pid = s.pid AND fe.encounter = s.encounter " .
1063 "where fe.pid = ? " .
1064 "ORDER BY s.encounter";
1066 $dres = sqlStatement($query,array($pid,$pid));
1068 while ($drow = sqlFetchArray($dres)) {
1069 $key = 0 - $drow['encounter'];
1070 if (empty($encs[$key])) {
1071 $encs[$key] = array(
1072 'encounter' => $drow['encounter'],
1073 'date' => $drow['encdate'],
1074 'last_level_closed' => $drow['last_level_closed'],
1078 $encs[$key]['charges'] +
= $drow['fee'];
1080 $trow = sqlQuery("SELECT taxrates FROM drug_templates WHERE drug_id = ? " .
1081 "ORDER BY selector LIMIT 1", array($drow['drug_id']) );
1082 $encs[$key]['charges'] +
= calcTaxes($trow, $drow['fee']);
1085 ksort($encs, SORT_NUMERIC
);
1087 //Bringing on top the Today always
1088 foreach ($encs as $key => $value) {
1089 $dispdate = $value['date'];
1090 if (strcmp($dispdate, $today) == 0 && !$gottoday) {
1096 // If no billing was entered yet for today, then generate a line for
1097 // entering today's co-pay.
1100 echoLine("form_upay[0]", date("Y-m-d"), 0, 0, 0, 0 /*$duept*/);//No encounter yet defined.
1104 foreach ($encs as $key => $value) {
1105 $enc = $value['encounter'];
1106 $dispdate = $value['date'];
1107 if (strcmp($dispdate, $today) == 0 && !$gottoday) {
1108 $dispdate = date("Y-m-d");
1111 //------------------------------------------------------------------------------------
1112 $inscopay = getCopay($pid, $dispdate);
1113 $patcopay = getPatientCopay($pid, $enc);
1116 $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " .
1117 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1118 "pid = ? and encounter = ? and " .
1119 "payer_type != 0 and account_code!='PCP' ",
1121 $dpayment=$drow['payments'];
1122 $dadjustment=$drow['adjustments'];
1125 $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " .
1126 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1127 "pid = ? and encounter = ? and " .
1128 "payer_type = 0 and account_code!='PCP' ",
1130 $dpayment_pat=$drow['payments'];
1132 //------------------------------------------------------------------------------------
1134 $ResultNumberOfInsurance = sqlStatement("SELECT COUNT( DISTINCT TYPE ) NumberOfInsurance FROM insurance_data
1135 where pid = ? and provider>0 ",array($pid));
1136 $RowNumberOfInsurance = sqlFetchArray($ResultNumberOfInsurance);
1137 $NumberOfInsurance=$RowNumberOfInsurance['NumberOfInsurance']*1;
1138 //------------------------------------------------------------------------------------
1140 if((($NumberOfInsurance==0 ||
$value['last_level_closed']==4 ||
$NumberOfInsurance== $value['last_level_closed'])))
1142 $brow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " .
1143 "pid = ? and encounter = ? AND activity = 1",array($pid,$enc));
1144 $srow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " .
1145 "pid = ? and encounter = ? ",array($pid,$enc));
1146 $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " .
1147 "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " .
1148 "pid = ? and encounter = ? ",array($pid,$enc));
1149 $duept= $brow['amount'] +
$srow['amount'] - $drow['payments'] - $drow['adjustments'];
1151 echoLine("form_upay[$enc]", $dispdate, $value['charges'],
1152 $dpayment_pat, ($dpayment +
$dadjustment), $duept,$enc,$inscopay,$patcopay);
1156 // Now list previously billed visits.
1158 if ($INTEGRATED_AR) {
1160 } // end $INTEGRATED_AR
1162 // Query for all open invoices.
1163 $query = "SELECT ar.id, ar.invnumber, ar.amount, ar.paid, " .
1164 "ar.intnotes, ar.notes, ar.shipvia, " .
1165 "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " .
1166 "invoice.trans_id = ar.id AND invoice.sellprice > 0) AS charges, " .
1167 "(SELECT SUM(invoice.sellprice * invoice.qty) FROM invoice WHERE " .
1168 "invoice.trans_id = ar.id AND invoice.sellprice < 0) AS adjustments, " .
1169 "(SELECT SUM(acc_trans.amount) FROM acc_trans WHERE " .
1170 "acc_trans.trans_id = ar.id AND acc_trans.chart_id = ? " .
1171 "AND acc_trans.source NOT LIKE 'Ins%') AS ptpayments " .
1172 "FROM ar WHERE ar.invnumber LIKE ? AND " .
1173 "ar.amount != ar.paid " .
1174 "ORDER BY ar.invnumber";
1175 $ires = SLQuery($query, array($chart_id_cash,$pid."%") );
1176 if ($sl_err) die($sl_err);
1177 $num_invoices = SLRowCount($ires);
1179 for ($ix = 0; $ix < $num_invoices; ++
$ix) {
1180 $irow = SLGetRow($ires, $ix);
1182 // Get encounter ID and date of service.
1183 list($patient_id, $enc) = explode(".", $irow['invnumber']);
1184 $tmp = sqlQuery("SELECT LEFT(date, 10) AS encdate FROM form_encounter " .
1185 "WHERE encounter = ?", array($enc) );
1186 $svcdate = $tmp['encdate'];
1188 // Compute $duncount as in sl_eob_search.php to determine if
1189 // this invoice is at patient responsibility.
1190 $duncount = substr_count(strtolower($irow['intnotes']), "statement sent");
1192 $insgot = strtolower($irow['notes']);
1193 $inseobs = strtolower($irow['shipvia']);
1194 foreach (array('ins1', 'ins2', 'ins3') as $value) {
1195 if (strpos($insgot, $value) !== false &&
1196 strpos($inseobs, $value) === false)
1201 $inspaid = $irow['paid'] +
$irow['ptpayments'] - $irow['adjustments'];
1202 $balance = $irow['amount'] - $irow['paid'];
1203 $duept = ($duncount < 0) ?
0 : $balance;
1205 echoLine("form_bpay[$enc]", $svcdate, $irow['charges'],
1206 0 - $irow['ptpayments'], $inspaid, $duept);
1208 } // end not $INTEGRATED_AR
1210 // Continue with display of the data entry form.
1213 <tr bgcolor
="#cccccc">
1214 <td
class="dehead" id
='td_total_1'></td
>
1215 <td
class="dehead" id
='td_total_2'></td
>
1216 <td
class="dehead" id
='td_total_3'></td
>
1217 <td
class="dehead" id
='td_total_4'></td
>
1218 <td
class="dehead" id
='td_total_5'></td
>
1219 <td
class="dehead" id
='td_total_6'></td
>
1220 <td
class="dehead" id
='td_total_7'></td
>
1221 <td
class="dehead" id
='td_total_8'></td
>
1222 <td
class="dehead" align
="right">
1223 <?php
echo htmlspecialchars( xl('Total'), ENT_QUOTES
);?
>
1225 <td
class="dehead" align
="right">
1226 <input type
='text' name
='form_paytotal' value
=''
1227 style
='color:#00aa00;width:50px' readonly
/>
1234 <input type
='submit' name
='form_save' value
='<?php echo htmlspecialchars( xl('Generate Invoice
'), ENT_QUOTES);?>' />  
;
1235 <input type
='button' value
='<?php echo xla('Cancel
'); ?>' onclick
='window.close()' />
1237 <input type
="hidden" name
="hidden_patient_code" id
="hidden_patient_code" value
="<?php echo attr($pid);?>"/>
1238 <input type
='hidden' name
='ajax_mode' id
='ajax_mode' value
='' />
1239 <input type
='hidden' name
='mode' id
='mode' value
='' />
1241 <script language
="JavaScript">
1249 if (!$INTEGRATED_AR) SLClose();