'setuptax', 'char', 'NULL', 1, '', '', # Y = setup tax exempt
'recurtax', 'char', 'NULL', 1, '', '', # Y = recur tax exempt
'source', 'varchar', 'NULL', $char_d, '', '',
+ 'charge_prediscount', 'char', 'NULL', 1, '', '', # Y = charge this tax pre discount
],
'primary_key' => 'taxnum',
'unique' => [],
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 ) {
'setuptax' => 'This tax not applicable to setup fees',
'recurtax' => 'This tax not applicable to recurring fees',
'exempt_amount' => 'Monthly exemption per customer ($25 "Texas tax")',
+ 'charge_prediscount' => 'Charge this tax prior to any discounts',
},
'fields' => \@fields,
)
'taxname',
{ field=>'tax', type=>'percentage', },
+ { type=>'tablebreak-tr-title', value=>'Charging options' },
+ { field=>'charge_prediscount', type=>'checkbox', value=>'Y', },
+
{ type=>'tablebreak-tr-title', value=>'Exemptions' },
{ field=>'setuptax', type=>'checkbox', value=>'Y', },
{ field=>'recurtax', type=>'checkbox', value=>'Y', },