[freeside-commits] branch master updated. 8807939a466d20893efc5655e61ac38f891d6d05

Mitch Jackson mitch at freeside.biz
Thu Sep 20 11:02:44 PDT 2018


The branch, master has been updated
       via  8807939a466d20893efc5655e61ac38f891d6d05 (commit)
       via  dcf1ad84924e58127a42e0c905e940eb4e076ac7 (commit)
      from  9ea31f98372bc897fd0b4d7e63284eecabf27aa2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 8807939a466d20893efc5655e61ac38f891d6d05
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Thu Sep 20 14:02:03 2018 -0400

    RT# 78547 Future autobill report - report totals

diff --git a/httemplate/search/future_autobill.html b/httemplate/search/future_autobill.html
index 3385dd880..8f59d71db 100644
--- a/httemplate/search/future_autobill.html
+++ b/httemplate/search/future_autobill.html
@@ -35,6 +35,34 @@ there will be 1,400 billing and payment cycles simulated
   suppress_header => $job ? 1 : 0,
   suppress_footer => $job ? 1 : 0,
 &>
+% if ( %pmt_type_subtotal ) {
+    <table class="gridreport" style="margin-left: 2em;">
+      <tr>
+        <th class="gridreport" colspan="2">
+          Summary
+        </th>
+      </tr>
+%   for my $pmt_type ( sort keys %pmt_type_subtotal ) {
+      <tr class="gridreport">
+        <td class="gridreport" style="text-align: right; margin-right: 1em;">
+          <% sprintf '$%.2f', $pmt_type_subtotal{ $pmt_type } %>
+        </td>
+        <td class="gridreport">
+          <% $pmt_type |h %>
+        </td>
+      </tr>
+%   }
+%   $pmt_type_subtotal{Total} += $_ for values %pmt_type_subtotal;
+    <tr class="gridreport" style="border-top: solid 1px #999;">
+      <td class="gridreport" style="text-align: right; margin-right: 1em; border-top: solid 1px #666;">
+        <% sprintf( '$%.2f', $pmt_type_subtotal{Total} ) %>
+      </td>
+      <td class="gridreport" style="border-top: solid 1px #666;">
+        Total
+      </td>
+    </tr>
+    </table>
+% }
 
 <%init>
   use DateTime;
@@ -134,6 +162,7 @@ there will be 1,400 billing and payment cycles simulated
   my $fakebill_time = time();
   my %abreport;
   my @rows;
+  my %pmt_type_subtotal;
 
   local $@;
   local $SIG{__DIE__};
@@ -239,6 +268,9 @@ there will be 1,400 billing and payment cycles simulated
           ]
         };
 
+        $pmt_type_subtotal{ $cust_pay->paycardtype || $cust_pay-> payby }
+          += $cust_pay->paid;
+
       } # /foreach payment
 
       # Roll back database at the end of each customer

commit dcf1ad84924e58127a42e0c905e940eb4e076ac7
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Wed Sep 19 02:31:52 2018 -0400

    RT# 78547 Future autobill report - sql bugfix

diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm
index 9d8be120a..4e9f04f51 100644
--- a/FS/FS/cust_payby.pm
+++ b/FS/FS/cust_payby.pm
@@ -931,7 +931,7 @@ sub has_autobill_cards {
         weight  => { op => '>',  value => 0 },
     },
     extra_sql =>
-      "AND payby IN ('CARD', 'DCRD') ".
+      "AND cust_payby.payby IN ('CARD', 'DCRD') ".
       'AND '.
       $FS::CurrentUser::CurrentUser->agentnums_sql( table => 'cust_main' ),
   });
@@ -952,7 +952,7 @@ sub has_autobill_checks {
         weight  => { op => '>',  value => 0 },
     },
     extra_sql =>
-      "AND payby IN ('CHEK','DCHEK','DCHK') ".
+      "AND cust_payby.payby IN ('CHEK','DCHEK','DCHK') ".
       'AND '.
       $FS::CurrentUser::CurrentUser->agentnums_sql( table => 'cust_main' ),
   });
diff --git a/httemplate/search/future_autobill.html b/httemplate/search/future_autobill.html
index 1f3862fbc..3385dd880 100644
--- a/httemplate/search/future_autobill.html
+++ b/httemplate/search/future_autobill.html
@@ -121,8 +121,8 @@ there will be 1,400 billing and payment cycles simulated
     order_by  => " ORDER BY weight DESC ",
     extra_sql =>
       "AND (
-        payby IN ('CHEK','DCHK','DCHEK')
-        OR ( paydate > '".$target_dt->ymd."')
+        cust_payby.payby IN ('CHEK','DCHK','DCHEK')
+        OR ( cust_payby.paydate > '".$target_dt->ymd."')
       )
       AND " . $FS::CurrentUser::CurrentUser->agentnums_sql
       . ($agentnum ? "AND cust_main.agentnum = $agentnum" : ''),

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_payby.pm                    |  4 ++--
 httemplate/search/future_autobill.html | 36 ++++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)




More information about the freeside-commits mailing list