%= header("Pending credit card batch", menubar( 'Main Menu' => $p,)) %>
<%
my $statement = "SELECT SUM(amount) from cust_pay_batch";
my $sth = dbh->prepare($statement) or die dbh->errstr. "doing $statement";
$sth->execute or die "Error executing \"$statement\": ". $sth->errstr;
my $total = $sth->fetchrow_arrayref->[0];
my $c_statement = "SELECT COUNT(*) from cust_pay_batch";
my $c_sth = dbh->prepare($c_statement)
or die dbh->errstr. "doing $c_statement";
$c_sth->execute or die "Error executing \"$c_statement\": ". $c_sth->errstr;
my $cards = $c_sth->fetchrow_arrayref->[0];
%>
<%= $cards %> credit card payments batched
$<%= sprintf("%.2f", $total) %> total in pending batch
<%= &table() %>
# |
inv# |
Customer |
Card name |
Card |
Exp |
Amount |
<%
foreach my $cust_pay_batch ( sort { $a->paybatchnum <=> $b->paybatchnum }
qsearch('cust_pay_batch', {} )
) {
my $cardnum = $cust_pay_batch->cardnum;
#$cardnum =~ s/.{4}$/xxxx/;
$cardnum = 'x'x(length($cardnum)-4). substr($cardnum,(length($cardnum)-4));
$cust_pay_batch->exp =~ /^\d{2}(\d{2})[\/\-](\d+)[\/\-]\d+$/;
my( $mon, $year ) = ( $2, $1 );
$mon = "0$mon" if $mon < 10;
my $exp = "$mon/$year";
%>
<%= $cust_pay_batch->paybatchnum %> |
<%= $cust_pay_batch->invnum %> |
<%= $cust_pay_batch->custnum %> |
<%= $cust_pay_batch->get('last'). ', '. $cust_pay_batch->first %> |
<%= $cust_pay_batch->payname %> |
<%= $cardnum %> |
<%= $exp %> |
$<%= $cust_pay_batch->amount %> |
<% } %>