From 17ca8b897e82cffb3731a63ccae1fb12494a7246 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 19 Jan 2014 14:05:44 -0800 Subject: select quick payment entry batch in payment report, RT#26343 --- httemplate/elements/select-paybatch.html | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 httemplate/elements/select-paybatch.html (limited to 'httemplate/elements/select-paybatch.html') diff --git a/httemplate/elements/select-paybatch.html b/httemplate/elements/select-paybatch.html new file mode 100644 index 000000000..1dba452b5 --- /dev/null +++ b/httemplate/elements/select-paybatch.html @@ -0,0 +1,46 @@ + +<%init> + +use Date::Parse qw(str2time); #i should be in Mason.pm + +my %opt = @_; +#my $paybatch = $opt{'curr_value'}; # || $opt{'value'} necessary? + +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; + +my $sth = dbh->prepare('SELECT DISTINCT paybatch FROM cust_pay + WHERE paybatch IS NOT NULL') + or die dbh->errstr; +$sth->execute or die $sth->errstr; + +my @paybatch = #map $_->[0], + sort { $a->[1] <=> $b->[1] } + map { my $date = ''; + if ( /^\w+\-(\d+)\-/ ) { + $date = $1; + } elsif ( /^\w+\-([\d\/]+)\-([\d\:]+)\-/ ) { + $date = str2time("$1 $2"); + #} else { + # warn "unparsable: $_\n"; + } + [ $_, $date ]; + } + grep ! /^webui-/, #don't actually want the single entries + map $_->[0], @{ $sth->fetchall_arrayref }; + + -- cgit v1.2.1