lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5056] Use input state of jurisdiction and premium-tax sta


From: Greg Chicares
Subject: [lmi-commits] [5056] Use input state of jurisdiction and premium-tax state appropriately
Date: Sat, 24 Jul 2010 03:40:20 +0000

Revision: 5056
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5056
Author:   chicares
Date:     2010-07-24 03:40:19 +0000 (Sat, 24 Jul 2010)
Log Message:
-----------
Use input state of jurisdiction and premium-tax state appropriately

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/account_value.hpp
    lmi/trunk/basicvalues.cpp
    lmi/trunk/custom_io_0.cpp
    lmi/trunk/ihs_acctval.cpp
    lmi/trunk/ihs_avmly.cpp
    lmi/trunk/ihs_basicval.cpp
    lmi/trunk/input_xml_io.cpp
    lmi/trunk/mec_server.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/ChangeLog 2010-07-24 03:40:19 UTC (rev 5056)
@@ -26476,3 +26476,23 @@
 Move old state determination out of class product_database, inducing a
 regression in system testing that must be analyzed.
 
+20100723T2339Z <address@hidden> [685]
+
+  database.cpp
+  database.hpp
+  ihs_basicval.cpp
+  input_test.cpp
+Refactor, simplifying class product_database.
+
+20100724T0340Z <address@hidden> [685]
+
+  account_value.hpp
+  basicvalues.cpp
+  custom_io_0.cpp
+  ihs_acctval.cpp
+  ihs_avmly.cpp
+  ihs_basicval.cpp
+  input_xml_io.cpp
+  mec_server.cpp
+Use input state of jurisdiction and premium-tax state appropriately.
+

Modified: lmi/trunk/account_value.hpp
===================================================================
--- lmi/trunk/account_value.hpp 2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/account_value.hpp 2010-07-24 03:40:19 UTC (rev 5056)
@@ -587,7 +587,7 @@
     double  YearsTotalPolicyFee;
     double  YearsTotalPremTaxLoad;
     double  YearsTotalPremTaxLoadInStateOfDomicile;
-    double  YearsTotalPremTaxLoadInStateOfJurisdiction;
+    double  YearsTotalPremTaxLoadInPremiumTaxState;
     double  YearsTotalDacTaxLoad;
     double  YearsTotalSpecAmtLoad;
     double  YearsTotalSepAcctLoad;

Modified: lmi/trunk/basicvalues.cpp
===================================================================
--- lmi/trunk/basicvalues.cpp   2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/basicvalues.cpp   2010-07-24 03:40:19 UTC (rev 5056)
@@ -97,6 +97,8 @@
     RetAge   = yare_input_.RetirementAge;
     LMI_ASSERT(IssueAge <= RetAge);
 
+    StateOfJurisdiction_ = yare_input_.StateOfJurisdiction;
+    PremiumTaxState_     = yare_input_.PremiumTaxState    ;
     Database_.reset
         (new product_database
             ("empty for now" // filename
@@ -105,7 +107,7 @@
             ,yare_input_.Smoking
             ,yare_input_.IssueAge
             ,yare_input_.GroupUnderwritingType
-            ,yare_input_.State
+            ,yare_input_.StateOfJurisdiction
             )
         );
 
@@ -132,7 +134,12 @@
     Outlay_        .reset(new modal_outlay   (yare_input_));
     Loads_         .reset(new Loads(*Database_, IsSubjectToIllustrationReg()));
 
-    PremiumTaxRate_ = Database_->Query(DB_PremTaxRate);
+    {
+    yare_input yi_premtax(*Input_);
+    yi_premtax.StateOfJurisdiction = GetPremiumTaxState();
+    product_database db_premtax(yi_premtax);
+    PremiumTaxRate_ = db_premtax.Query(DB_PremTaxRate);
+    }
 
     MinSpecAmt = Database_->Query(DB_MinSpecAmt);
     MinWD      = Database_->Query(DB_MinWd     );

Modified: lmi/trunk/custom_io_0.cpp
===================================================================
--- lmi/trunk/custom_io_0.cpp   2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/custom_io_0.cpp   2010-07-24 03:40:19 UTC (rev 5056)
@@ -284,21 +284,8 @@
             ;
         }
 
