% my $s = 0;
% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) {
<% $s++ ? ' | ' : '' %>
- <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_pay.cgi?popup=1;payby=BILL;custnum=<% $custnum %>', 392, 336, 'cust_pay_popup' ), CAPTION, 'Enter check payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter check payment</A>
+ <% include('/elements/popup_link-cust_main.html',
+ 'label' => 'Enter check payment',
+ 'action' => "${p}edit/cust_pay.cgi?popup=1;payby=BILL",
+ 'cust_main' => $cust_main,
+ 'actionlabel' => 'Enter check payment',
+ 'width' => 392,
+ #default# 'height' => 336,
+ )
+ %>
% }
% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) {
<% $s++ ? ' | ' : '' %>
- <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_pay.cgi?popup=1;payby=CASH;custnum=<% $custnum %>', 392, 336, 'cust_pay_popup' ), CAPTION, 'Enter cash payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter cash payment</A>
+ <% include('/elements/popup_link-cust_main.html',
+ 'label' => 'Enter cash payment',
+ 'action' => "${p}edit/cust_pay.cgi?popup=1;payby=CASH",
+ 'cust_main' => $cust_main,
+ 'actionlabel' => 'Enter cash payment',
+ 'width' => 392,
+ #default# 'height' => 336,
+ )
+ %>
% }
% if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) {
% if ( ( $payby{'CARD'} || $payby{'DCRD'} )
% && $curuser->access_right('Process payment')
+% && ! $cust_main->is_encrypted($cust_main->payinfo)
% ) {
<% $s++ ? ' | ' : '' %>
<A HREF="<% $p %>misc/payment.cgi?payby=CARD;custnum=<% $custnum %>">Process credit card payment</A>
% if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
% && $curuser->access_right('Process payment')
+% && ! $cust_main->is_encrypted($cust_main->payinfo)
% ) {
<% $s++ ? ' | ' : '' %>
<A HREF="<% $p %>misc/payment.cgi?payby=CHEK;custnum=<% $custnum %>">Process electronic check (ACH) payment</A>
<BR>
% if ( $curuser->access_right('Post credit') ) {
- <A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('<% $p %>edit/cust_credit.cgi?<% $custnum %>', 392, 336, 'cust_credit_popup' ), CAPTION, 'Enter credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">Enter credit</A>
+ <% include('/elements/popup_link-cust_main.html',
+ 'label' => 'Enter credit',
+ 'action' => "${p}edit/cust_credit.cgi",
+ 'cust_main' => $cust_main,
+ 'actionlabel' => 'Enter credit',
+ 'width' => 392,
+ #default# 'height' => 336,
+ )
+ %>
<BR>
% }
<BR>
% }
+% if ( $conf->exists('batch-enable')
+% && $curuser->access_right('View customer batched payments')
+% ) {
+ View batched payments:
+% foreach my $status (qw( Queued In-transit Complete All )) {
+ <A HREF="<% $p %>search/cust_pay_batch.cgi?status=<% $status{$status} %>;custnum=<% $custnum %>"><% $status %></A>
+ <% $status ne 'All' ? '|' : '' %>
+% }
+ <BR>
+% }
+
%#get payment history
%my @history = ();
%
% my $link = $curuser->access_right('View invoices')
% ? qq!<A HREF="${p}view/cust_bill.cgi?$invnum">!
% : '';
+% my $events = '';
+% if ( $cust_bill->num_cust_event
+% && ( $curuser->access_right('Billing event reports')
+% || $curuser->access_right('View customer billing events')
+% )
+% ) {
+% $events =
+% qq!<BR><FONT SIZE="-1"><A HREF="${p}search/cust_event.html?invnum=!.
+% $cust_bill->invnum. '">( View invoice events )</A></FONT>';
+% }
% push @history, {
% 'date' => $cust_bill->_date,
% 'desc' => $link. $pre.
% "Invoice #$invnum (Balance \$". $cust_bill->owed. ')'.
-% $post. ( $link ? '</A>' : '' ),
+% $post. ( $link ? '</A>' : '' ). $events,
% 'charge' => $cust_bill->charged,
% };
%}
%
% my $payinfo;
% if ( $payby eq 'CARD' ) {
-% $payinfo = $cust_pay->payinfo_masked;
-% } elsif ( $payby eq 'CHEK' && $cust_pay->payinfo =~ /^(\d+)\@(\d+)$/ ) {
-% $payinfo = "ABA $2, Acct# $1";
+% $payinfo = $cust_pay->paymask;
+% } elsif ( $payby eq 'CHEK' ) {
+% my( $account, $aba ) = split('@', $cust_pay->paymask );
+% $payinfo = "ABA $aba, Acct #$account";
% } else {
% $payinfo = $cust_pay->payinfo;
% }
% $payby =~ s/^WEST$/Western Union/;
% $payby =~ s/^MCRD$/Manual credit card/;
% $payby =~ s/^BILL$//;
-% my $info = $payby ? " ($payby$payinfo)" : '';
+% my $info = $payby ? "($payby$payinfo)" : '';
%
% my( $pre, $post, $desc, $apply, $ext ) = ( '', '', '', '', '' );
% if ( scalar(@cust_bill_pay) == 0
% #completely unapplied
% $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
% $post = '</FONT></B>';
-% $apply = qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_bill_pay.cgi?!.
-% $cust_pay->paynum.
-% qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!;
-%
+% if ( $curuser->access_right('Apply payment') ) {
+% $apply = ' ('. include( '/elements/popup_link.html',
+% 'label' => 'apply',
+% 'action' => "${p}edit/cust_bill_pay.cgi?".
+% $cust_pay->paynum,
+% 'actionlabel' => 'Apply payment',
+% 'width' => 392,
+% #default# 'height' => 336,
+% ).
+% ')';
+% }
% } elsif ( scalar(@cust_bill_pay) == 1
% && scalar(@cust_pay_refund) == 0
% && $cust_pay->unapplied == 0 ) {
% if ( $cust_pay->unapplied > 0 ) {
% $desc .= ' '.
% '<B><FONT COLOR="#FF0000">$'.
-% $cust_pay->unapplied. ' unapplied</FONT></B>'.
-% qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_bill_pay.cgi?!.
-% $cust_pay->paynum.
-% qq!', 392, 336, 'cust_bill_pay_popup' ), CAPTION, 'Apply payment', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!.
-% '<BR>';
+% $cust_pay->unapplied. ' unapplied</FONT></B>';
+% if ( $curuser->access_right('Apply payment') ) {
+% $desc = ' ('. include( '/elements/popup_link.html',
+% 'label' => 'apply',
+% 'action' => "${p}edit/cust_bill_pay.cgi?".
+% $cust_pay->paynum,
+% 'actionlabel' => 'Apply payment',
+% 'width' => 392,
+% #default# 'height' => 336,
+% ).
+% ')';
+% }
+% $desc .= '<BR>';
% }
% }
%
+% my $view =
+% ' ('. include('/elements/popup_link.html',
+% 'label' => 'view receipt',
+% 'action' => "${p}view/cust_pay.html?link=popup;paynum=".
+% $cust_pay->paynum,
+% 'actionlabel' => 'Payment Receipt',
+% ).
+% ')';
+%
% my $refund = '';
% my $refund_days = $conf->config('card_refund-days') || 120;
% if ( $cust_pay->closed !~ /^Y/i
% qq!>unapply</A>)!;
% }
%
+% my $otaker = $cust_pay->otaker;
+% $otaker = '<i>auto billing</i>' if $otaker eq 'fs_daily';
+% $otaker = '<i>customer self-service</i>' if $otaker eq 'fs_selfservice';
+%
% push @history, {
% 'date' => $cust_pay->_date,
-% 'desc' => $pre. "Payment$post$info$desc".
-% "$apply$refund$void$delete$unapply",
+% 'desc' => $pre. "Payment$post by $otaker $info$desc".
+% "$view$apply$refund$void$delete$unapply",
% 'payment' => $cust_pay->paid,
% 'target' => $target,
% };
%
% 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;
% #completely unapplied
% $pre = '<B><FONT COLOR="#FF0000">Unapplied ';
% $post = '</FONT></B>';
-% $apply = qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_credit_bill.cgi?!.
-% $cust_credit->crednum.
-% qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!;
+% if ( $curuser->access_right('Apply credit') ) {
+% $apply = ' ('. include( '/elements/popup_link.html',
+% 'label' => 'apply',
+% 'action' => "${p}edit/cust_credit_bill.cgi?".
+% $cust_credit->crednum,
+% 'actionlabel' => 'Apply credit',
+% 'width' => 392,
+% #default# 'height' => 336,
+% ).
+% ')';
+% }
% } elsif ( scalar(@cust_credit_bill) == 1
% && scalar(@cust_credit_refund) == 0
% && $cust_credit->credited == 0 ) {
% }
% if ( $cust_credit->credited > 0 ) {
% $desc .= ' <B><FONT COLOR="#FF0000">$'.
-% $cust_credit->credited. ' unapplied</FONT></B>'.
-% qq! (<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('${p}edit/cust_credit_bill.cgi?!.
-% $cust_credit->crednum.
-% qq!', 392, 336, 'cust_credit_bill_popup' ), CAPTION, 'Apply credit', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, DRAGGABLE, CLOSECLICK ); return false;">apply</A>)!.
-% '<BR>';
+% $cust_credit->credited. ' unapplied</FONT></B>';
+% if ( $curuser->access_right('Apply credit') ) {
+% $desc = ' ('. include( '/elements/popup_link.html',
+% 'label' => 'apply',
+% 'action' => "${p}edit/cust_credit_bill.cgi?".
+% $cust_credit->crednum,
+% 'actionlabel' => 'Apply credit',
+% 'width' => 392,
+% #default# 'height' => 336,
+% ).
+% ')';
+% }
+% $desc .= '<BR>';
% }
% }
%#
%
% 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! (<A HREF="javascript:areyousure('!.
+% qq!${p}misc/delete-cust_refund.cgi?!. $cust_refund->refundnum.
+% qq!', 'Are you sure you want to delete this refund?')"!.
+% qq! TITLE="Delete this refund from the database completely - not recommended"!.
+% qq!>delete</A>)!;
+% }
+%
% push @history, {
% 'date' => $cust_refund->_date,
-% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker,
+% 'desc' => "Refund ($payby$payinfo) by ". $cust_refund->otaker. "<BR>".
+% $delete,
% 'refund' => $cust_refund->refund,
% };
%
%
%#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/^\$\-/- \$/;
+
+ <TR ID="balance_forward_row">
+ <TD CLASS="grid" BGCOLOR="#dddddd">
+ <% time2str("%D",$date) %>
+ </TD>
+
+ <TD CLASS="grid" BGCOLOR="#dddddd">
+ <I>Starting balance on <% time2str("%D",$date) %></I>
+ (<A HREF="javascript:void(0);" onClick="show_history();">show prior history</A>)
+ </TD>
+
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
+ <TD CLASS="grid" BGCOLOR="#dddddd"><I><% $balance_forward %></I></TD>
+
+ </TR>
+%}
+%
%my $balance = 0;
%my %target = ();
%my $money_char = $conf->config('money_char') || '$';
%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" ';
% $display = '';
%
% if ( $hidden && ! $seen++ ) {
-% ( my $balance_forward = $money_char. $balance ) =~ s/^\$\-/- \$/;
-%
-
-
- <TR ID="balance_forward_row">
- <TD CLASS="grid" BGCOLOR="#dddddd">
- <% time2str("%D",$item->{'date'}) %>
- </TD>
-
- <TD CLASS="grid" BGCOLOR="#dddddd">
- <I>Starting balance on <% time2str("%D",$item->{'date'}) %></I>
- (<A HREF="javascript:void(0);" onClick="show_history();">show prior history</A>)
- </TD>
-
- <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
- <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
- <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
- <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
- <TD CLASS="grid" BGCOLOR="#dddddd"><I><% $balance_forward %></I></TD>
-
- </TR>
-%
+% balance_forward_row($balance, $item->{'date'});
% }
%
% }
</TR>
% }
+%if ( scalar(@history) && $hidden && ! $seen++ ) {
+% balance_forward_row($balance, $lastdate);
+%}
</TABLE>
unless @payby;
my %payby = map { $_=>1 } @payby;
+my %status = (
+ 'Queued' => 'O', #Open
+ 'In-transit' => 'I',
+ 'Complete' => 'R', #Resolved
+ 'All' => '',
+);
+
</%init>