diff options
Diffstat (limited to 'httemplate/elements/tr-amount_fee.html')
-rw-r--r-- | httemplate/elements/tr-amount_fee.html | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/httemplate/elements/tr-amount_fee.html b/httemplate/elements/tr-amount_fee.html index 1c78d7ec1..a84fef6ec 100644 --- a/httemplate/elements/tr-amount_fee.html +++ b/httemplate/elements/tr-amount_fee.html @@ -1,6 +1,6 @@ - <TR ID="payment_amount_row" <% $opt{'row_style'} %>> + <TR ID="payment_amount_row"> <TH ALIGN="right"><% mt('Payment amount') |h %></TH> - <TD COLSPAN=7> + <TD> <TABLE><TR><TD BGCOLOR="#ffffff"> <% $money_char %><INPUT NAME = "amount" ID = "amount" @@ -8,7 +8,7 @@ VALUE = "<% $amount %>" SIZE = 8 STYLE = "text-align:right;" -% if ( $fee || $surcharge ) { +% if ( $fee || $surcharge_percentage || $surcharge_flatfee ) { onChange = "amount_changed(this)" onKeyDown = "amount_changed(this)" onKeyUp = "amount_changed(this)" @@ -28,7 +28,7 @@ <FONT SIZE="+1"><% length($amount) ? $money_char. sprintf('%.2f', ($fee_display eq 'add') ? $amount + $fee : $amount - $fee ) : '' %> <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %></FONT> % } -% if ( $surcharge ) { +% if ( $surcharge_percentage || $surcharge_flatfee ) { <INPUT TYPE="hidden" NAME="surcharge_percentage" ID="surcharge_percentage" VALUE="<% $surcharge_percentage %>"> <INPUT TYPE="hidden" NAME="surcharge_flatfee" ID="surcharge_flatfee" VALUE="<% $surcharge_flatfee %>"> </TD><TD ID="ajax_surcharge_cell" BGCOLOR="#dddddd" STYLE="border:1px solid blue"> @@ -38,7 +38,7 @@ </TD> </TR> -% if ($fee || $surcharge) { +% if ($fee || $surcharge_percentage || $surcharge_flatfee ) { <SCRIPT TYPE="text/javascript"> @@ -56,7 +56,7 @@ total_cell.innerHTML = '<FONT SIZE="+1">' + total + ' <% $fee_display eq 'add' ? 'TOTAL' : 'AVAILABLE' %></FONT>'; % } -% if ( $surcharge ) { +% if ( $surcharge_percentage || $surcharge_flatfee ) { var surcharge_cell = document.getElementById('ajax_surcharge_cell'); var surcharge = ((what.value - <% $surcharge_flatfee %>) * <% $surcharge_percentage %>) + <% $surcharge_flatfee %>; surcharge_cell.innerHTML = '<FONT SIZE="+1">A credit card surcharge of ' + surcharge.toFixed(2) + ' is included in this payment</FONT>'; @@ -102,7 +102,10 @@ if ( $opt{'process-pkgpart'} } my $amount = $opt{'amount'}; -if ( $amount > 0 ) { +if ( $amount ) { + # probably should not happen, but will prevent surcharge being applied to negative due amounts + unless ($amount > 0) { $amount = 0; } + $amount += $fee if $fee && $fee_display eq 'subtract'; @@ -111,7 +114,7 @@ if ( $amount > 0 ) { $surcharge_percentage = $opt{'surcharge_percentage'}/100 if $opt{'surcharge_percentage'} > 0; $surcharge_flatfee = $opt{'surcharge_flatfee'} if $opt{'surcharge_flatfee'} > 0; $surcharge = $amount * $surcharge_percentage if $surcharge_percentage > 0; - $surcharge += $surcharge_flatfee if $surcharge_flatfee > 0; + $surcharge += $surcharge_flatfee if ( $surcharge_flatfee > 0 && $amount > 0 ); $amount += $surcharge; |