X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2Fcust_bill_pkg.cgi;h=6a0b600033a822f5e24a3c6dc850ea65974ba646;hb=fb1ac8b894c138a3a04c1d5941c969c99cd3d3f4;hp=2e79cd75d474fc9a2c6db18ec734d7a4d69ab853;hpb=4d2208098eebb3bc9a4ea882d1d0403b4e04359d;p=freeside.git diff --git a/httemplate/search/cust_bill_pkg.cgi b/httemplate/search/cust_bill_pkg.cgi index 2e79cd75d..6a0b60003 100644 --- a/httemplate/search/cust_bill_pkg.cgi +++ b/httemplate/search/cust_bill_pkg.cgi @@ -7,11 +7,11 @@ $unearned ? ( $money_char. '%.2f unearned revenue' ) : (), ], 'header' => [ - '#', + #'#', 'Description', ( $unearned - ? 'Unearned' - : 'Setup charge' + ? ( 'Unearned', 'Owed', 'Payment date' ) + : ( 'Setup charge' ) ), ( $use_usage eq 'usage' ? 'Usage charge' @@ -26,7 +26,7 @@ FS::UI::Web::cust_header(), ], 'fields' => [ - 'billpkgnum', + #'billpkgnum', sub { $_[0]->pkgnum > 0 ? $_[0]->get('pkg') # possibly use override.pkg : $_[0]->get('itemdesc') # but i think this correct @@ -49,6 +49,10 @@ sprintf($money_char.'%.2f', $cust_bill_pkg->setup ); } }, + ( $unearned + ? ( $owed_sub, $payment_date_sub, ) + : () + ), sub { my $row = shift; my $value = 0; if ( $use_usage eq 'recurring' ) { @@ -74,6 +78,7 @@ #'', '', '', + ( $unearned ? ( '', '' ) : () ), '', ( $unearned ? ( '', '' ) : () ), $ilink, @@ -83,7 +88,9 @@ ), ], #'align' => 'rlrrrc'.FS::UI::Web::cust_aligns(), - 'align' => 'lrr'. + 'align' => 'lr'. + ( $unearned ? 'rc' : '' ). + 'r'. ( $unearned ? 'cc' : '' ). 'rc'. FS::UI::Web::cust_aligns(), @@ -91,6 +98,7 @@ #'', '', '', + ( $unearned ? ( '', '' ) : () ), '', ( $unearned ? ( '', '' ) : () ), '', @@ -101,6 +109,7 @@ #'', '', '', + ( $unearned ? ( '', '' ) : () ), '', ( $unearned ? ( '', '' ) : () ), '', @@ -528,7 +537,6 @@ if ($use_usage) { } else { $count_query .= " FROM cust_bill_pkg $join_cust $join_pkg $where"; } -warn "count_query is $count_query\n"; my @select = ( 'cust_bill_pkg.*', 'cust_bill._date', ); @@ -555,4 +563,17 @@ my $clink = [ "${p}view/cust_main.cgi?", 'custnum' ]; my $conf = new FS::Conf; my $money_char = $conf->config('money_char') || '$'; +my $owed_sub = sub { + $money_char. shift->owed_recur; #_recur :/ +}; + +my $payment_date_sub = sub { + #my $cust_bill_pkg = shift; + my @cust_pay = sort { $a->_date <=> $b->_date } + map $_->cust_bill_pay->cust_pay, + shift->cust_bill_pay_pkg('recur') #recur :/ + or return ''; + time2str('%b %d %Y', $cust_pay[-1]->_date ); +}; +