-    z["State"]                     = n_v_pairs.string_value("ApplicantState");
-    z["CorporationState"]          = z["State"];
-    // TRICKY !! This is probably unnecessary, but if so, it's because
-    // of some kludge that works around the problem. 'State' and
-    // 'CorporationState' should not exist; only 'StateOfJurisdiction'
-    // should. Therefore, when that felicitous state of affairs is
-    // brought about, the following line (which is perhaps redundant
-    // today) will do the right thing, and the preceding two lines
-    // can be deleted. The customer's name 'ApplicantState' would seem
-    // to correspond to correspond better to lmi's 'State', but
-    // that's a red herring: the customer gives only two states, one
-    // for "Applicant" and one for "Agent", but none for "Corporation"
-    // that would correspond to 'CorporationState', and our intention
-    // is to make lmi correspond to that paradigm anyway, someday.
-    z["StateOfJurisdiction"]       = z["State"];
+    z["StateOfJurisdiction"]       = n_v_pairs.string_value("ApplicantState");
+    z["PremiumTaxState"]           = n_v_pairs.string_value("ApplicantState");
 
 // Not yet used, but might be wanted someday:
 // PaymentsPerYear=1

Modified: lmi/trunk/ihs_acctval.cpp
===================================================================
--- lmi/trunk/ihs_acctval.cpp   2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/ihs_acctval.cpp   2010-07-24 03:40:19 UTC (rev 5056)
@@ -931,7 +931,7 @@
     YearsTotalPolicyFee         = 0.0;
     YearsTotalPremTaxLoad       = 0.0;
     YearsTotalPremTaxLoadInStateOfDomicile = 0.0;
-    YearsTotalPremTaxLoadInStateOfJurisdiction = 0.0;
+    YearsTotalPremTaxLoadInPremiumTaxState = 0.0;
     YearsTotalDacTaxLoad        = 0.0;
     YearsTotalSpecAmtLoad       = 0.0;
     YearsTotalSepAcctLoad       = 0.0;

