X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Felements%2Fcust_main_dayranges.html;h=73a429f8ab5d313ca03d453563d0537379fb8802;hb=ce9a9630a2232dafc952bdaadb627fcc3a5558f9;hp=c9c71f27449e31be41958761340301dde5448f49;hpb=0704f3f641deb525399521368f1e6ba9ff5b71cd;p=freeside.git diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html index c9c71f274..73a429f8a 100644 --- a/httemplate/search/elements/cust_main_dayranges.html +++ b/httemplate/search/elements/cust_main_dayranges.html @@ -2,10 +2,11 @@ Example: - include( 'elements/cust_main_dayranges.html', + <& elements/cust_main_dayranges.html, 'title' => 'Accounts Receivable Aging Summary', 'range_sub' => $mysub, - ) + 'email_link' => 1, #adds an action column with an email link if true + &> my $mysub = sub { my( $start, $end ) = @_; @@ -19,23 +20,19 @@ Example: 'name' => 'customers', 'query' => $sql_query, 'count_query' => $count_sql, - 'header' => [ - FS::UI::Web::cust_header(), + 'header' => [ + @cust_header, '0-30', '30-60', '60-90', '90+', emt('Total'), @pay_head, + @act_header, ], 'footer' => [ 'Total', - ( map '', - ( 1 .. - scalar(FS::UI::Web::cust_header()-1) - ), - ), - + ( map '',( 1 .. $#cust_header ),), sprintf( $money_char.'%.2f', $row->{'rangecol_0_30'} ), sprintf( $money_char.'%.2f', @@ -44,9 +41,10 @@ Example: $row->{'rangecol_60_90'} ), sprintf( $money_char.'%.2f', $row->{'rangecol_90_0'} ), - sprintf( ''. $money_char.'%.2f'. '', + sprintf( ''.$money_char.'%.2f', $row->{'rangecol_0_0'} ), ('') x @pay_labels, + @act_blank, ], 'fields' => [ FS::UI::Web::cust_fields_subs(), @@ -56,10 +54,11 @@ Example: format_rangecol('90_0'), format_rangecol('0_0'), @pay_labels, + @act_fields, ], 'links' => [ ( map { $_ ne 'Cust. Status' ? $clink : '' } - FS::UI::Web::cust_header() + @cust_header ), '', '', @@ -67,20 +66,33 @@ Example: '', '', @pay_links, + @act_blank, ], + 'link_onclicks' => [ ( map '', @cust_header ), + '', '', '', '', '', + ( map '', @pay_labels ), + @act_link_onclicks, + ], 'align' => FS::UI::Web::cust_aligns(). 'rrrrr'. ('c' x @pay_labels), - 'size' => [ ( map '', FS::UI::Web::cust_header() ), + @act_align, + 'size' => [ ( map '', @cust_header ), #'-1', '', '', '', '', '', ], '', '', '', '', '', '', ( map '', @pay_labels ), + @act_blank, ], 'style' => [ FS::UI::Web::cust_styles(), #'b', '', '', '', '', 'b', ], '', '', '', '', 'b', ( map '', @pay_labels ), + @act_blank, ], + 'xls_format' => [ (map '', FS::UI::Web::cust_styles), + '', '', '', '', { bold => 1 }, + @act_blank, + ], 'color' => [ FS::UI::Web::cust_colors(), '', @@ -90,11 +102,13 @@ Example: '', '', ( map '', @pay_labels ), + @act_blank, ], %opt, &> <%init> +my @cust_header = FS::UI::Web::cust_header($cgi->param('cust_fields')); my %opt = @_; #actually need to auto-generate other things too for a passed-in ranges to work @@ -162,6 +176,15 @@ if ( grep { $cgi->param('status') eq $_ } FS::cust_main->statuses() ) { push @where, FS::cust_main->$method(); } +# cust_classnum (false laziness w/prepaid_income.html, elements/cust_pay_or_refund.html, cust_bill_pay.html, cust_bill_pkg.html, cust_bill_pkg_referral.html, unearned_detail.html, cust_credit.html, cust_credit_refund.html, cust_main::Search::search_sql) +if ( grep { $_ eq 'cust_classnum' } $cgi->param ) { + my @classnums = grep /^\d*$/, $cgi->param('cust_classnum'); + push @where, 'COALESCE( cust_main.classnum, 0) IN ( '. + join(',', map { $_ || '0' } @classnums ). + ' )' + if @classnums; +} + #here is the agent virtualization push @where, $FS::CurrentUser::CurrentUser->agentnums_sql; @@ -227,6 +250,19 @@ if($opt{'payment_links'} && $curuser->access_right('Process payment') && @payby) @payby ); } +my (@act_header, @act_fields, @act_link_onclicks, @act_align, @act_blank); +if (delete($opt{'email_links'})) { + push @act_header, 'Actions'; + push @act_fields, sub { 'send email' }; + push @act_link_onclicks, sub { + my $row = shift; + my $custnum = $row->custnum; + return qq!window.open('${p}misc/email-customers.html?table=cust_main&custnum=$custnum','_blank')!; + }; + push @act_align, 'l'; + push @act_blank, ''; +} + <%once>