X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Freport_receivables.cgi;h=0e95ad73c079505a45ae650192b5beecfcbedd58;hp=108453d4373da8dfb0ba90be3cd1b07c1558f9f5;hb=bfb3a80bc91a835513e437b242de366f190e9021;hpb=8ded47043e6d1f002a57c392fa95f481e697ab45 diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi index 108453d43..0e95ad73c 100755 --- a/httemplate/search/report_receivables.cgi +++ b/httemplate/search/report_receivables.cgi @@ -70,14 +70,14 @@ END ( select count(*) from cust_pkg where cust_main.custnum = cust_pkg.custnum and $recurring - and cancel = 0 or cancel is null + and ( cancel = 0 or cancel is null ) ) as uncancelled_pkgs, ( select count(*) from cust_pkg where cust_main.custnum = cust_pkg.custnum and $recurring - and cancel = 0 or cancel is null - and susp = 0 or susp is null + and ( cancel = 0 or cancel is null ) + and ( susp = 0 or susp is null ) ) as active_pkgs END @@ -93,7 +93,7 @@ where 0 < ,0 ) -order by lower(company), lower(last) +order by coalesce(lower(company), ''), lower(last) END @@ -123,14 +123,14 @@ END if ( $row->{uncancelled_pkgs} ) { $status = 'Suspended'; $statuscol = 'FF9900'; - if ( $row->{active_pkgs} > $row->{uncancelled_pkgs} ) { + if ( $row->{active_pkgs} ) { $status = 'Active'; $statuscol = '00CC00'; } } %> - + <%= $row->{'custnum'} %>: <%= $row->{'company'} ? $row->{'company'}. ' (' : '' %><%= $row->{'last'}. ', '. $row->{'first'} %><%= $row->{'company'} ? ')' : '' %> <%= $status %>