fix recurring display w/discounts, RT#41844
authorIvan Kohler <ivan@freeside.biz>
Wed, 8 Feb 2017 19:48:26 +0000 (11:48 -0800)
committerIvan Kohler <ivan@freeside.biz>
Wed, 8 Feb 2017 19:48:26 +0000 (11:48 -0800)
FS/FS/cust_main/Packages.pm

index 4201cf8..fec9fd3 100644 (file)
@@ -593,6 +593,8 @@ this customer that are active (recurring).
 
 =cut
 
 
 =cut
 
+#recurring_pkgs?  different from cust_pkg idea of "active" which has
+# a setup vs not_yet_billed which doesn't
 sub active_pkgs {
   my $self = shift; 
   grep { my $part_pkg = $_->part_pkg;
 sub active_pkgs {
   my $self = shift; 
   grep { my $part_pkg = $_->part_pkg;
@@ -608,6 +610,8 @@ are active (recurring).
 
 =cut
 
 
 =cut
 
+#ncancelled_recurring_pkgs?  different from cust_pkg idea of "active" which has
+# a setup vs not_yet_billed which doesn't
 sub ncancelled_active_pkgs {
   my $self = shift; 
   grep { my $part_pkg = $_->part_pkg;
 sub ncancelled_active_pkgs {
   my $self = shift; 
   grep { my $part_pkg = $_->part_pkg;
@@ -807,7 +811,7 @@ sub display_recurring {
         my $discount = $cust_pkg_discount->discount;
         #and only one of these for each
         $pkg_amount -= $discount->amount;
         my $discount = $cust_pkg_discount->discount;
         #and only one of these for each
         $pkg_amount -= $discount->amount;
-        $pkg_amount -= $amount * $discount->percent/100;
+        $pkg_amount -= $pkg_amount * $discount->percent/100;
       }
 
       $pkg_amount *= ( $cust_pkg->quantity || 1 );
       }
 
       $pkg_amount *= ( $cust_pkg->quantity || 1 );