summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/cust_bill_pkg_tax_location.pm5
-rw-r--r--FS/FS/cust_bill_pkg_tax_rate_location.pm6
-rw-r--r--httemplate/edit/elements/ApplicationCommon.html35
-rw-r--r--httemplate/misc/xmlhttp-calculate_taxes.html1
4 files changed, 43 insertions, 4 deletions
diff --git a/FS/FS/cust_bill_pkg_tax_location.pm b/FS/FS/cust_bill_pkg_tax_location.pm
index 0d3bd3a..120a2d0 100644
--- a/FS/FS/cust_bill_pkg_tax_location.pm
+++ b/FS/FS/cust_bill_pkg_tax_location.pm
@@ -161,7 +161,10 @@ sub desc {
map { $cust_location->$_ }
qw( state county city ) # country?
);
- $self->cust_bill_pkg->desc. " ($location)";
+ my $cust_bill_pkg_desc = $self->billpkgnum
+ ? $self->cust_bill_pkg->desc
+ : $self->cust_bill_pkg_desc;
+ "$cust_bill_pkg_desc ($location)";
}
=item owed
diff --git a/FS/FS/cust_bill_pkg_tax_rate_location.pm b/FS/FS/cust_bill_pkg_tax_rate_location.pm
index 89c2529..39b2bb9 100644
--- a/FS/FS/cust_bill_pkg_tax_rate_location.pm
+++ b/FS/FS/cust_bill_pkg_tax_rate_location.pm
@@ -165,7 +165,11 @@ sub desc {
);
$location .= ( $location && $self->locationtaxid ) ? ', ' : '';
$location .= $self->locationtaxid;
- $self->cust_bill_pkg->desc. " ($location)";
+ my $cust_bill_pkg_desc = $self->billpkgnum
+ ? $self->cust_bill_pkg->desc
+ : $self->cust_bill_pkg_desc;
+ "$cust_bill_pkg_desc ($location)";
+
}
diff --git a/httemplate/edit/elements/ApplicationCommon.html b/httemplate/edit/elements/ApplicationCommon.html
index 08e1d46..ba352fd 100644
--- a/httemplate/edit/elements/ApplicationCommon.html
+++ b/httemplate/edit/elements/ApplicationCommon.html
@@ -86,6 +86,20 @@ Examples:
<BR>
<SCRIPT TYPE="text/javascript">
+function clear_amounts() {
+ var rownum=0
+ var table = document.getElementById('ApplicationTable');
+ for (var row = 2; table.rows[row]; row++)
+ {
+ var inputs = table.rows[row].getElementsByTagName('input');
+ if ( !inputs.length ) {
+ break;
+ }
+ inputs.item(0).value = ''; // amount
+ }
+
+}
+
function changed(what) {
dst = what.options[what.selectedIndex].value;
@@ -93,6 +107,7 @@ function changed(what) {
what.form.submit.disabled=true;
%if ($src_pkey eq 'crednum') {
what.form.tax_button.disabled=true;
+ what.form.clear_button.disabled=true;
%}
return true;
}
@@ -100,6 +115,7 @@ function changed(what) {
what.form.submit.disabled=false;
%if ($src_pkey eq 'crednum') {
what.form.tax_button.disabled=false;
+ what.form.clear_button.disabled=false;
%}
% foreach my $dst ( @dst ) {
@@ -184,7 +200,18 @@ function set_amount_color(what) {
Apply to:
% if ($use_sub_dst_thing && $src_pkey eq 'crednum') {
-<CENTER><BUTTON TYPE="button" NAME="tax_button" ID="tax_button" onClick="do_calculate_tax(this);" DISABLED>Calculate Tax</BUTTON></CENTER>
+<CENTER>
+ <TABLE>
+ <TR>
+ <TD>
+ <BUTTON TYPE="button" NAME="tax_button" ID="tax_button" onClick="do_calculate_tax(this);" DISABLED>Calculate Tax</BUTTON>
+ </TD>
+ <TD>
+ <BUTTON TYPE="button" NAME="clear_button" ID="clear_button" onClick="clear_amounts(this);" DISABLED>Clear Amounts</BUTTON>
+ </TD>
+ </TR>
+ </TABLE>
+</CENTER>
<% include( '/elements/xmlhttp.html',
'url' => $p.'misc/xmlhttp-calculate_taxes.html',
'subs' => [ 'calculate_taxes' ],
@@ -198,6 +225,8 @@ function show_taxes(arg) {
var button = document.getElementById('tax_button');
button.disabled = false;
button.innerHTML = 'Calculate Tax';
+ button = document.getElementById('clear_button');
+ button.disabled = false;
var error = argsHash['error'];
@@ -256,6 +285,8 @@ function show_taxes(arg) {
function do_calculate_tax (what) {
what.innerHTML = 'Calculating....';
what.disabled = true;
+ var button = document.getElementById('clear_button');
+ button.disabled = true;
var taxed_items = new Array();
var table = document.getElementById('ApplicationTable');
for (var row = 2; table.rows[row]; row++)
@@ -267,7 +298,7 @@ function do_calculate_tax (what) {
var taxed_item = new Array(
inputs.item(1).value, // billpkgnum
inputs.item(3).value, // s_or_r
- inputs.item(0).value // amount
+ inputs.item(0).value || 0 // amount
);
taxed_items.push(taxed_item);
}
diff --git a/httemplate/misc/xmlhttp-calculate_taxes.html b/httemplate/misc/xmlhttp-calculate_taxes.html
index 774b893..d3dc36a 100644
--- a/httemplate/misc/xmlhttp-calculate_taxes.html
+++ b/httemplate/misc/xmlhttp-calculate_taxes.html
@@ -87,6 +87,7 @@ if ( $sub eq 'calculate_taxes' ) {
foreach my $location ( @{$taxline->cust_bill_pkg_tax_location}, @{$taxline->cust_bill_pkg_tax_rate_location} ) {
my $taxlocnum = $location->locationnum || '';
my $taxratelocnum = $location->taxratelocationnum || '';
+ $location->cust_bill_pkg_desc($taxline->desc); #ugh @ that kludge
push @taxlines,
[ $location->desc, $taxline->setup, $taxlocnum, $taxratelocnum ];
$amount -= $location->amount;