koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/reports borrowers_stats.pl


From: passini
Subject: [Koha-cvs] koha/reports borrowers_stats.pl
Date: Mon, 30 Jul 2007 15:24:38 -0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Changes by:     passini <hpassini>      07/07/30 15:24:36

Modified files:
        reports        : borrowers_stats.pl 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/reports/borrowers_stats.pl?cvsroot=koha&r1=1.18&r2=1.19

Patches:
Index: borrowers_stats.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/borrowers_stats.pl,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- borrowers_stats.pl  10 Jul 2007 07:31:35 -0000      1.18
+++ borrowers_stats.pl  30 Jul 2007 15:24:36 -0000      1.19
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: borrowers_stats.pl,v 1.18 2007/07/10 07:31:35 hpassini Exp $
+# $Id: borrowers_stats.pl,v 1.19 2007/07/30 15:24:36 hpassini Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -28,6 +28,10 @@
 use C4::Acquisition;
 use C4::Output;
 use C4::Circulation;
+use Date::Calc qw(
+  Today
+  Add_Delta_YM
+  );
 
 =head1 NAME
 
@@ -46,6 +50,7 @@
 my $column = $input->param("Column");
 my @filters = $input->param("Filter");
 my $digits = $input->param("digits");
+my $period = $input->param("period");
 my $borstat = $input->param("status");
 my $borstat1 = $input->param("activity");
 my $output = $input->param("output");
@@ -294,6 +299,10 @@
        if ($activity) {
                push @loopfilter,{crit=>"Activity",filter=>$activity};
        }
+# year of activity
+       my ( $period_year, $period_month, $period_day )=Add_Delta_YM( 
Today(),-$period, 0);
+       my $newperioddate=$period_year."-".$period_month."-".$period_day;
+       warn "PERIOD".$period;
 # 1st, loop rows.
        my $linefield;
        if (($line =~/zipcode/) and ($digits)) {
@@ -392,8 +401,8 @@
        $strcalc .= " AND sort1 like '" . @$filters[5] ."'" if ( @$filters[5] );
        @$filters[6]=~ s/\*/%/g if (@$filters[6]);
        $strcalc .= " AND sort2 like '" . @$filters[6] ."'" if ( @$filters[6] );
-       $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) 
from issues where timestamp > ' 2007-01-01')" if ($activity eq 'active');
-       $strcalc .= " AND borrowernumber not in (select 
distinct(borrowernumber) from issues where timestamp > ' 2007-01-01')" if 
($activity eq 'nonactive');
+       $strcalc .= " AND borrowernumber in (select distinct(borrowernumber) 
from issues where issuedate > '" . $newperioddate . "')" if ($activity eq 
'active');
+       $strcalc .= " AND borrowernumber not in (select 
distinct(borrowernumber) from issues where issuedate > '" . $newperioddate . 
"')" if ($activity eq 'nonactive');
        $strcalc .= " AND $status='1' " if ($status);
        $strcalc .= " group by $linefield, $colfield";
        warn "". $strcalc;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]