X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_rate.pm;h=334c31e953e7549df45f42d86ea2125ef25aaecb;hb=b49c1bd5510a5f10b05bffacc6cc8b6a1b2153e8;hp=ef4333ba98f3fdb9e0fafcca17fa9f5b32cfd074;hpb=9ecfa8b0f9e53e0da37bfcd78a8b22133312613b;p=freeside.git diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm index ef4333ba9..334c31e95 100644 --- a/FS/FS/tax_rate.pm +++ b/FS/FS/tax_rate.pm @@ -18,6 +18,7 @@ use DBIx::DBSchema; use DBIx::DBSchema::Table; use DBIx::DBSchema::Column; use FS::Record qw( qsearch qsearchs dbh dbdef ); +use FS::Conf; use FS::tax_class; use FS::cust_bill_pkg; use FS::cust_tax_location; @@ -455,12 +456,17 @@ sub taxline { return $self->_fatal_or_null( 'fee with minute unit type' ); } elsif ($self->unittype == 2) { #account - #$taxable_units = 1; - #number of distinct locations - my %seen = (); - foreach (@cust_bill_pkg) { - $taxable_units++ - unless $seen{$_->cust_pkg->locationnum}++; + + my $conf = new FS::Conf; + if ( $conf->exists('tax-pkg_address') ) { + #number of distinct locations + my %seen = (); + foreach (@cust_bill_pkg) { + $taxable_units++ + unless $seen{$_->cust_pkg->locationnum}++; + } + } else { + $taxable_units = 1; } } else { @@ -1800,6 +1806,7 @@ agentnum, beginning, and ending =cut +#shit, all sorts of false laxiness w/report_newtax.cgi sub generate_liability_report { my %args = @_; @@ -1891,8 +1898,7 @@ sub generate_liability_report { my $taxwhere = "FROM cust_bill_pkg $addl_from $where AND payby != 'COMP' ". "AND ". join( ' AND ', map { "( $_ = ? OR ? = '' AND $_ IS NULL)" } @taxparam ); - my $sql = "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) ". - " $taxwhere AND cust_bill_pkg.pkgnum = 0"; + my $sql = "SELECT SUM(amount) $taxwhere AND cust_bill_pkg.pkgnum = 0"; my $x = &{$scalar_sql}($t, [ map { $_, $_ } @params ], $sql ); $tax += $x;