RT# 82949 - changes section name from fees to pricing, better opiton
[freeside.git] / httemplate / search / future_autobill.html
index 1f3862f..2e723ec 100644 (file)
@@ -35,6 +35,36 @@ 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>
+%   }
+%   if ( keys %pmt_type_subtotal > 1 ) {
+%     $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;
@@ -121,8 +151,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" : ''),
@@ -134,6 +164,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 +270,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