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;
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 {
=cut
+#shit, all sorts of false laxiness w/report_newtax.cgi
sub generate_liability_report {
my %args = @_;
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;