Modified: lmi/trunk/ihs_avmly.cpp
===================================================================
--- lmi/trunk/ihs_avmly.cpp     2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/ihs_avmly.cpp     2010-07-24 03:40:19 UTC (rev 5056)
@@ -1497,17 +1497,17 @@
 
 double AccountValue::GetPremTaxLoad(double payment)
 {
-    double tax_in_state_of_jurisdiction = YearsPremTaxLoadRate * payment;
+    double tax_in_premium_tax_state = YearsPremTaxLoadRate * payment;
     if(PremiumTaxLoadIsTieredInPremiumTaxState_)
         {
-        LMI_ASSERT(0.0 == tax_in_state_of_jurisdiction);
-        tax_in_state_of_jurisdiction = StratifiedCharges_->tiered_premium_tax
-            (GetStateOfJurisdiction()
+        LMI_ASSERT(0.0 == tax_in_premium_tax_state);
+        tax_in_premium_tax_state = StratifiedCharges_->tiered_premium_tax
+            (GetPremiumTaxState()
             ,payment
             ,PolicyYearRunningTotalPremiumSubjectToPremiumTax
             );
         }
-    YearsTotalPremTaxLoadInStateOfJurisdiction += tax_in_state_of_jurisdiction;
+    YearsTotalPremTaxLoadInPremiumTaxState += tax_in_premium_tax_state;
 
     double tax_in_state_of_domicile = 0.0;
     if(!FirstYearPremiumExceedsRetaliationLimit)
@@ -1544,18 +1544,17 @@
         )
         {
         double ytd_premium_tax_reflecting_retaliation = std::max
-            (YearsTotalPremTaxLoadInStateOfJurisdiction
+            (YearsTotalPremTaxLoadInPremiumTaxState
             ,YearsTotalPremTaxLoadInStateOfDomicile
             );
         return std::max
             (0.0
-            , ytd_premium_tax_reflecting_retaliation
-            - YearsTotalPremTaxLoad
+            ,ytd_premium_tax_reflecting_retaliation - YearsTotalPremTaxLoad
             );
         }
     else
         {
-        return std::max(tax_in_state_of_jurisdiction, 
tax_in_state_of_domicile);
+        return std::max(tax_in_premium_tax_state, tax_in_state_of_domicile);
         }
 }
 

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/ihs_basicval.cpp  2010-07-24 03:40:19 UTC (rev 5056)
@@ -106,9 +106,9 @@
     ,Equiv7702DBO3       (a_DBOptFor7702)
     ,MaxWDDed_           (mce_twelve_times_last)
     ,MaxLoanDed_         (mce_twelve_times_last)
-    ,StateOfJurisdiction_(mce_s_CT)
-    ,StateOfDomicile_    (mce_s_CT)
-    ,PremiumTaxState_    (mce_s_CT)
+    ,StateOfJurisdiction_(a_StateOfJurisdiction)
+    ,StateOfDomicile_    (a_StateOfJurisdiction)
+    ,PremiumTaxState_    (a_StateOfJurisdiction)
     ,InitialTargetPremium(a_TargetPremium)
 {
     Input* kludge_input = new Input;
@@ -176,6 +176,7 @@
     Database_.reset(new product_database(yare_input_));
 
     StateOfJurisdiction_ = yare_input_.StateOfJurisdiction;
+    PremiumTaxState_     = yare_input_.PremiumTaxState    ;
 
     if
         (   !Database_->Query(DB_StateApproved)
@@ -187,7 +188,7 @@
             << "Product "
             << yare_input_.ProductName
             << " not approved in state "
-            << mc_str(StateOfJurisdiction_)
+            << mc_str(GetStateOfJurisdiction())
             << "."
             << LMI_FLUSH
             ;
@@ -276,6 +277,7 @@
     HOPEFULLY(yare_input_.RetireesCanEnroll || IssueAge <= RetAge);
 
     StateOfJurisdiction_ = yare_input_.StateOfJurisdiction;
+    PremiumTaxState_     = yare_input_.PremiumTaxState    ;
 
     // The database class constrains maturity age to be scalar.
     EndtAge = static_cast<int>(Database_->Query(DB_MaturityAge));
@@ -820,8 +822,6 @@
 
 /// Set all parameters that depend on premium-tax state.
 ///
-/// (For the nonce, state of jurisdiction is used instead.)
-///
 /// These database entities should be looked up by tax state:
 ///  - DB_PremTaxLoad
 ///  - DB_PremTaxRate
@@ -841,39 +841,40 @@
 void BasicValues::SetPremiumTaxParameters()
 {
     PremiumTaxLoadIsTieredInStateOfDomicile_ = 
StratifiedCharges_->premium_tax_is_tiered(GetStateOfDomicile());
-    PremiumTaxLoadIsTieredInPremiumTaxState_ = 
StratifiedCharges_->premium_tax_is_tiered(GetStateOfJurisdiction());
+    PremiumTaxLoadIsTieredInPremiumTaxState_ = 
StratifiedCharges_->premium_tax_is_tiered(GetPremiumTaxState());
 
-    LMI_ASSERT(Database_         .get());
-    LMI_ASSERT(StratifiedCharges_.get());
+    yare_input yi_premtax(*Input_);
+    yi_premtax.StateOfJurisdiction = GetPremiumTaxState();
+    product_database db_premtax(yi_premtax);
+
     LowestPremiumTaxLoad_ = lowest_premium_tax_load
-        (*Database_
+        (db_premtax
         ,*StratifiedCharges_
-        ,StateOfJurisdiction_
+        ,GetPremiumTaxState()
         ,yare_input_.AmortizePremiumLoad
         );
 
     // TODO ?? It would be better not to constrain so many things
     // not to vary by duration by using Query(enumerator).
 
-    PremiumTaxRate_ = Database_->Query(DB_PremTaxRate);
-    PremiumTaxLoad_ = Database_->Query(DB_PremTaxLoad);
+    PremiumTaxRate_ = db_premtax.Query(DB_PremTaxRate);
+    PremiumTaxLoad_ = db_premtax.Query(DB_PremTaxLoad);
 
     StateOfDomicile_ = 
mc_state_from_string(ProductData_->datum("InsCoDomicile"));
     {
-    yare_input YI(*Input_);
-    YI.State            = GetStateOfDomicile();
-    YI.CorporationState = GetStateOfDomicile();
-    product_database TempDatabase(YI);
+    yare_input yi_domicile(*Input_);
+    yi_domicile.StateOfJurisdiction = GetStateOfDomicile();
+    product_database db_domicile(yi_domicile);
     DomiciliaryPremiumTaxLoad_ = 0.0;
     if(!yare_input_.AmortizePremiumLoad)
         {
-        DomiciliaryPremiumTaxLoad_ = TempDatabase.Query(DB_PremTaxLoad);
+        DomiciliaryPremiumTaxLoad_ = db_domicile.Query(DB_PremTaxLoad);
         }
     }
 
     TestPremiumTaxLoadConsistency();
 
-    FirstYearPremiumRetaliationLimit_ = Database_->Query(DB_PremTaxRetalLimit);
+    FirstYearPremiumRetaliationLimit_ = db_premtax.Query(DB_PremTaxRetalLimit);
 }
 
 /// Lowest premium-tax load, for 7702 and 7702A purposes.
@@ -971,13 +972,13 @@
 {
     if(PremiumTaxLoadIsTieredInPremiumTaxState_)
         {
-        if(0.0 != Database_->Query(DB_PremTaxLoad))
+        if(0.0 != PremiumTaxLoad())
             {
             fatal_error()
-                << "Premium-tax load is tiered in state of jurisdiction "
-                << mc_str(GetStateOfJurisdiction())
+                << "Premium-tax load is tiered in premium-tax state "
+                << mc_str(GetPremiumTaxState())
                 << ", but the product database specifies a scalar load of "
-                << Database_->Query(DB_PremTaxLoad)
+                << PremiumTaxLoad()
                 << " instead of zero as expected. Probably the database"
                 << " is incorrect."
                 << LMI_FLUSH

Modified: lmi/trunk/input_xml_io.cpp
===================================================================
--- lmi/trunk/input_xml_io.cpp  2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/input_xml_io.cpp  2010-07-24 03:40:19 UTC (rev 5056)
@@ -390,6 +390,9 @@
     // grew to 502?), and starting with version 6 both states are
     // input fields.
     //
+    // 'StateOfJurisdiction' has always been in lmi, but was never
+    // meaningfully used prior to version 6.
+    //
     // 'FilingApprovalState' and 'PremiumTaxState' were unknown before
     // version 6, and would not ordinarily occur in older versions.
     // However, certain admin-system extracts that are always marked

Modified: lmi/trunk/mec_server.cpp
===================================================================
--- lmi/trunk/mec_server.cpp    2010-07-23 23:39:30 UTC (rev 5055)
+++ lmi/trunk/mec_server.cpp    2010-07-24 03:40:19 UTC (rev 5056)
@@ -100,6 +100,7 @@
     int                         InforceContractMonth         = 
exact_cast<tnr_month               >(input["InforceContractMonth"        
])->value();
     double                      InforceLeastDeathBenefit     = 
exact_cast<tnr_nonnegative_double  >(input["InforceLeastDeathBenefit"    
])->value();
     mcenum_state                StateOfJurisdiction          = 
exact_cast<mce_state               >(input["StateOfJurisdiction"         
])->value();
+    mcenum_state                PremiumTaxState              = 
exact_cast<mce_state               >(input["PremiumTaxState"             
])->value();
 //  std::string                 FlatExtra                    = 
exact_cast<datum_sequence          >(input["FlatExtra"                   
])->value();
 //  std::string                 PaymentHistory               = 
exact_cast<datum_sequence          >(input["PaymentHistory"              
])->value();
 //  std::string                 BenefitHistory               = 
exact_cast<datum_sequence          >(input["BenefitHistory"              
])->value();
@@ -301,10 +302,19 @@
             ;
         }
 
+    product_database db_premtax
+        (ProductName
+        ,Gender
+        ,UnderwritingClass
+        ,Smoking
+        ,input.issue_age()
+        ,GroupUnderwritingType
+        ,PremiumTaxState
+        );
     double const premium_tax_load = lowest_premium_tax_load
-        (database
+        (db_premtax
         ,stratified
-        ,StateOfJurisdiction
+        ,PremiumTaxState
         ,false
         );
 




reply via email to

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