my @where = ( $agentnums_sql );
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
-push @where, "_date >= $beginning",
- "_date <= $ending";
+
+if ( $cgi->param('distribute') == 1 ) {
+ push @where, "sdate <= $ending",
+ "edate > $beginning",
+ ;
+}
+else {
+ push @where, "_date >= $beginning",
+ "_date <= $ending";
+}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
push @where, "cust_main.agentnum = $1";
}
-my @loc_param = qw( city county state country );
+my @loc_param = qw( district city county state country );
if ( $cgi->param('out') ) {
my %ph = ( 'county' => dbh->quote($_),
map { $_ => dbh->quote( $cgi->param($_) ) }
- qw( city state country )
+ qw( district city state country )
);
my ( $loc_sql, @param ) = FS::cust_pkg->location_sql;
#warn "neither nottax nor istax parameters specified";
}
- if ( $cgi->param('taxclassNULL') ) {
-
+ if ( $cgi->param('taxclassNULL')
+ && ! $cgi->param('istax') #no part_pkg.taxclass in this case
+ #(see comment above?)
+ )
+ {
my %hash = ( 'country' => scalar($cgi->param('country')) );
foreach (qw( state county )) {
$hash{$_} = scalar($cgi->param($_)) if $cgi->param($_);
push @where, FS::tax_rate_location->location_sql(
map { $_ => (scalar($cgi->param($_)) || '') }
- qw( city county state locationtaxid )
+ qw( district city county state locationtaxid )
);
} elsif ( $cgi->param('unearned_now') =~ /^(\d+)$/ ) {