summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main_county.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-02-18 22:04:12 -0800
committerMark Wells <mark@freeside.biz>2014-02-18 22:04:24 -0800
commit30e2dfd524a3f52445cbca6bc2cd1962dce7eb04 (patch)
tree2f54d7d1e316d4e0ab3137848e46ea8dfceb4a37 /FS/FS/cust_main_county.pm
parent3c7fd3e7d40f2c946b2fcf63c63d595c82fcae22 (diff)
non-package fees, phase 1, #25899
Diffstat (limited to 'FS/FS/cust_main_county.pm')
-rw-r--r--FS/FS/cust_main_county.pm26
1 files changed, 21 insertions, 5 deletions
diff --git a/FS/FS/cust_main_county.pm b/FS/FS/cust_main_county.pm
index 5c1be7b..654e567 100644
--- a/FS/FS/cust_main_county.pm
+++ b/FS/FS/cust_main_county.pm
@@ -316,6 +316,11 @@ sub taxline {
my $cust_pkg = $cust_bill_pkg->cust_pkg;
my $part_pkg = $cust_bill_pkg->part_pkg;
+ my $part_fee = $cust_bill_pkg->part_fee;
+
+ my $locationnum = $cust_pkg
+ ? $cust_pkg->locationnum
+ : $cust_main->bill_locationnum;
my @new_exemptions;
my $taxable_charged = $cust_bill_pkg->setup + $cust_bill_pkg->recur
@@ -341,8 +346,13 @@ sub taxline {
}
- if ( ($part_pkg->setuptax eq 'Y' or $self->setuptax eq 'Y')
- and $cust_bill_pkg->setup > 0 and $taxable_charged > 0 ) {
+ my $setup_exempt = ( ($part_fee and not $part_fee->taxable)
+ or ($part_pkg and $part_pkg->setuptax)
+ or $self->setuptax );
+
+ if ( $setup_exempt
+ and $cust_bill_pkg->setup > 0
+ and $taxable_charged > 0 ) {
push @new_exemptions, FS::cust_tax_exempt_pkg->new({
amount => $cust_bill_pkg->setup,
@@ -351,8 +361,14 @@ sub taxline {
$taxable_charged -= $cust_bill_pkg->setup;
}
- if ( ($part_pkg->recurtax eq 'Y' or $self->recurtax eq 'Y')
- and $cust_bill_pkg->recur > 0 and $taxable_charged > 0 ) {
+
+ my $recur_exempt = ( ($part_fee and not $part_fee->taxable)
+ or ($part_pkg and $part_pkg->recurtax)
+ or $self->recurtax );
+
+ if ( $recur_exempt
+ and $cust_bill_pkg->recur > 0
+ and $taxable_charged > 0 ) {
push @new_exemptions, FS::cust_tax_exempt_pkg->new({
amount => $cust_bill_pkg->recur,
@@ -494,7 +510,7 @@ sub taxline {
'taxtype' => ref($self),
'cents' => $this_tax_cents,
'pkgnum' => $cust_bill_pkg->pkgnum,
- 'locationnum' => $cust_bill_pkg->cust_pkg->tax_locationnum,
+ 'locationnum' => $locationnum,
'taxable_cust_bill_pkg' => $cust_bill_pkg,
'tax_cust_bill_pkg' => $tax_item,
});