-<% include( 'elements/search.html',
+<& elements/search.html,
'title' => $title,
'name' => 'net refunds',
'query' => $sql_query,
'',
FS::UI::Web::cust_styles(),
],
- )
-%>
+
+&>
<%init>
die "access denied"
$title = $agent->agent. " $title";
}
+if ( $cgi->param('refnum') && $cgi->param('refnum') =~ /^(\d+)$/ ) {
+ push @search, "refnum = $1";
+ my $part_referral = qsearchs('part_referral', { 'refnum' => $1 } );
+ die "unknown refnum $1" unless $part_referral;
+ $title = $part_referral->referral. " $title";
+}
+
+if ( $cgi->param('cust_classnum') ) {
+ my @classnums = grep /^\d+$/, $cgi->param('cust_classnum');
+ push @search, 'cust_main.classnum IN('.join(',',@classnums).')'
+ if @classnums;
+}
+
+
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
push @search, "cust_credit._date >= $beginning ",
"cust_credit._date <= $ending";
#
my $count_query = 'SELECT COUNT(*), SUM(cust_credit_refund.amount)
FROM cust_credit_refund
- LEFT JOIN cust_credit USING ( crednum )
- LEFT JOIN cust_main USING ( custnum ) '.
+ LEFT JOIN cust_credit USING ( crednum ) '.
+ FS::UI::Web::join_cust_main('cust_credit') .
$where;
my $sql_query = {
'hashref' => {},
'extra_sql' => $where,
'addl_from' => 'LEFT JOIN cust_credit USING ( crednum )
- LEFT JOIN cust_refund USING ( refundnum )
- LEFT JOIN cust_main ON ( cust_credit.custnum = cust_main.custnum )',
+ LEFT JOIN cust_refund USING ( refundnum )'.
+ FS::UI::Web::join_cust_main('cust_credit')
};
#my $cust_credit_link = sub {