[Koha-cvs] koha koha-tmpl/intranet-tmpl/prog/en/includes/m... [rel_3_0]
Antoine Farnault
antoine at koha-fr.org
Tue Dec 12 12:03:48 CET 2006
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Antoine Farnault <toins> 06/12/12 11:03:48
Modified files:
koha-tmpl/intranet-tmpl/prog/en/includes: menu-circ.inc
koha-tmpl/intranet-tmpl/prog/en/reports: reports-home.tmpl
Added files:
circ : overdue.pl stats.pl
koha-tmpl/intranet-tmpl/prog/en/circ: overdue.tmpl stats.tmpl
Removed files:
koha-tmpl/intranet-tmpl/prog/en/reports: overdue.tmpl stats.tmpl
reports : overdue.pl stats.pl
Log message:
moving reports/stats.pl to circ/
& moving reports/overdue.pl to circ/
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/circ/overdue.pl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/circ/stats.pl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/overdue.tmpl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/circ/stats.tmpl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc?cvsroot=koha&only_with_tag=rel_3_0&r1=1.2.2.3&r2=1.2.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/reports/reports-home.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.3.2.2&r2=1.3.2.3
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/reports/overdue.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/reports/stats.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.2&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/overdue.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.3&r2=0
http://cvs.savannah.gnu.org/viewcvs/koha/reports/stats.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.3&r2=0
Patches:
Index: koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -b -r1.2.2.3 -r1.2.2.4
--- koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc 20 Oct 2006 10:35:05 -0000 1.2.2.3
+++ koha-tmpl/intranet-tmpl/prog/en/includes/menu-circ.inc 12 Dec 2006 11:03:47 -0000 1.2.2.4
@@ -6,7 +6,9 @@
<a href="/cgi-bin/koha/circ/branchreserves.pl">Waiting reserves</a>
<a href="/cgi-bin/koha/circ/waitingreservestransfers.pl">Transfers to do</a>
<a href="/cgi-bin/koha/circ/currenttransfers.pl">Transfers to recieve</a>
- <a href="/cgi-bin/koha/circ/branchoverdues.pl">Check overdues</a>
+ <a href="/cgi-bin/koha/circ/branchoverdues.pl">branch overdues</a>
+ <a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">Till Reconciliation</a>
+ <a href="/cgi-bin/koha/circ/overdue.pl">Overdue items</a>
</div>
<div id="main">
\ No newline at end of file
Index: koha-tmpl/intranet-tmpl/prog/en/reports/reports-home.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/reports/reports-home.tmpl,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -b -r1.3.2.2 -r1.3.2.3
--- koha-tmpl/intranet-tmpl/prog/en/reports/reports-home.tmpl 30 Oct 2006 10:04:38 -0000 1.3.2.2
+++ koha-tmpl/intranet-tmpl/prog/en/reports/reports-home.tmpl 12 Dec 2006 11:03:48 -0000 1.3.2.3
@@ -40,9 +40,6 @@
</ul>
<p>on issues</p>
<ul>
- <li><a href="/cgi-bin/koha/reports/stats.pl?time=yesterday">Till Reconciliation:</a> Daily Report (yesterday)</li>
- <li><a href="/cgi-bin/koha/reports/stats.pl?time=today">Till Reconciliation:</a> Daily Report (today)</li>
- <li><a href="/cgi-bin/koha/reports/overdue.pl">Overdue items</a></li>
<li><a href="/cgi-bin/koha/reports/manager.pl?report_name=issues_by_borrower_category">Issues by borrower category</a></li>
<li><a href="/cgi-bin/koha/reports/issues_avg_stats.pl">Average loan time</a></li>
</ul>
Index: circ/overdue.pl
===================================================================
RCS file: circ/overdue.pl
diff -N circ/overdue.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ circ/overdue.pl 12 Dec 2006 11:03:47 -0000 1.1.2.1
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+# $Id: overdue.pl,v 1.1.2.1 2006/12/12 11:03:47 toins Exp $
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+use C4::Context;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use CGI;
+use C4::Auth;
+
+my $input = new CGI;
+my $type = $input->param('type');
+
+my $theme = $input->param('theme'); # only used if allowthemeoverride is set
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "circ/overdue.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { reports => 1 },
+ debug => 1,
+ }
+);
+my $duedate;
+my $borrowernumber;
+my $itemnum;
+my $data1;
+my $data2;
+my $data3;
+my $name;
+my $phone;
+my $email;
+my $biblionumber;
+my $title;
+my $author;
+my @datearr = localtime( time() );
+my $todaysdate =
+ ( 1900 + $datearr[5] ) . '-'
+ . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
+ . sprintf( "%0.2d", $datearr[3] );
+
+my $dbh = C4::Context->dbh;
+
+my $sth =
+ $dbh->prepare(
+ "select date_due,borrowernumber,itemnumber
+ from issues
+ where isnull(returndate) && date_due<? order by date_due,borrowernumber"
+ );
+$sth->execute($todaysdate);
+
+my @overduedata;
+while ( my $data = $sth->fetchrow_hashref ) {
+ $duedate = $data->{'date_due'};
+ $borrowernumber = $data->{'borrowernumber'};
+ $itemnum = $data->{'itemnumber'};
+
+ my $sth1 =
+ $dbh->prepare(
+"select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber=?"
+ );
+ $sth1->execute($borrowernumber);
+ $data1 = $sth1->fetchrow_hashref;
+ $name = $data1->{'concat(firstname,\' \',surname)'};
+ $phone = $data1->{'phone'};
+ $email = $data1->{'emailaddress'};
+ $sth1->finish;
+
+ my $sth2 =
+ $dbh->prepare("select biblionumber from items where itemnumber=?");
+ $sth2->execute($itemnum);
+ $data2 = $sth2->fetchrow_hashref;
+ $biblionumber = $data2->{'biblionumber'};
+ $sth2->finish;
+
+ my $sth3 =
+ $dbh->prepare("select title,author from biblio where biblionumber=?");
+ $sth3->execute($biblionumber);
+ $data3 = $sth3->fetchrow_hashref;
+ $title = $data3->{'title'};
+ $author = $data3->{'author'};
+ $sth3->finish;
+ push(
+ @overduedata,
+ {
+ duedate => $duedate,
+ borrowernumber => $borrowernumber,
+ itemnum => $itemnum,
+ name => $name,
+ phone => $phone,
+ email => $email,
+ biblionumber => $biblionumber,
+ title => $title,
+ author => $author
+ }
+ );
+
+}
+
+$sth->finish;
+
+$template->param(
+ todaysdate => $todaysdate,
+ overdueloop => \@overduedata
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;
Index: circ/stats.pl
===================================================================
RCS file: circ/stats.pl
diff -N circ/stats.pl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ circ/stats.pl 12 Dec 2006 11:03:47 -0000 1.1.2.1
@@ -0,0 +1,193 @@
+#!/usr/bin/perl
+
+# $Id: stats.pl,v 1.1.2.1 2006/12/12 11:03:47 toins Exp $
+
+#written 14/1/2000
+#script to display reports
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA 02111-1307 USA
+
+use strict;
+use CGI;
+use C4::Output;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use Date::Manip;
+use C4::Stats;
+
+my $input = new CGI;
+my $time = $input->param('time');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "circ/stats.tmpl",
+ query => $input,
+ type => "intranet",
+ authnotrequired => 0,
+ flagsrequired => { reports => 1 },
+ debug => 1,
+ }
+);
+
+my $date;
+my $date2;
+if ( $time eq '' ) {
+ $template->param(notime => '1');
+ output_html_with_http_headers $input, $cookie, $template->output;
+ exit;
+}
+if ( $time eq 'yesterday' ) {
+ $date = ParseDate('yesterday');
+ $date2 = ParseDate('today');
+}
+if ( $time eq 'today' ) {
+ $date = ParseDate('today');
+ $date2 = ParseDate('tomorrow');
+}
+if ( $time eq 'daybefore' ) {
+ $date = ParseDate('2 days ago');
+ $date2 = ParseDate('yesterday');
+}
+if ( $time eq 'month' ) {
+ $date = ParseDate('1 month ago');
+ $date2 = ParseDate('today');
+ warn "d : $date // d2 : $date2";
+}
+if ( $time =~ /\// ) {
+ $date = ParseDate($time);
+ $date2 = ParseDateDelta('+ 1 day');
+ $date2 = DateCalc( $date, $date2 );
+}
+$date = UnixDate( $date, '%Y-%m-%d' );
+$date2 = UnixDate( $date2, '%Y-%m-%d' );
+warn "d : $date // d2 : $date2";
+my @payments = TotalPaid( $date, $date2 );
+my $count = @payments;
+my $total = 0;
+my $oldtime;
+my $totalw = 0;
+my @loop;
+my %row;
+my $i = 0;
+
+while ( $i < $count ) {
+ warn " pay : " . $payments[$i]{'timestamp'};
+ my $time = $payments[$i]{'datetime'};
+ my $payments = $payments[$i]{'value'};
+ my $charge = 0;
+ my @temp = split( / /, $payments[$i]{'datetime'} );
+ my $date = $temp[0];
+ my @charges =
+ getcharges( $payments[$i]{'borrowernumber'}, $payments[$i]{'timestamp'} );
+ my $count = @charges;
+ my $temptotalf = 0;
+ my $temptotalr = 0;
+ my $temptotalres = 0;
+ my $temptotalren = 0;
+ my $temptotalw = 0;
+
+ for ( my $i2 = 0 ; $i2 < $count ; $i2++ ) {
+ $charge += $charges[$i2]->{'amount'};
+ %row = (
+ name => $charges[$i2]->{'description'},
+ type => $charges[$i2]->{'accounttype'},
+ time => $charges[$i2]->{'timestamp'},
+ amount => $charges[$i2]->{'amount'},
+ branch => $charges[$i2]->{'amountoutstanding'}
+ );
+ push( @loop, \%row );
+ if ( $payments[$i]{'accountytpe'} ne 'W' ) {
+ if ( $charges[$i2]->{'accounttype'} eq 'Rent' ) {
+ $temptotalr +=
+ $charges[$i2]->{'amount'} -
+ $charges[$i2]->{'amountoutstanding'};
+ }
+ if ( $charges[$i2]->{'accounttype'} eq 'F'
+ || $charges[$i2]->{'accounttype'} eq 'FU'
+ || $charges[$i2]->{'accounttype'} eq 'FN' )
+ {
+ $temptotalf +=
+ $charges[$i2]->{'amount'} -
+ $charges[$i2]->{'amountoutstanding'};
+ }
+ if ( $charges[$i2]->{'accounttype'} eq 'Res' ) {
+ $temptotalres +=
+ $charges[$i2]->{'amount'} -
+ $charges[$i2]->{'amountoutstanding'};
+ }
+ if ( $charges[$i2]->{'accounttype'} eq 'R' ) {
+ $temptotalren +=
+ $charges[$i2]->{'amount'} -
+ $charges[$i2]->{'amountoutstanding'};
+ }
+ }
+ }
+ my $hour = substr( $payments[$i]{'timestamp'}, 8, 2 );
+ my $min = substr( $payments[$i]{'timestamp'}, 10, 2 );
+ my $sec = substr( $payments[$i]{'timestamp'}, 12, 2 );
+ my $time = "$hour:$min:$sec";
+ my $time2 = "$payments[$i]{'date'}";
+ my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} );
+ my $borrowernumber = $payments[$i]{'borrowernumber'};
+ my $oldtime = $payments[$i]{'timestamp'};
+ my $oldtype = $payments[$i]{'accounttype'};
+
+ while ($borrowernumber eq $payments[$i]{'borrowernumber'}
+ && $oldtype == $payments[$i]{'accounttype'}
+ && $oldtime eq $payments[$i]{'timestamp'} )
+ {
+ my $hour = substr( $payments[$i]{'timestamp'}, 8, 2 );
+ my $min = substr( $payments[$i]{'timestamp'}, 10, 2 );
+ my $sec = substr( $payments[$i]{'timestamp'}, 12, 2 );
+ my $time = "$hour:$min:$sec";
+ my $time2 = "$payments[$i]{'date'}";
+ my $branch = Getpaidbranch( $time2, $payments[$i]{'borrowernumber'} );
+ if ( $payments[$i]{'accounttype'} eq 'W' ) {
+ $totalw += $payments[$i]{'amount'};
+ }
+ else {
+ $payments[$i]{'amount'} = $payments[$i]{'amount'} * -1;
+ $total += $payments[$i]{'amount'};
+ }
+
+ %row = (
+ name => "<b>"
+ . $payments[$i]{'firstname'}
+ . $payments[$i]{'surname'} . "</b>",
+ type => $payments[$i]{'accounttype'},
+ time => $payments[$i]{'date'},
+ amount => $payments[$i]{'amount'},
+ branch => $branch
+ );
+ push( @loop, \%row );
+ $oldtype = $payments[$i]{'accounttype'};
+ $oldtime = $payments[$i]{'timestamp'};
+ $borrowernumber = $payments[$i]{'borrowernumber'};
+ $i++;
+ }
+}
+
+$template->param(
+ loop1 => \@loop,
+ totalw => $totalw,
+ total => $total
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;
+
Index: koha-tmpl/intranet-tmpl/prog/en/circ/overdue.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/prog/en/circ/overdue.tmpl
diff -N koha-tmpl/intranet-tmpl/prog/en/circ/overdue.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/prog/en/circ/overdue.tmpl 12 Dec 2006 11:03:47 -0000 1.1.2.1
@@ -0,0 +1,30 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Items Overdue as of <!-- TMPL_VAR NAME="todaysdate" --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!--TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc"-->
+<h2>Items Overdue as of <!-- TMPL_VAR NAME="todaysdate" --></h2>
+
+<table>
+ <tr>
+ <th>Due Date</th>
+ <th>Patron</th>
+ <th>Phone</th>
+ <th>Title</th>
+ <th>Author</th>
+ </tr>
+
+ <!-- TMPL_LOOP NAME="overdueloop" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="duedate" --></td>
+ <!-- TMPL_IF NAME="email" -->
+ <td><a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->"><!-- TMPL_VAR NAME="name" --></a></td>
+ <!-- TMPL_ELSE -->
+ <td><!-- TMPL_VAR NAME="name" --></td>
+ <!-- /TMPL_IF -->
+ <td><!-- TMPL_VAR NAME="phone" --></td>
+ <td><!-- TMPL_VAR NAME="title" --></td>
+ <td><!-- TMPL_VAR NAME="author" --></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+</table>
+
+<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
Index: koha-tmpl/intranet-tmpl/prog/en/circ/stats.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/prog/en/circ/stats.tmpl
diff -N koha-tmpl/intranet-tmpl/prog/en/circ/stats.tmpl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/intranet-tmpl/prog/en/circ/stats.tmpl 12 Dec 2006 11:03:47 -0000 1.1.2.1
@@ -0,0 +1,37 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Statistics<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!--TMPL_INCLUDE NAME="menus.inc" -->
+<!-- TMPL_INCLUDE NAME="menu-circ.inc"-->
+
+ <!-- TMPL_IF NAME="notime" -->
+ <h1>Display stats for</h1>
+ <ul>
+ <li><a href="/cgi-bin/koha/circ/stats.pl?time=yesterday">yesterday</a></li>
+ <li><a href="/cgi-bin/koha/circ/stats.pl?time=today">today</a></li>
+ <!-- TMPL_ELSE -->
+ <!-- TMPL_IF NAME="loop1" -->
+ <table>
+ <caption>Statistics</caption>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Date/time</th>
+ <th>Amount</th>
+ <th>Branch</th>
+ <tr>
+ <!-- TMPL_LOOP name="loop1" -->
+ <tr>
+ <td><!-- TMPL_VAR NAME="name" --></td>
+ <td><!-- TMPL_VAR NAME="type" --></td>
+ <td><!-- TMPL_VAR NAME="time" --></td>
+ <td><!-- TMPL_VAR NAME="amount" --></td>
+ <td><!-- TMPL_VAR NAME="branch" --></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <p>Total paid: <!-- TMPL_VAR NAME="total" --><br>Total written off: <!-- TMPL_VAR NAME="totalw" --></p>
+ <!-- TMPL_ELSE -->
+ <h3>No statistics to report</h3>
+ <!-- /TMPL_IF -->
+
+ <!-- /TMPL_IF -->
+<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
Index: koha-tmpl/intranet-tmpl/prog/en/reports/overdue.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/prog/en/reports/overdue.tmpl
diff -N koha-tmpl/intranet-tmpl/prog/en/reports/overdue.tmpl
--- koha-tmpl/intranet-tmpl/prog/en/reports/overdue.tmpl 2 Oct 2006 15:38:43 -0000 1.1.2.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Items Overdue as of <!-- TMPL_VAR NAME="todaysdate" --><!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!--TMPL_INCLUDE NAME="menus.inc" --><!-- TMPL_INCLUDE NAME="menu-reports.inc"-->
-<h2>Items Overdue as of <!-- TMPL_VAR NAME="todaysdate" --></h2>
-
-<table>
- <tr>
- <th>Due Date</th>
- <th>Patron</th>
- <th>Phone</th>
- <th>Title</th>
- <th>Author</th>
- </tr>
-
- <!-- TMPL_LOOP NAME="overdueloop" -->
- <tr>
- <td><!-- TMPL_VAR NAME="duedate" --></td>
- <!-- TMPL_IF NAME="email" -->
- <td><a href="mailto:<!-- TMPL_VAR NAME="email" -->?subject=Overdue: <!-- TMPL_VAR NAME="title" -->"><!-- TMPL_VAR NAME="name" --></a></td>
- <!-- TMPL_ELSE -->
- <td><!-- TMPL_VAR NAME="name" --></td>
- <!-- /TMPL_IF -->
- <td><!-- TMPL_VAR NAME="phone" --></td>
- <td><!-- TMPL_VAR NAME="title" --></td>
- <td><!-- TMPL_VAR NAME="author" --></td>
- </tr>
- <!-- /TMPL_LOOP -->
-</table>
-
-<!-- TMPL_INCLUDE name="intranet-bottom.inc" -->
\ No newline at end of file
Index: koha-tmpl/intranet-tmpl/prog/en/reports/stats.tmpl
===================================================================
RCS file: koha-tmpl/intranet-tmpl/prog/en/reports/stats.tmpl
diff -N koha-tmpl/intranet-tmpl/prog/en/reports/stats.tmpl
--- koha-tmpl/intranet-tmpl/prog/en/reports/stats.tmpl 2 Oct 2006 15:38:43 -0000 1.1.2.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,29 +0,0 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Statistics<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
-<!--TMPL_INCLUDE NAME="menus.inc" --><!-- TMPL_INCLUDE NAME="menu-reports.inc"-->
- <!-- TMPL_IF NAME="loop1" -->
- <table>
- <caption>Statistics</caption>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Date/time</th>
- <th>Amount</th>
- <th>Branch</th>
- <tr>
- <!-- TMPL_LOOP name="loop1" -->
- <tr>
- <td><!-- TMPL_VAR NAME="name" --></td>
- <td><!-- TMPL_VAR NAME="type" --></td>
- <td><!-- TMPL_VAR NAME="time" --></td>
- <td><!-- TMPL_VAR NAME="amount" --></td>
- <td><!-- TMPL_VAR NAME="branch" --></td>
- </tr>
- <!-- /TMPL_LOOP -->
- </table>
- <p>Total paid: <!-- TMPL_VAR NAME="total" --><br>Total written off: <!-- TMPL_VAR NAME="totalw" --></p>
- <!-- TMPL_ELSE -->
- <h3>No statistics to report</h3>
- <!-- /TMPL_IF -->
-
-
-<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
Index: reports/overdue.pl
===================================================================
RCS file: reports/overdue.pl
diff -N reports/overdue.pl
--- reports/overdue.pl 21 Nov 2006 10:45:54 -0000 1.1.2.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,105 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: overdue.pl,v 1.1.2.3 2006/11/21 10:45:54 toins Exp $
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
-
-use strict;
-use C4::Context;
-use C4::Output;
-use CGI;
-use HTML::Template;
-use C4::Auth;
-
-my $input = new CGI;
-my $type=$input->param('type');
-
-my $theme = $input->param('theme'); # only used if allowthemeoverride is set
-
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "reports/overdue.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {reports => 1},
- debug => 1,
- });
-my $duedate;
-my $borrowernumber;
-my $itemnum;
-my $data1;
-my $data2;
-my $data3;
-my $name;
-my $phone;
-my $email;
-my $biblionumber;
-my $title;
-my $author;
-my @datearr = localtime(time());
-my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
-
-my $dbh = C4::Context->dbh;
-
-my $sth=$dbh->prepare("select date_due,borrowernumber,itemnumber from issues where isnull(returndate) && date_due<? order by date_due,borrowernumber");
-$sth->execute($todaysdate);
-
-my @overduedata;
-while (my $data=$sth->fetchrow_hashref) {
- $duedate=$data->{'date_due'};
- $borrowernumber=$data->{'borrowernumber'};
- $itemnum=$data->{'itemnumber'};
-
- my $sth1=$dbh->prepare("select concat(firstname,' ',surname),phone,emailaddress from borrowers where borrowernumber=?");
- $sth1->execute($borrowernumber);
- $data1=$sth1->fetchrow_hashref;
- $name=$data1->{'concat(firstname,\' \',surname)'};
- $phone=$data1->{'phone'};
- $email=$data1->{'emailaddress'};
- $sth1->finish;
-
- my $sth2=$dbh->prepare("select biblionumber from items where itemnumber=?");
- $sth2->execute($itemnum);
- $data2=$sth2->fetchrow_hashref;
- $biblionumber=$data2->{'biblionumber'};
- $sth2->finish;
-
- my $sth3=$dbh->prepare("select title,author from biblio where biblionumber=?");
- $sth3->execute($biblionumber);
- $data3=$sth3->fetchrow_hashref;
- $title=$data3->{'title'};
- $author=$data3->{'author'};
- $sth3->finish;
- push (@overduedata, { duedate => $duedate,
- borrowernumber => $borrowernumber,
- itemnum => $itemnum,
- name => $name,
- phone => $phone,
- email => $email,
- biblionumber => $biblionumber,
- title => $title,
- author => $author });
-
-}
-
-$sth->finish;
-
-$template->param( todaysdate => $todaysdate,
- overdueloop => \@overduedata );
-
-print "Content-Type: text/html\n\n", $template->output;
Index: reports/stats.pl
===================================================================
RCS file: reports/stats.pl
diff -N reports/stats.pl
--- reports/stats.pl 21 Nov 2006 10:45:54 -0000 1.1.2.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,160 +0,0 @@
-#!/usr/bin/perl
-
-# $Id: stats.pl,v 1.1.2.3 2006/11/21 10:45:54 toins Exp $
-
-#written 14/1/2000
-#script to display reports
-
-
-# Copyright 2000-2002 Katipo Communications
-#
-# This file is part of Koha.
-#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
-
-use strict;
-use CGI;
-use C4::Output;
-use HTML::Template;
-use C4::Auth;
-use C4::Interface::CGI::Output;
-use C4::Context;
-use Date::Manip;
-use C4::Stats;
-
-my $input=new CGI;
-my $time=$input->param('time');
-
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "reports/stats.tmpl",
- query => $input,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {reports=> 1},
- debug => 1,
- });
-
-my $date;
-my $date2;
-if ($time eq 'yesterday'){
- $date=ParseDate('yesterday');
- $date2=ParseDate('today');
-}
-if ($time eq 'today'){
- $date=ParseDate('today');
- $date2=ParseDate('tomorrow');
-}
-if ($time eq 'daybefore'){
- $date=ParseDate('2 days ago');
- $date2=ParseDate('yesterday');
-}
-if ($time eq 'month') {
- $date = ParseDate('1 month ago');
- $date2 = ParseDate('today');
- warn "d : $date // d2 : $date2";
-}
-if ($time=~ /\//){
- $date=ParseDate($time);
- $date2=ParseDateDelta('+ 1 day');
- $date2=DateCalc($date,$date2);
-}
-$date=UnixDate($date,'%Y-%m-%d');
-$date2=UnixDate($date2,'%Y-%m-%d');
- warn "d : $date // d2 : $date2";
-my @payments=TotalPaid($date,$date2);
-my $count=@payments;
-my $total=0;
-my $oldtime;
-my $totalw=0;
-my @loop;
-my %row;
-my $i=0;
-while ($i<$count){
- warn " pay : ".$payments[$i]{'timestamp'};
- my $time=$payments[$i]{'datetime'};
- my $payments=$payments[$i]{'value'};
- my $charge=0;
- my @temp=split(/ /,$payments[$i]{'datetime'});
- my $date=$temp[0];
- my @charges=getcharges($payments[$i]{'borrowernumber'},$payments[$i]{'timestamp'});
- my $count=@charges;
- my $temptotalf=0;
- my $temptotalr=0;
- my $temptotalres=0;
- my $temptotalren=0;
- my $temptotalw=0;
- for (my $i2=0;$i2<$count;$i2++){
- $charge+=$charges[$i2]->{'amount'};
- %row = ( name => $charges[$i2]->{'description'},
- type => $charges[$i2]->{'accounttype'},
- time => $charges[$i2]->{'timestamp'},
- amount => $charges[$i2]->{'amount'},
- branch => $charges[$i2]->{'amountoutstanding'} );
- push(@loop, \%row);
- if ($payments[$i]{'accountytpe'} ne 'W'){
- if ($charges[$i2]->{'accounttype'} eq 'Rent'){
- $temptotalr+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'F' || $charges[$i2]->{'accounttype'} eq 'FU' || $charges[$i2]->{'accounttype'} eq 'FN' ){
- $temptotalf+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'Res'){
- $temptotalres+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- if ($charges[$i2]->{'accounttype'} eq 'R'){
- $temptotalren+=$charges[$i2]->{'amount'}-$charges[$i2]->{'amountoutstanding'};
- }
- }
- }
- my $hour=substr($payments[$i]{'timestamp'},8,2);
- my $min=substr($payments[$i]{'timestamp'},10,2);
- my $sec=substr($payments[$i]{'timestamp'},12,2);
- my $time="$hour:$min:$sec";
- my $time2="$payments[$i]{'date'}";
- my $branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'});
- my $borrowernumber=$payments[$i]{'borrowernumber'};
- my $oldtime=$payments[$i]{'timestamp'};
- my $oldtype=$payments[$i]{'accounttype'};
- while ($borrowernumber eq $payments[$i]{'borrowernumber'} && $oldtype == $payments[$i]{'accounttype'} && $oldtime eq $payments[$i]{'timestamp'}){
- my $hour=substr($payments[$i]{'timestamp'},8,2);
- my $min=substr($payments[$i]{'timestamp'},10,2);
- my $sec=substr($payments[$i]{'timestamp'},12,2);
- my $time="$hour:$min:$sec";
- my $time2="$payments[$i]{'date'}";
- my $branch=Getpaidbranch($time2,$payments[$i]{'borrowernumber'});
- if ($payments[$i]{'accounttype'} eq 'W'){
- $totalw+=$payments[$i]{'amount'};
- } else {
- $payments[$i]{'amount'}=$payments[$i]{'amount'}*-1;
- $total+=$payments[$i]{'amount'};
- }
-
- %row = ( name => "<b>".$payments[$i]{'firstname'}.$payments[$i]{'surname'} . "</b>",
- type => $payments[$i]{'accounttype'}, time => $payments[$i]{'date'},
- amount => $payments[$i]{'amount'}, branch => $branch );
- push(@loop, \%row);
- $oldtype=$payments[$i]{'accounttype'};
- $oldtime=$payments[$i]{'timestamp'};
- $borrowernumber=$payments[$i]{'borrowernumber'};
- $i++;
- }
-}
-
-$template->param( loop1 => \@loop,
- totalw => $totalw,
- total => $total );
-
-output_html_with_http_headers $input, $cookie, $template->output;
-
-
More information about the Koha-cvs
mailing list