X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg.cgi;h=94860d3f2d4137de69ebf1af5136438a14e93045;hb=ea3ce8d7f076e7fecff4be7ae63bc413adb0adf5;hp=007f59399bd05c27f50e97c6c9defe35c6aef197;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 007f59399..94860d3f2 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -73,6 +73,7 @@ \&FS::UI::Web::cust_fields, ], 'sort_fields' => [ + '', 'setup', #broken in $unearned case i guess ( $unearned ? ('', '') : () ), ( $use_usage eq 'recurring' ? 'recur - usage' : @@ -144,8 +145,16 @@ my $agentnums_sql = 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"; @@ -201,12 +210,9 @@ if ( $cgi->param('taxclass') # #} else { - push @where, - ' ( '. join(' OR ', - map ' part_pkg.taxclass = '.dbh->quote($_), - $cgi->param('taxclass') - ). - ' ) '; + push @where, ' part_pkg.taxclass IN ( '. + join(', ', map dbh->quote($_), $cgi->param('taxclass') ). + ' ) '; #} @@ -302,8 +308,11 @@ if ( $cgi->param('out') ) { #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($_); @@ -312,6 +321,7 @@ if ( $cgi->param('out') ) { die "unknown base region for empty taxclass" unless $cust_main_county; my $same_sql = $cust_main_county->sql_taxclass_sameregion; + $same_sql =~ s/taxclass/part_pkg.taxclass/g; push @where, $same_sql if $same_sql; }