summaryrefslogtreecommitdiff
path: root/FS/FS/TaxEngine
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2018-12-28 15:52:02 -0500
committerChristopher Burger <burgerc@freeside.biz>2019-01-02 11:47:57 -0500
commit060e8d28ba3004b95e39c074285c8d26b70a4432 (patch)
tree61bafc18a5da35a25563e52f9e3418a6ab53bb01 /FS/FS/TaxEngine
parent69f34bdfd86b949402a7e7520872cbb8f956af57 (diff)
RT# 32917 - Added ability for taxes to be charged prior to applying the discount
Diffstat (limited to 'FS/FS/TaxEngine')
-rw-r--r--FS/FS/TaxEngine/internal.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm
index 5f5d229..6fb1ca7 100644
--- a/FS/FS/TaxEngine/internal.pm
+++ b/FS/FS/TaxEngine/internal.pm
@@ -105,6 +105,15 @@ sub taxline {
my $taxable_charged = $cust_bill_pkg->setup + $cust_bill_pkg->recur
or next; # don't create zero-amount exemptions
+ ## re-add the discounted amount if the tax needs to be charged pre discount
+ if ($tax_object->charge_prediscount) {
+ my $discount_amount = 0;
+ foreach my $discount (@{$cust_bill_pkg->discounts}) {
+ $discount_amount += $discount->amount;
+ }
+ $taxable_charged += $discount_amount;
+ }
+
# XXX the following procedure should probably be in cust_bill_pkg
if ( $exempt_cust ) {