add svc_external
[freeside.git] / httemplate / search / report_receivables.cgi
index 108453d..66928eb 100755 (executable)
@@ -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
@@ -123,7 +123,7 @@ END
      if ( $row->{uncancelled_pkgs} ) {
        $status = 'Suspended';
        $statuscol = 'FF9900';
-       if ( $row->{active_pkgs} > $row->{uncancelled_pkgs} ) {
+       if ( $row->{active_pkgs} ) {
          $status = 'Active';
          $statuscol = '00CC00';
        }