From 6c375156081be5d2023001ed8eaac9b6db568e95 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 9 Aug 2006 06:43:02 +0000 Subject: batch refactor --- httemplate/browse/pay_batch.cgi | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 httemplate/browse/pay_batch.cgi (limited to 'httemplate/browse/pay_batch.cgi') diff --git a/httemplate/browse/pay_batch.cgi b/httemplate/browse/pay_batch.cgi new file mode 100755 index 000000000..66c86d676 --- /dev/null +++ b/httemplate/browse/pay_batch.cgi @@ -0,0 +1,54 @@ + +<%= include("/elements/header.html","Credit card batches", menubar( 'Main Menu' => $p,)) %> + +

+ +<% + my %statusmap = ('I'=>'In Transit', 'O'=>'Open', 'R'=>'Resolved'); +%> + +
+<%= &table() %> + + Batch + First Download + Last Upload + Item Count + Amount + Status + + +<% +foreach my $pay_batch ( sort { $b->batchnum <=> $a->batchnum } + qsearch('pay_batch', {} ) +) { + + my $statement = "SELECT SUM(amount) from cust_pay_batch WHERE batchnum=" . + $pay_batch->batchnum; + 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 WHERE batchnum=" . + $pay_batch->batchnum; + 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]; + +%> + + + <%= $pay_batch->batchnum %> + <%= $pay_batch->download ? time2str("%a %b %e %T %Y", $pay_batch->download) : '' %> + <%= $pay_batch->upload ? time2str("%a %b %e %T %Y", $pay_batch->upload) : '' %> + <%= $cards %> + <%= $total %> + <%= $statusmap{$pay_batch->status} %> + + +<% } %> + + + + -- cgit v1.2.1