summaryrefslogtreecommitdiff
path: root/FS/FS/TaxEngine/internal.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-04-01 01:54:21 -0500
committerMark Wells <mark@freeside.biz>2015-04-01 01:54:21 -0500
commit76d6fe17d02b77301619065ad43d7300432e977c (patch)
tree32c91dcfc95d100694160b98dc627c3771301695 /FS/FS/TaxEngine/internal.pm
parent8c720e8a4aae1937cf837009c864aebc64faa5b4 (diff)
CCH tax exemptions + 4.x tax system, #34223
Diffstat (limited to 'FS/FS/TaxEngine/internal.pm')
-rw-r--r--FS/FS/TaxEngine/internal.pm16
1 files changed, 9 insertions, 7 deletions
diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm
index 60f7aad..3b13510 100644
--- a/FS/FS/TaxEngine/internal.pm
+++ b/FS/FS/TaxEngine/internal.pm
@@ -15,10 +15,11 @@ my %part_pkg_cache;
sub add_sale {
my ($self, $cust_bill_pkg) = @_;
- my $cust_pkg = $cust_bill_pkg->cust_pkg;
- my $pkgpart = $cust_bill_pkg->pkgpart_override || $cust_pkg->pkgpart;
- my $part_pkg = $part_pkg_cache{$pkgpart} ||= FS::part_pkg->by_key($pkgpart)
- or die "pkgpart $pkgpart not found";
+
+ my $part_item = $cust_bill_pkg->part_X;
+ my $location = $cust_bill_pkg->tax_location;
+ my $custnum = $self->{cust_main}->custnum;
+
push @{ $self->{items} }, $cust_bill_pkg;
my $location = $cust_pkg->tax_location; # cacheable?
@@ -46,9 +47,10 @@ sub add_sale {
$taxhash_elim{ shift(@elim) } = '';
} while ( !scalar(@taxes) && scalar(@elim) );
- foreach (@taxes) {
- my $taxnum = $_->taxnum;
- $self->{taxes}->{$taxnum} ||= [ $_ ];
+ foreach my $tax (@taxes) {
+ my $taxnum = $tax->taxnum;
+ $self->{taxes}->{$taxnum} ||= [ $tax ];
+ $cust_bill_pkg->set_exemptions( $tax, 'custnum' => $custnum );
push @{ $self->{taxes}->{$taxnum} }, $cust_bill_pkg;
}
}