[Koha-devel] CVS: koha/C4 Stats.pm,1.2,1.3 Accounts2.pm,1.2,1.3

Chris Cormack rangi at users.sourceforge.net
Tue Apr 3 00:51:28 CEST 2001


Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv11400/C4

Modified Files:
	Stats.pm Accounts2.pm 
Log Message:
Reworking statistics for payments and writeoffs


Index: Stats.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Stats.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Stats.pm	2001/03/27 21:43:37	1.2
--- Stats.pm	2001/04/02 22:51:26	1.3
***************
*** 56,60 ****
    my ($env,$branch,$type,$amount,$other,$itemnum,$itemtype,$borrowernumber)=@_;
    my $dbh=C4Connect();
!   my $branch=$env->{'branchcode'};
    my $user = $env->{'usercode'};
    print $borrowernumber;
--- 56,62 ----
    my ($env,$branch,$type,$amount,$other,$itemnum,$itemtype,$borrowernumber)=@_;
    my $dbh=C4Connect();
!   if ($branch eq ''){
!     $branch=$env->{'branchcode'};
!   }
    my $user = $env->{'usercode'};
    print $borrowernumber;
***************
*** 148,161 ****
    my ($time)=@_;
    my $dbh=C4Connect;
!   my $query="Select * from statistics,borrowers
!   where statistics.borrowernumber= borrowers.borrowernumber
!   and (statistics.type='payment' or statistics.type='writeoff')";
    if ($time eq 'today'){
!     $query=$query." and datetime = now()";
    } else {
!     $query.=" and datetime > '$time'";
    }
! #  $query.=" order by timestamp";
!   print $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 150,171 ----
    my ($time)=@_;
    my $dbh=C4Connect;
!   my $query="Select * from accountlines,borrowers where (accounttype = 'Pay'
! or accounttype ='W')
!   and accountlines.borrowernumber = borrowers.borrowernumber";
    if ($time eq 'today'){
!     $query=$query." and date = now()";
    } else {
!     $query.=" and date='$time'";
    }
! #  my $query="Select * from statistics,borrowers
! #  where statistics.borrowernumber= borrowers.borrowernumber
! #  and (statistics.type='payment' or statistics.type='writeoff') ";
! #  if ($time eq 'today'){
! #    $query=$query." and datetime = now()";
! #  } else {
! #    $query.=" and datetime > '$time'";
! #  }
!   $query.=" order by timestamp";
! #  print $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;
***************
*** 180,184 ****
    accounttype <> 'W'";
    my $sth=$dbh->prepare($query);
!   print $query,"<br>";
    $sth->execute;
    my $i=0;
--- 190,194 ----
    accounttype <> 'W'";
    my $sth=$dbh->prepare($query);
! #  print $query,"<br>";
    $sth->execute;
    my $i=0;
***************
*** 195,201 ****
  
  sub Getpaidbranch{
!   my($date)=@_;
    my $dbh=C4Connect;
!   my $query="select * from statistics where type='payment' and datetime='$date'";
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 205,212 ----
  
  sub Getpaidbranch{
!   my($date,$borrno)=@_;
    my $dbh=C4Connect;
!   my $query="select * from statistics where type='payment' and datetime
!   >'$date' and  borrowernumber='$borrno'";
    my $sth=$dbh->prepare($query);
    $sth->execute;

Index: Accounts2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts2.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Accounts2.pm	2001/03/27 21:43:37	1.2
--- Accounts2.pm	2001/04/02 22:51:26	1.3
***************
*** 62,65 ****
--- 62,66 ----
    my $newamtos = 0;
    my $accdata = "";
+   my $branch=$env->{'branchcode'};
    my $amountleft = $data;
    # begin transaction
***************
*** 101,105 ****
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,'branch','payment',$data,'','','',$bornumber);
    $sth->finish;
    $dbh->disconnect;
--- 102,106 ----
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,$branch,'payment',$data,'','','',$bornumber);
    $sth->finish;
    $dbh->disconnect;





More information about the Koha-devel mailing list