lmi
[Top][All Lists]
Advanced

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

Re: [lmi] Number of "eligibles" [Was: Group premium quotes]


From: Vadim Zeitlin
Subject: Re: [lmi] Number of "eligibles" [Was: Group premium quotes]
Date: Thu, 27 Aug 2015 19:07:14 +0200

On Wed, 26 Aug 2015 20:16:28 +0000 Greg Chicares <address@hidden> wrote:

GC> I sketched it out that way, too, something like this IIRC:
GC> 
GC>  group_quote_pdf_generator_wx::group_quote_pdf_generator_wx()
GC> -    :row_num_(0)
GC> +    :row_num_(1) // Use counting numbers for rows.
GC> ...
GC> -                rd.values[col] = wxString::Format("%d", 
++row_num_).ToStdString();
GC> +                rd.values[col] = wxString::Format("%d", 
row_num_).ToStdString();
GC> ...
GC>      if(!is_composite)
GC>          {
GC>          rows_.push_back(rd);
GC> +        ++row_num_;
GC>          }
GC> 
GC> If you prefer that, I'll commit it; or, if you see a better way, send a
GC> patch and I'll commit it.

 I indeed prefer this, although my ideal version would be
---------------------------------- >8 --------------------------------------
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index 180315c..d69a3c5 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -350,7 +350,8 @@ void group_quote_pdf_generator_wx::add_ledger(Ledger const& 
ledger)
             {
             case e_col_number:
                 {
-                rd.values[col] = wxString::Format("%d", 
++row_num_).ToStdString();
+                // Row numbers shown to human beings should be 1-based.
+                rd.values[col] = wxString::Format("%d", row_num_ + 
1).ToStdString();
                 }
                 break;
             case e_col_name:
@@ -438,10 +439,11 @@ void group_quote_pdf_generator_wx::add_ledger(Ledger 
const& ledger)
         }

     // The last, composite, ledger is only used for the totals, it shouldn't be
-    // shown in the main table.
+    // shown in the main table nor counted as a row.
     if(!is_composite)
         {
         rows_.push_back(rd);
+        row_num_++;
         }
 }

@@ -777,7 +779,7 @@ void group_quote_pdf_generator_wx::do_generate_pdf(wxPdfDC& 
pdf_dc)
         ,header_.product_
         ,header_.contract_state_
         ,header_.available_riders_
-        ,row_num_ - 1 // "- 1": don't count the composite.
+        ,row_num_
         );

     int const summary_height = output_html
---------------------------------- >8 --------------------------------------

because initially the number of rows is really 0, not 1.

 This is not very important in any way, of course.
VZ

reply via email to

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