+<TABLE>
+ <TR>
+ <TD ALIGN="left">
+
%# payment links
% my $s = 0;
-% if ( $payby{'BILL'} && $curuser->access_right('Post payment') ) {
+% if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) {
<% $s++ ? ' | ' : '' %>
<% include('/elements/popup_link-cust_main.html',
'label' => 'Enter check payment',
%>
% }
-% if ( $payby{'CASH'} && $curuser->access_right('Post payment') ) {
+% if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) {
<% $s++ ? ' | ' : '' %>
<% include('/elements/popup_link-cust_main.html',
'label' => 'Enter cash payment',
<A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;custnum=<% $custnum %>">Enter Western Union payment</A>
% }
+<BR>
+% $s=0;
+
% if ( ( $payby{'CARD'} || $payby{'DCRD'} )
-% && $curuser->access_right('Process payment')
+% && $curuser->access_right(['Process payment', 'Process credit card payment'])
% && ! $cust_main->is_encrypted($cust_main->payinfo)
% ) {
<% $s++ ? ' | ' : '' %>
% }
% if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
-% && $curuser->access_right('Process payment')
+% && $curuser->access_right(['Process payment', 'Process Echeck payment'])
% && ! $cust_main->is_encrypted($cust_main->payinfo)
% ) {
<% $s++ ? ' | ' : '' %>
'action' => "${p}edit/cust_credit.cgi",
'cust_main' => $cust_main,
'actionlabel' => 'Enter credit',
- 'width' => 392,
+ 'width' => 616, #make room for reasons #540 default
#default# 'height' => 336,
)
%>
%# refund links
% $s = 0;
-% if ( $payby{'BILL'} && $curuser->access_right('Post refund') ) {
+% if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) {
<% $s++ ? ' | ' : '' %>
<% include('/elements/popup_link-cust_main.html',
'label' => 'Enter check refund',
%>
% }
-% if ( $payby{'CASH'} && $curuser->access_right('Post refund') ) {
+% if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) {
<% $s++ ? ' | ' : '' %>
<% include('/elements/popup_link-cust_main.html',
'label' => 'Enter cash refund',
<A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>">Post manual (offline/POS) credit card refund</A>
% }
+ </TD>
+ <TD ALIGN="right" VALIGN="top">
+
+%# invoice reports
+% if ( $curuser->access_right('List invoices') ) {
+ <A HREF="<% $p %>search/report_cust_bill.html?custnum=<% $custnum %>">Invoice reports</A>
+% }
<BR>
+%# XXX payments, credits, refund reports
+
%# tax exemption link
% my $view_exemptions = $curuser->access_right('View customer tax exemptions');
<A HREF="<% $p %>search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=<% $custnum %>">View pending payments</A><BR>
% }
+ </TD>
+ </TR>
+ <TR>
+ <TD COLSPAN=2>
+
%# and now the table
<% include("/elements/table-grid.html") %>
<TR ID="balance_forward_row">
<TD CLASS="grid" BGCOLOR="#dddddd">
- <% time2str("%D",$date) %>
+ <% time2str($date_format, $date) %>
</TD>
<TD CLASS="grid" BGCOLOR="#dddddd">
- <I>Starting balance on <% time2str("%D",$date) %></I>
+ <I>Starting balance on <% time2str($date_format, $date) %></I>
(<A HREF="javascript:void(0);" onClick="show_history();">show prior history</A>)
</TD>
%my %target = ();
%
%my $years = $conf->config('payment_history-years') || 2;
-%my $older_than = time - $years * 31556736; #60*60*24*365.24
+%my $older_than = time - $years * 31556926; #60*60*24*365.2422
%my $hidden = 0;
%my $seen = 0;
%my $old_history = 0;
<TR <% $display ? $display.' ID="old_history'.$old_history++.'"' : ''%>>
- <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" CLASS="grid" BGCOLOR="<% $bgcolor %>">
% unless ( !$target || $target{$target}++ ) {
<A NAME="<% $target %>">
% }
- <% time2str("%D",$item->{'date'}) %>
+ <% time2str($date_format, $item->{'date'}) %>
% if ( $target && $target{$target} == 1 ) {
</A>
<TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $item->{'desc'} %>
</TD>
- <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $charge %>
</TD>
- <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $payment %>
</TD>
- <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $credit %>
</TD>
- <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $refund %>
</TD>
- <TD ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
+ <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
<% $showbalance %>
</TD>
</TR>
% balance_forward_row($balance, $lastdate, $money_char);
%}
+</TABLE>
+ </TD>
+ </TR>
</TABLE>
<SCRIPT TYPE="text/javascript">
my $custnum = $cust_main->custnum;
my $conf = new FS::Conf;
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
my $curuser = $FS::CurrentUser::CurrentUser;
my %opt = (
( map { $_ => scalar($conf->config($_)) }
- qw( card_refund-days )
+ qw( card_refund-days date_format )
),
( map { $_ => $conf->exists($_) }
- qw( deletepayments deleterefunds pkg-balances )
+ qw( deleteinvoices deletepayments deleterefunds pkg-balances )
)
);
};
}
+#statements
+foreach my $cust_statement ($cust_main->cust_statement) {
+ push @history, {
+ 'date' => $cust_statement->_date,
+ 'desc' => include('payment_history/statement.html', $cust_statement, %opt ),
+ #'charge' => $cust_bill->charged,
+ };
+}
+
#payments (some false laziness w/credits)
foreach my $cust_pay ($cust_main->cust_pay) {
push @history, {
};
}
+#pending payments
+foreach my $cust_pay_pending ($cust_main->cust_pay_pending) {
+ push @history, {
+ 'date' => $cust_pay_pending->_date,
+ 'desc' => include('payment_history/pending_payment.html', $cust_pay_pending, %opt ),
+ 'void_payment' => $cust_pay_pending->paid,
+ };
+}
+
+
#voided payments
foreach my $cust_pay_void ($cust_main->cust_pay_void) {
push @history, {
}
+#declined payments
+foreach my $cust_pay_pending ($cust_main->cust_pay_pending_attempt) {
+ push @history, {
+ 'date' => $cust_pay_pending->_date,
+ 'desc' => include('payment_history/attempted_payment.html', $cust_pay_pending, %opt ),
+ 'void_payment' => $cust_pay_pending->paid, #??
+ #'target' => $target, #XXX
+ };
+}
+
#credits (some false laziness w/payments)
foreach my $cust_credit ($cust_main->cust_credit) {
push @history, {