lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [6187] Implement preferred loans


From: Greg Chicares
Subject: [lmi-commits] [6187] Implement preferred loans
Date: Sun, 03 May 2015 16:39:34 +0000

Revision: 6187
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6187
Author:   chicares
Date:     2015-05-03 16:39:34 +0000 (Sun, 03 May 2015)
Log Message:
-----------
Implement preferred loans

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/ihs_avmly.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-05-03 16:29:14 UTC (rev 6186)
+++ lmi/trunk/ChangeLog 2015-05-03 16:39:34 UTC (rev 6187)
@@ -36194,3 +36194,24 @@
   interest_rates.cpp
 Remove warnings about preferred loans: they'll be supported soon.
 
+20150502T1557Z <address@hidden> [513]
+
+  basic_values.hpp
+  dbdict.cpp
+  dbdict.hpp
+  dbnames.hpp
+  dbnames.xpp
+  ihs_basicval.cpp
+Establish new database entities for preferred loans.
+
+20150503T1629Z <address@hidden> [513]
+
+  interest_rates.cpp
+  interest_rates.hpp
+Set preferred loan rates reflecting the 20150502T1557Z change.
+
+20150503T1639Z <address@hidden> [512]
+
+  ihs_avmly.cpp
+Implement preferred loans.
+

Modified: lmi/trunk/ihs_avmly.cpp
===================================================================
--- lmi/trunk/ihs_avmly.cpp     2015-05-03 16:29:14 UTC (rev 6186)
+++ lmi/trunk/ihs_avmly.cpp     2015-05-03 16:39:34 UTC (rev 6187)
@@ -1530,14 +1530,11 @@
 
     // TODO ?? This idiom seems too cute. And it can return -0.0 .
     // Maximum repayment is total debt.
-    ActualLoan = -std::min(-RequestedLoan, RegLnBal);
+    ActualLoan = -std::min(-RequestedLoan, RegLnBal + PrfLnBal);
 
     process_distribution(ActualLoan);
-    AVRegLn  += ActualLoan;
-    RegLnBal += ActualLoan;
-// TODO ?? First repay regular loan, then apply excess to preferred.
-//  AVPrfLn  += ActualLoan;
-//  PrfLnBal += ActualLoan;
+    LMI_ASSERT(0.0 == progressively_reduce(AVRegLn , AVPrfLn , -ActualLoan));
+    LMI_ASSERT(0.0 == progressively_reduce(RegLnBal, PrfLnBal, -ActualLoan));
 
 // This seems wrong. If we're changing something that's invariant among
 // bases, why do we change it for each basis?
@@ -2777,9 +2774,16 @@
     // Transfer new cash loan from the appropriate unloaned account(s).
     process_distribution(ActualLoan);
 
-    // SOMEDAY !! Also handle preferred loan.
-    AVRegLn += ActualLoan;
-    RegLnBal += ActualLoan;
+    if(!AllowPrefLoan || Year < FirstPrefLoanYear)
+        {
+        AVRegLn  += ActualLoan;
+        RegLnBal += ActualLoan;
+        }
+    else
+        {
+        AVPrfLn  += ActualLoan;
+        PrfLnBal += ActualLoan;
+        }
 }
 
 //============================================================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]