X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpayment_history.html;h=099bc4f2b5ec04d9cdacbc4b048475851c9a1c40;hp=244635c9a03f63bd3967ac2f4c0d437f323362cc;hb=eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 244635c9a..099bc4f2b 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -1,76 +1,65 @@ -% -% my( $cust_main ) = @_; -% my $custnum = $cust_main->custnum; -% -% my $conf = new FS::Conf; -% -% my $curuser = $FS::CurrentUser::CurrentUser; -% -% my @payby = grep /\w/, $conf->config('payby'); -% #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) -% @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) -% unless @payby; -% my %payby = map { $_=>1 } @payby; -% -% my $s = 0; -% -% - -

Payment History
-% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { - +% my $s = 0; +% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter check payment % } -% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter cash payment % } -% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Enter Western Union payment % } + % if ( ( $payby{'CARD'} || $payby{'DCRD'} ) % && $curuser->access_right('Process payment') +% && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { -% - - <% $s++ ? ' | ' : '' %> Process credit card payment % } + % if ( ( $payby{'CHEK'} || $payby{'DCHK'} ) % && $curuser->access_right('Process payment') +% && ! $cust_main->is_encrypted($cust_main->payinfo) % ) { -% - - <% $s++ ? ' | ' : '' %> Process electronic check (ACH) payment % } -% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { - +% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { <% $s++ ? ' | ' : '' %> Post manual (offline) credit card payment % } -
-% if ( $curuser->access_right('Post credit') ) { - +% if ( $curuser->access_right('Post credit') ) { Enter credit +
+% } +% if ( $curuser->access_right('View customer tax exemptions') ) { + View tax exemptions
% } -% + +% if ( $conf->exists('batch-enable') +% #&& $curuser->access_right('View customer tax exemptions') +% ) { + View batched payments: +% foreach my $status (qw( Queued In-transit Complete All )) { + <% $status %> + <% $status ne 'All' ? '|' : '' %> +% } +
+% } + %#get payment history %my @history = (); % @@ -84,11 +73,21 @@ % my $link = $curuser->access_right('View invoices') % ? qq!! % : ''; +% my $events = ''; +% if ( $cust_bill->num_cust_event +% && ( $curuser->access_right('Billing event reports') +% || $curuser->access_right('View customer billing events') +% ) +% ) { +% $events = +% qq!
( View invoice events )'; +% } % push @history, { % 'date' => $cust_bill->_date, % 'desc' => $link. $pre. % "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'. -% $post. ( $link ? '' : '' ), +% $post. ( $link ? '' : '' ). $events, % 'charge' => $cust_bill->charged, % }; %} @@ -100,7 +99,7 @@ % % my $payinfo; % if ( $payby eq 'CARD' ) { -% $payinfo = $cust_pay->payinfo_masked; +% $payinfo = $cust_pay->paymask; % } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) { % $payinfo = "ABA $2, Acct# $1"; % } else { @@ -251,7 +250,7 @@ % % my $payby = $cust_pay_void->payby; % my $payinfo = $payby eq 'CARD' -% ? $cust_pay_void->payinfo_masked +% ? $cust_pay_void->paymask % : $cust_pay_void->payinfo; % % $payby =~ s/^BILL$/Check #/ if $payinfo; @@ -387,16 +386,30 @@ % % my $payby = $cust_refund->payby; % my $payinfo = $payby eq 'CARD' -% ? $cust_refund->payinfo_masked +% ? $cust_refund->paymask % : $cust_refund->payinfo; % % $payby =~ s/^BILL$/Check #/ if $payinfo; % $payby =~ s/^CHEK$/Electronic check /; % $payby =~ s/^(CARD|COMP)$/$1 /; % +% my $delete = ''; +% if ( $cust_refund->closed !~ /^Y/i +% && $conf->exists('deleterefunds') +% && $curuser->access_right('Delete refund') +% ) +% { +% $delete = qq! (delete)!; +% } +% % push @history, { % 'date' => $cust_refund->_date, -% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker, +% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker. "
". +% $delete, % 'refund' => $cust_refund->refund, % }; % @@ -424,6 +437,31 @@ % %#display payment history % +%sub balance_forward_row { +% my( $b, $date ) = @_; +% my $conf = new FS::Conf; +% my $money_char = $conf->config('money_char') || '$'; +% ( my $balance_forward = $money_char. $b ) =~ s/^\$\-/- \$/; + + + + <% time2str("%D",$date) %> + + + + Starting balance on <% time2str("%D",$date) %> + (show prior history) + + + + + + + <% $balance_forward %> + + +%} +% %my $balance = 0; %my %target = (); %my $money_char = $conf->config('money_char') || '$'; @@ -433,9 +471,12 @@ %my $hidden = 0; %my $seen = 0; %my $old_history = 0; +%my $lastdate = 0; % %foreach my $item ( sort { $a->{'date'} <=> $b->{'date'} } @history ) { % +% $lastdate = $item->{'date'}; +% % my $display; % if ( $item->{'date'} < $older_than ) { % $display = ' STYLE="display:none" '; @@ -445,28 +486,7 @@ % $display = ''; % % if ( $hidden && ! $seen++ ) { -% ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/; -% - - - - - <% time2str("%D",$item->{'date'}) %> - - - - Starting balance on <% time2str("%D",$item->{'date'}) %> - (show prior history) - - - - - - - <% $balance_forward %> - - -% +% balance_forward_row($balance, $item->{'date'}); % } % % } @@ -547,6 +567,9 @@ % } +%if ( scalar(@history) && $hidden && ! $seen++ ) { +% balance_forward_row($balance, $lastdate); +%} @@ -567,3 +590,26 @@ function show_history () { +<%init> + +my( $cust_main ) = @_; +my $custnum = $cust_main->custnum; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my @payby = grep /\w/, $conf->config('payby'); +#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP )) +@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) + unless @payby; +my %payby = map { $_=>1 } @payby; + +my %status = ( + 'Queued' => 'O', #Open + 'In-transit' => 'I', + 'Complete' => 'R', #Resolved + 'All' => '', +); + +