fix top subtotals on refund reports
authorIvan Kohler <ivan@freeside.biz>
Wed, 27 May 2020 20:44:36 +0000 (13:44 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 27 May 2020 20:44:36 +0000 (13:44 -0700)
httemplate/search/elements/cust_pay_or_refund.html
httemplate/search/elements/grouped-search/html

index 39c8ecf..bd0e9e3 100755 (executable)
@@ -58,6 +58,7 @@ Examples:
 
                 'group_column'   => 'payby',
                 'group_label'    => 'payby_name',
+                'amount_field'   => $amount_field,
                 'subtotal'       => { $opt{amount_field} => "sum($amount_field)" },
                 'subtotal_row'   => [ 'Subtotal',
                                       sub { sprintf($money, $_[0]->$amount_field) },
index 24cf50e..cb9c96c 100644 (file)
@@ -5,6 +5,8 @@ my $conf = FS::Conf->new;
 my %opt = @_;
 $opt{'name'} ||= PL($opt{'name_singular'});
 
+my $amount_field = $opt{amount_field};
+
 my $group_info = $m->comp('core', %opt);
 
 my $redirect;
@@ -109,7 +111,7 @@ my $money = $conf->config('money_char') || '$';
 
 <DIV CLASS="fstabcontainer">
 % if ( $group->num_rows > 0 ) {
-<P><% emt('[quant,_1,_2]', $group->num_rows, $opt{name_singular}) %> for <% emt($money.$group->paid) %>
+<P><% emt('[quant,_1,_2]', $group->num_rows, $opt{name_singular}) %> for <% emt($money.$group->$amount_field()) %>
 </P>
 %# download links
 <P><% emt('Download results:') %>