lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 9b66151 2/3: Implement 'AllowGroupQuote' data


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9b66151 2/3: Implement 'AllowGroupQuote' database entity
Date: Thu, 1 Aug 2019 20:37:21 -0400 (EDT)

branch: master
commit 9b6615126f4c234d06f58f75c428ab1f6caccbc7
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Implement 'AllowGroupQuote' database entity
---
 dbdict.cpp                 |  1 +
 group_quote_pdf_gen_wx.cpp | 10 ++++++++++
 ledger_evaluator.cpp       |  1 +
 ledger_invariant.cpp       |  3 +++
 ledger_invariant.hpp       |  1 +
 ledger_invariant_init.cpp  |  1 +
 6 files changed, 17 insertions(+)

diff --git a/dbdict.cpp b/dbdict.cpp
index 22ed65b..b4128ca 100644
--- a/dbdict.cpp
+++ b/dbdict.cpp
@@ -922,6 +922,7 @@ sample::sample()
     alt_form[mce_s_KS] = true;
     alt_form[mce_s_KY] = true;
     Add({DB_UsePolicyFormAlt, premium_tax_dimensions, alt_form});
+    Add({DB_AllowGroupQuote     , true});
 }
 
 sample2finra::sample2finra()
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index a9829d9..ac896b4 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -468,6 +468,16 @@ void group_quote_pdf_generator_wx::add_ledger(Ledger 
const& ledger)
 
     LedgerInvariant const& invar = ledger.GetLedgerInvariant();
 
+    // 'AllowGroupQuote' isn't an input field, so it cannot be
+    // checked by assert_okay_to_run_group_quote().
+    if(!static_cast<bool>(invar.AllowGroupQuote))
+        {
+        alarum()
+            << "Group quotes not allowed on this plan."
+            << LMI_FLUSH
+            ;
+        }
+
     // 'GroupIndivSelection' isn't an input field, so it cannot be
     // checked by assert_okay_to_run_group_quote(). It must be tested
     // (here) because some legacy products unfortunately combined
diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
index 5564c4f..a3bf44f 100644
--- a/ledger_evaluator.cpp
+++ b/ledger_evaluator.cpp
@@ -533,6 +533,7 @@ format_map_t static_formats()
     ,{"AllowExperienceRating"           , f1}
     ,{"UseExperienceRating"             , f1}
     ,{"GroupIndivSelection"             , f1}
+    ,{"AllowGroupQuote"                 , f1}
     ,{"TxCallsGuarUwSubstd"             , f1}
     ,{"UsePartialMort"                  , f1}
     ,{"WriteTsvFile"                    , f1}
diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 9a7dbe5..642fd59 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -142,6 +142,7 @@ void LedgerInvariant::Alloc(int len)
     OtherScalars    ["RetAge"                ] = &RetAge                 ;
     OtherScalars    ["EndtAge"               ] = &EndtAge                ;
     OtherScalars    ["GroupIndivSelection"   ] = &GroupIndivSelection    ;
+    OtherScalars    ["AllowGroupQuote"       ] = &AllowGroupQuote        ;
     OtherScalars    ["TxCallsGuarUwSubstd"   ] = &TxCallsGuarUwSubstd    ;
     OtherScalars    ["AllowExperienceRating" ] = &AllowExperienceRating  ;
     OtherScalars    ["UseExperienceRating"   ] = &UseExperienceRating    ;
@@ -447,6 +448,7 @@ void LedgerInvariant::Init()
 
     WriteTsvFile        = false;
     SupplementalReport  = false;
+    AllowGroupQuote     = true;
 
     irr_precision_      = 0;
     irr_initialized_    = false;
@@ -676,6 +678,7 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
     StateOfJurisdiction           = a_Addend.StateOfJurisdiction;
     PremiumTaxState               = a_Addend.PremiumTaxState;
     GroupIndivSelection           = GroupIndivSelection   || 
a_Addend.GroupIndivSelection;
+    AllowGroupQuote               = AllowGroupQuote       && 
a_Addend.AllowGroupQuote;
     TxCallsGuarUwSubstd           = TxCallsGuarUwSubstd   || 
a_Addend.TxCallsGuarUwSubstd;
     AllowExperienceRating         = AllowExperienceRating || 
a_Addend.AllowExperienceRating;
     UseExperienceRating           = UseExperienceRating   || 
a_Addend.UseExperienceRating;
diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
index bd9ea6e..8888e4c 100644
--- a/ledger_invariant.hpp
+++ b/ledger_invariant.hpp
@@ -166,6 +166,7 @@ class LMI_SO LedgerInvariant final
     double          RetAge;
     double          EndtAge;
     double          GroupIndivSelection;
+    double          AllowGroupQuote;
     double          TxCallsGuarUwSubstd;
     double          AllowExperienceRating;
     double          UseExperienceRating;
diff --git a/ledger_invariant_init.cpp b/ledger_invariant_init.cpp
index ec31a88..f74486f 100644
--- a/ledger_invariant_init.cpp
+++ b/ledger_invariant_init.cpp
@@ -257,6 +257,7 @@ void LedgerInvariant::Init(BasicValues const* b)
     RetAge                  = b->yare_input_.RetirementAge;
     EndtAge                 = b->yare_input_.IssueAge + b->GetLength();
     b->database().query_into(DB_GroupIndivSelection, GroupIndivSelection);
+    AllowGroupQuote         = b->database().query<bool>(DB_AllowGroupQuote);
     b->database().query_into(DB_TxCallsGuarUwSubstd, TxCallsGuarUwSubstd);
     AllowExperienceRating   = b->database().query<bool>(DB_AllowExpRating);
     UseExperienceRating     = b->yare_input_.UseExperienceRating;



reply via email to

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