fix line-item reports on taxclass-less regions
[freeside.git] / httemplate / search / cust_bill_pkg.cgi
index d9f2548..4ac9d9f 100644 (file)
@@ -122,6 +122,11 @@ if ( $cgi->param('out') ) {
   push @where, ' taxclass = '. dbh->quote( $cgi->param('taxclass') )
     if $cgi->param('taxclass');
 
+  if ( $cgi->param('taxclassNULL') ) {
+    my $same_sql = $r->sql_taxclass_sameregion;
+    push @where, $same_sql if $same_sql;
+  }
+
 }
 
 push @where, 'pkgnum != 0' if $cgi->param('nottax');
@@ -185,7 +190,7 @@ my $query = {
                    FS::UI::Web::cust_sql_fields(),
                  ),
   'extra_sql' => $where,
-  'order_by'  => 'ORDER BY _date',
+  'order_by'  => 'ORDER BY _date, billpkgnum',
 };
 
 my $ilink = [ "${p}view/cust_bill.cgi?", 'invnum' ];