diff options
author | Mark Wells <mark@freeside.biz> | 2013-07-02 13:38:06 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-07-02 13:38:06 -0700 |
commit | 601137d2d3d57841f50f4ab5393c2e521ada263a (patch) | |
tree | bb96e7dc59bb42cd6d5566da4351040912827c10 /httemplate/misc/xmlhttp-cust_bill-search.html | |
parent | d4f9df58cf2ba98b83b90bf0739a44bac8611abf (diff) |
more detail when selecting invoices in quick payment entry, #15861
Diffstat (limited to 'httemplate/misc/xmlhttp-cust_bill-search.html')
-rw-r--r-- | httemplate/misc/xmlhttp-cust_bill-search.html | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/httemplate/misc/xmlhttp-cust_bill-search.html b/httemplate/misc/xmlhttp-cust_bill-search.html index c60a0b05c..6082dc771 100644 --- a/httemplate/misc/xmlhttp-cust_bill-search.html +++ b/httemplate/misc/xmlhttp-cust_bill-search.html @@ -4,17 +4,37 @@ my $curuser = $FS::CurrentUser::CurrentUser; die 'access denied' unless $curuser->access_right('View invoices'); my @return; +my $date_format = FS::Conf->new->config('date_format') || '%m/%d/%Y'; if ( $cgi->param('sub') eq 'custnum_search_open' ) { my $custnum = $cgi->param('arg'); if ( $custnum =~ /^(\d+)$/ ) { #warn "searching invoices for $custnum\n"; my $cust_main = FS::cust_main->by_key($custnum); - @return = map { - +{ $_->hash, - 'owed' => $_->owed } - } $cust_main->open_cust_bill - if $curuser->agentnums_href->{ $cust_main->agentnum }; - } + if ( $curuser->agentnums_href->{ $cust_main->agentnum } ) { + my @open_bills = $cust_main->open_cust_bill; + my $invnum_len; + my $owed_len; + my $date_len; + foreach my $cust_bill (@open_bills) { + my $invnum = $cust_bill->invnum; + my $owed = $cust_bill->owed; + my $date = time2str($date_format, $cust_bill->_date); + $invnum_len = length($invnum) if length($invnum) > $invnum_len; + $owed_len = length($owed) if length($owed) > $owed_len; + $date_len = length($date) if length($date) > $date_len; + + push @return, { $cust_bill->hash, + 'owed' => $owed, + 'date' => $date }; + } + my $format = '%' . $invnum_len . 'd - %' . $date_len . 's - '. + (FS::Conf->new->config('money_char') || '$') . + '%' . $owed_len . '.2f'; + foreach (@return) { + $_->{label} = sprintf($format, $_->{invnum}, $_->{date}, $_->{owed}); + } + } #if agentnum + } #if $custnum } </%init> |