4.x style
[freeside.git] / bin / countdeclines
1 #!/usr/bin/perl
2
3 use Date::Parse;
4
5 my $e = 'PlugnPay error: 97: Declined for CVV failure';
6 my @y = (2008,2009);
7
8 my $p = 0;
9
10 foreach my $y (@y) {
11   foreach my $m (1..12) {
12     my $d = "$m/1/$y";
13     my $t = str2time($d);
14
15     #print "$pd-$d: SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n"
16     print "SELECT count(*) from cust_bill_event where statustext = '$e' and _date >= $p and _date < $t;\n"
17       if $p;
18
19     $p = $t;
20     $pd = $d;
21   }
22 }