summaryrefslogtreecommitdiff
path: root/FS/FS/tax_rate.pm
diff options
context:
space:
mode:
authorjeff <jeff>2009-01-05 21:12:06 +0000
committerjeff <jeff>2009-01-05 21:12:06 +0000
commit0a78989c9f9e1d447c7e854a856820f5b9e05d06 (patch)
tree8bd88b530ca4d02630078b53a59016875c72c8e2 /FS/FS/tax_rate.pm
parent125fb1a284ae96b46fe433c418aafa87862c4382 (diff)
doh! change the interface here, too
Diffstat (limited to 'FS/FS/tax_rate.pm')
-rw-r--r--FS/FS/tax_rate.pm19
1 files changed, 16 insertions, 3 deletions
diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index ce460e192..4b906d33d 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -342,16 +342,28 @@ sub passtype_name {
$tax_passtypes{$self->passtype};
}
-=item taxline CUST_BILL_PKG|AMOUNT, ...
+=item taxline TAXABLES, [ OPTIONSHASH ]
Returns a listref of a name and an amount of tax calculated for the list
-of packages/amounts. If an error occurs, a message is returned as a scalar.
+of packages/amounts referenced by TAXABLES. If an error occurs, a message
+is returned as a scalar.
=cut
sub taxline {
my $self = shift;
+ my $taxables;
+ my %opt = ();
+
+ if (ref($_[0]) eq 'ARRAY') {
+ $taxables = shift;
+ %opt = @_;
+ }else{
+ $taxables = [ @_ ];
+ #exemptions would be broken in this case
+ }
+
my $name = $self->taxname;
$name = 'Other surcharges'
if ($self->passtype == 2);
@@ -361,7 +373,8 @@ sub taxline {
if $self->disabled;
my $taxable_charged = 0;
- my @cust_bill_pkg = grep { $taxable_charged += $_ unless ref; ref; } @_;
+ my @cust_bill_pkg = grep { $taxable_charged += $_ unless ref; ref; }
+ @$taxables;
warn "calculating taxes for ". $self->taxnum. " on ".
join (",", map { $_->pkgnum } @cust_bill_pkg)