summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-payment_options.html
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-05-14 10:21:15 -0400
committerChristopher Burger <burgerc@freeside.biz>2018-05-14 10:21:15 -0400
commit88371c24e0b727646f0b01288f01439a06967fe7 (patch)
treef665111af01c7059d3dc0f9e706f3aee656a8f6c /httemplate/elements/tr-select-payment_options.html
parent2eea268a59cf357853e31ff8d5db6033e4bdc8ea (diff)
RT# 34134 - fixed error with credit surchage not attached to total
Diffstat (limited to 'httemplate/elements/tr-select-payment_options.html')
-rw-r--r--httemplate/elements/tr-select-payment_options.html41
1 files changed, 38 insertions, 3 deletions
diff --git a/httemplate/elements/tr-select-payment_options.html b/httemplate/elements/tr-select-payment_options.html
index 8859b9b36..15f92775a 100644
--- a/httemplate/elements/tr-select-payment_options.html
+++ b/httemplate/elements/tr-select-payment_options.html
@@ -38,7 +38,7 @@ Example:
<OPTION VALUE="select">Select payment option</OPTION>
<OPTION VALUE="<% $opt{amount} %>">Pay full balance</OPTION>
<OPTION VALUE="invoice">Pay specific invoice</OPTION>
- <OPTION VALUE="">Pay specific amount</OPTION>
+ <OPTION VALUE="specific">Pay specific amount</OPTION>
</SELECT>
</TD>
</TR>
@@ -57,6 +57,14 @@ Example:
function <% $opt{prefix} %>payment_option_changed(what) {
+ var surcharge;
+ if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_percentage')) {
+ surcharge = (+what.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
+ }
+ else { surcharge = 0; }
+ var amount = +what.value + +surcharge;
+ document.getElementById('amount').disabled = true;
+
if ( what.value == 'select' ) {
document.getElementById('payment_amount_row').style.display = 'none';
document.getElementById('invoice_row').style.display = 'none';
@@ -68,24 +76,48 @@ Example:
document.getElementById('invoice_row').style.display = 'block';
document.getElementById('amount').value = '';
}
+ else if ( what.value == 'specific' ) {
+ document.getElementById('payment_amount_row').style.display = 'block';
+ document.getElementById('invoice_row').style.display = 'none';
+ document.getElementById('<% $opt{prefix} %>invoice').value = 'select';
+ document.getElementById('amount').value = '0.00';
+ document.getElementById('amount').disabled = false;
+ if (document.getElementById('ajax_surcharge_cell')) {
+ document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>0.00 is included in this payment</FONT>';
+ }
+ }
else {
document.getElementById('payment_amount_row').style.display = 'block';
document.getElementById('invoice_row').style.display = 'none';
document.getElementById('<% $opt{prefix} %>invoice').value = 'select';
- document.getElementById('amount').value = what.value;
+ document.getElementById('amount').value = amount.toFixed(2);
+ if (document.getElementById('ajax_surcharge_cell')) {
+ document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
+ }
}
}
function <% $opt{prefix} %>invoice_select_changed(what) {
+ var surcharge;
+ if (document.getElementById('surcharge_percentage') || document.getElementById('surcharge_percentage')) {
+ surcharge = (+what.value * +document.getElementById('surcharge_percentage').value) + +document.getElementById('surcharge_flatfee').value;
+ }
+ else { surcharge = 0; }
+ var amount = +what.value + +surcharge;
+
if ( what.value == 'select' ) {
+ alert("we have select");
document.getElementById('payment_amount_row').style.display = 'none';
document.getElementById('amount').value = '';
}
else {
document.getElementById('payment_amount_row').style.display = 'block';
- document.getElementById('amount').value = what.value;
+ document.getElementById('amount').value = amount.toFixed(2);
+ if (document.getElementById('ajax_surcharge_cell')) {
+ document.getElementById('ajax_surcharge_cell').innerHTML = '<FONT SIZE="+1">A credit card surcharge of <% $money_char %>' + surcharge.toFixed(2) + ' is included in this payment</FONT>';
+ }
}
}
@@ -96,4 +128,7 @@ Example:
my %opt = @_;
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
+
</%init> \ No newline at end of file