[Koha-cvs] CVS: koha stats.screen.pl,1.4,1.5

Mason James szrj1m at users.sourceforge.net
Wed Sep 7 03:22:19 CEST 2005


Update of /cvsroot/koha/koha
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3824

Modified Files:
	stats.screen.pl 
Log Message:
Now takes date range, and credits are displayed as 2dp.


Index: stats.screen.pl
===================================================================
RCS file: /cvsroot/koha/koha/stats.screen.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** stats.screen.pl	23 Aug 2005 23:56:08 -0000	1.4
--- stats.screen.pl	7 Sep 2005 01:22:17 -0000	1.5
***************
*** 10,23 ****
  use Date::Manip;
  use C4::Stats;
  &Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005
  
  my $input=new CGI;
  my $time=$input->param('time');
  
  my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "stats.screen.tmpl",
                               query => $input,
                               type => "intranet",
!                              authnotrequired => 0,
                               flagsrequired => {borrowers => 1},
                               debug => 1,
--- 10,27 ----
  use Date::Manip;
  use C4::Stats;
+ use Data::Dumper;
+ 
  &Date_Init("DateFormat=non-US"); # set non-USA date, eg:19/08/2005
  
  my $input=new CGI;
  my $time=$input->param('time');
+ my $time2=$input->param('time2');
+ 
  
  my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "stats_screen.tmpl",
                               query => $input,
                               type => "intranet",
!                              authnotrequired => 1,
                               flagsrequired => {borrowers => 1},
                               debug => 1,
***************
*** 54,67 ****
  }
  
  
  
  my $date=UnixDate($date,'%Y-%m-%d');
  my $date2=UnixDate($date2,'%Y-%m-%d');
! 
! #warn "MASON: DATE: $date, $date2";
  
  #get a list of every payment
  my @payments=TotalPaid($date,$date2);
  
  my $count=@payments;
  # print "MASON: number of payments=$count\n";
--- 58,77 ----
  }
  
+ # if script is called with a start and finsh date range...
+ if ($time ne '' && $time2 ne ''){
+           $date=ParseDate($time);
+           $date2=ParseDate($time2);
+ }
  
  
  my $date=UnixDate($date,'%Y-%m-%d');
  my $date2=UnixDate($date2,'%Y-%m-%d');
! warn "MASON: TIME: $time, $time2";
! warn "MASON: DATE: $date, $date2";
  
  #get a list of every payment
  my @payments=TotalPaid($date,$date2);
  
+ 
  my $count=@payments;
  # print "MASON: number of payments=$count\n";
***************
*** 82,86 ****
         my @charges;
  
!        if ($payments[$i]{'type'} ne 'writeoff'){         # lets ignore writeoff payments!.
             @charges=getcharges($payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'}, $payments[$i]{'proccode'});
             $totalcharges++;
--- 92,100 ----
         my @charges;
  
! 
!        if ($payments[$i]{'type'} ne 'writeoff'){
! 
! #       warn Dumper $payments[$i];
! 
             @charges=getcharges($payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'}, $payments[$i]{'proccode'});
             $totalcharges++;
***************
*** 131,135 ****
                      creditdescription   => $credits[$i]->{'description'},
                      creditaccounttype   => $credits[$i]->{'accounttype'},
!                     creditamount        => $credits[$i]->{'amount'});
  
         push (@loop2, \%rows2);
--- 145,150 ----
                      creditdescription   => $credits[$i]->{'description'},
                      creditaccounttype   => $credits[$i]->{'accounttype'},
!                     creditamount        => sprintf("%.2f", $credits[$i]->{'amount'})
!                     );
  
         push (@loop2, \%rows2);
***************
*** 150,151 ****
--- 165,167 ----
  
  output_html_with_http_headers $input, $cookie, $template->output;
+ 





More information about the Koha-cvs mailing list