Permalink
Browse files

new feature : stocktaking/inventory.

Look in reports menu
(no DB changes)
  • Loading branch information...
1 parent f247a6c commit 58951e551fd81298e7f877c865277fe04507ced7 tipaul committed Feb 12, 2004
@@ -52,6 +52,7 @@ C4::Circulation::Circ2 - Koha circulation module
The functions in this module deal with circulation, issues, and
returns, as well as general information about the library.
+Also deals with stocktaking.
=head1 FUNCTIONS
@@ -63,10 +64,41 @@ returns, as well as general information about the library.
@EXPORT = qw(&getpatroninformation
&currentissues &getissues &getiteminformation
&issuebook &returnbook &find_reserves &transferbook &decode
- &calc_charges);
+ &calc_charges &listitemsforinventory &itemseen);
# &getbranches &getprinters &getbranch &getprinter => moved to C4::Koha.pm
+=item itemseen
+&itemseen($itemnum)
+Mark item as seen. Is called when an item is issued, returned or manually marked during inventory/stocktaking
+C<$itemnum> is the item number
+
+=back
+
+=cut
+sub itemseen {
+ my ($itemnum) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("update items set datelastseen = now() where items.itemnumber = ?");
+ $sth->execute($itemnum);
+ return;
+}
+
+sub listitemsforinventory {
+ my ($minlocation,$maxlocation,$datelastseen,$offset,$size) = @_;
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare("select itemnumber,barcode,bulk,title,author from items,biblio where items.biblionumber=biblio.biblionumber and bulk>= ? and bulk <=? and (datelastseen< ? or datelastseen is null) order by bulk,title");
+ $sth->execute($minlocation,$maxlocation,$datelastseen);
+ my @results;
+ while (my $row = $sth->fetchrow_hashref) {
+ $offset-- if ($offset);
+ if ((!$offset) && $size) {
+ push @results,$row;
+ $size--;
+ }
+ }
+ return \@results;
+}
=item getpatroninformation
($borrower, $flags) = &getpatroninformation($env, $borrowernumber,
@@ -444,7 +476,8 @@ sub dotransfer {
$dbh->do("INSERT INTO branchtransfers (itemnumber, frombranch, datearrived, tobranch)
VALUES ($itm, $fbr, now(), $tbr)");
#update holdingbranch in items .....
- $dbh->do("UPDATE items SET datelastseen = now(), holdingbranch = $tbr WHERE items.itemnumber = $itm");
+ $dbh->do("UPDATE items holdingbranch = $tbr WHERE items.itemnumber = $itm");
+ &itemseen($itm);
return;
}
@@ -756,9 +789,10 @@ sub issuebook {
$sth->execute($patroninformation->{'borrowernumber'}, $iteminformation->{'itemnumber'}, $dateduef, $env->{'branchcode'});
$sth->finish;
$iteminformation->{'issues'}++;
- $sth=$dbh->prepare("update items set issues=?,datelastseen=now() where itemnumber=?");
+ $sth=$dbh->prepare("update items set issues=? where itemnumber=?");
$sth->execute($iteminformation->{'issues'},$iteminformation->{'itemnumber'});
$sth->finish;
+ &itemseen($iteminformation->{'itemnumber'});
# If it costs to borrow this book, charge it to the patron's account.
my ($charge,$itemtype)=calc_charges($env, $dbh, $iteminformation->{'itemnumber'}, $patroninformation->{'borrowernumber'});
if ($charge > 0) {
@@ -918,9 +952,7 @@ sub doreturn {
and (itemnumber = ?) and (returndate is null)");
$sth->execute($brn,$itm);
$sth->finish;
- $sth=$dbh->prepare("update items set datelastseen=now() where itemnumber=?");
- $sth->execute($itm);
- $sth->finish;
+ &itemseen($itm);
return;
}
@@ -0,0 +1,112 @@
+<!-- TMPL_INCLUDE NAME="reports-top.inc" -->
+<h1>Inventory/Stocktaking</h1>
+<form method="post">
+ <table>
+ <tr>
+ <th colspan=2>
+ Select items you want to check
+ </th>
+ </tr>
+ <tr>
+ <td>
+ Item Location (items.bulk) between
+ </td>
+ <td>
+ <input type="text" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->"> and <input type="text" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ not seen since
+ </td>
+ <td>
+ <input type="text" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ show
+ </td>
+ <td>
+ <input type="text" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <i> items beginning at offset</i>
+ <input type="text" name="offset" value="<!-- TMPL_VAR name="offset" -->">
+ </td>
+ </tr>
+ <tr colspan=2>
+ <td>
+ <input type="submit" value="OK" class="button">
+ </td>
+ </tr>
+ </table>
+</form>
+
+<form method="post">
+<input type="hidden" name="markseen" value="1">
+<input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+<input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+<input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+<input type="hidden" name="offset" value="<!-- TMPL_VAR name="offset" -->">
+<!-- TMPL_IF name="loop" -->
+<table width="100%">
+ <tr>
+ <th>Seen</th>
+ <th>Barcode</th>
+ <th>Bulk</th>
+ <th>Title</th>
+ <th>Author</th>
+ </tr>
+<!-- TMPL_LOOP name="loop" -->
+ <tr>
+ <td>
+ <input type="checkbox" name="SEEN-<!-- TMPL_VAR name="itemnumber" -->" value="1">
+ </td>
+ <td>
+ <!-- TMPL_VAR name="barcode" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="bulk" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="title" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="author" -->
+ </td>
+ </tr>
+<!-- /TMPL_LOOP -->
+</table>
+<input type="submit" value="Mark seen" class="button">
+</form>
+<!-- /TMPL_IF -->
+
+<table>
+<tr>
+ <td>
+ <!-- TMPL_IF name="offset" -->
+ <form method="post">
+ <input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+ <input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ <input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ <input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <input type="hidden" name="offset" value="<!-- TMPL_VAR name="prevoffset" -->">
+ <input type="submit" value="&lt;&lt;&lt;" class="button">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ <td>
+ <!-- TMPL_IF name="nextoffset" -->
+ <form method="post">
+ <input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+ <input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ <input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ <input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <input type="hidden" name="offset" value="<!-- TMPL_VAR name="nextoffset" -->">
+ <input type="submit" value="&gt;&gt;&gt;" class="button">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+</tr>
+</table>
+<!-- TMPL_INCLUDE NAME="reports-bottom.inc" -->
@@ -1,16 +1,12 @@
<!-- TMPL_INCLUDE NAME="reports-top.inc" -->
<!-------------------------MAIN BODY OF PAGE-------------------------->
-<h1>Reports</h1><br>
-
-
-
-
-<ul><li><a href=/cgi-bin/koha/stats.pl?time=yesterday>Till Reconciliation:</a> Daily Report (yesterday)
-<li><a href=/cgi-bin/koha/stats.pl?time=today>Till Reconciliation:</a> Daily Report (today)
-<li><a href=/cgi-bin/koha/overdue.pl>Overdue items</a>
-
-
+<h1>Reports</h1><br/>
+<ul>
+ <li><a href="/cgi-bin/koha/stats.pl?time=yesterday">Till Reconciliation:</a> Daily Report (yesterday)</li>
+ <li><a href="/cgi-bin/koha/stats.pl?time=today">Till Reconciliation:</a> Daily Report (today)</li>
+ <li><a href="/cgi-bin/koha/overdue.pl">Overdue items</a></li>
+ <li><a href="/cgi-bin/koha/reports/inventory.pl">Inventory/Stocktaking</a></li>
</ul>
<!-- TMPL_INCLUDE NAME="reports-bottom.inc" -->
@@ -0,0 +1,112 @@
+<!-- TMPL_INCLUDE NAME="reports-top.inc" -->
+<h1>R�colement</h1>
+<form method="post">
+ <table>
+ <tr>
+ <th colspan=2>
+ S�lectionnez les ouvrages que vous voulez r�coler
+ </th>
+ </tr>
+ <tr>
+ <td>
+ Ouvrage (champ items.bulk) localis� entre
+ </td>
+ <td>
+ <input type="text" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->"> et <input type="text" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ pas vu depuis le (AAAA-MM-JJ)
+ </td>
+ <td>
+ <input type="text" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Voir
+ </td>
+ <td>
+ <input type="text" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <i> ouvrage � partir du</i>
+ <input type="text" name="offset" value="<!-- TMPL_VAR name="offset" -->">
+ </td>
+ </tr>
+ <tr colspan=2>
+ <td>
+ <input type="submit" value="OK" class="button">
+ </td>
+ </tr>
+ </table>
+</form>
+
+<form method="post">
+<input type="hidden" name="markseen" value="1">
+<input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+<input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+<input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+<input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+<input type="hidden" name="offset" value="<!-- TMPL_VAR name="offset" -->">
+<!-- TMPL_IF name="loop" -->
+<table width="100%">
+ <tr>
+ <th>Vu</th>
+ <th>Code barre</th>
+ <th>en gros</th>
+ <th>Titre</th>
+ <th>Auteur</th>
+ </tr>
+<!-- TMPL_LOOP name="loop" -->
+ <tr>
+ <td>
+ <input type="checkbox" name="SEEN-<!-- TMPL_VAR name="itemnumber" -->" value="1">
+ </td>
+ <td>
+ <!-- TMPL_VAR name="barcode" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="bulk" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="title" -->
+ </td>
+ <td>
+ <!-- TMPL_VAR name="author" -->
+ </td>
+ </tr>
+<!-- /TMPL_LOOP -->
+</table>
+<input type="submit" value="Not� vu" class="button">
+</form>
+<!-- /TMPL_IF -->
+
+<table>
+<tr>
+ <td>
+ <!-- TMPL_IF name="offset" -->
+ <form method="post">
+ <input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+ <input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ <input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ <input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <input type="hidden" name="offset" value="<!-- TMPL_VAR name="prevoffset" -->">
+ <input type="submit" value="&lt;&lt;&lt;" class="button">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+ <td>
+ <!-- TMPL_IF name="nextoffset" -->
+ <form method="post">
+ <input type="hidden" name="minlocation" value="<!-- TMPL_VAR name="minlocation" -->">
+ <input type="hidden" name="maxlocation" value="<!-- TMPL_VAR name="maxlocation" -->">
+ <input type="hidden" name="datelastseen" value="<!-- TMPL_VAR name="datelastseen" -->">
+ <input type="hidden" name="pagesize" value="<!-- TMPL_VAR name="pagesize" -->">
+ <input type="hidden" name="offset" value="<!-- TMPL_VAR name="nextoffset" -->">
+ <input type="submit" value="&gt;&gt;&gt;" class="button">
+ </form>
+ <!-- /TMPL_IF -->
+ </td>
+</tr>
+</table>
+<!-- TMPL_INCLUDE NAME="reports-bottom.inc" -->
@@ -1,16 +1,12 @@
<!-- TMPL_INCLUDE NAME="reports-top.inc" -->
<!-------------------------MAIN BODY OF PAGE-------------------------->
-<h1>Rapports</h1><br>
-
-
-
-
-<ul><li><a href=/cgi-bin/koha/stats.pl?time=yesterday>Jusqu'� la r�conciliation:</a> Rapport quotidien (hier)
-<li><a href=/cgi-bin/koha/stats.pl?time=today>Jusqu'� la r�conciliation:</a> Rapport quotidien (aujourd'hui)
-<li><a href=/cgi-bin/koha/overdue.pl>Ouvrages en retard</a>
-
-
+<h1>Rapports</h1><br/>
+<ul>
+ <li><a href="/cgi-bin/koha/stats.pl?time=yesterday">Jusqu'� la r�conciliation:</a> Rapport quotidien (hier)</li>
+ <li><a href="/cgi-bin/koha/stats.pl?time=today">Jusqu'� la r�conciliation:</a> Rapport quotidien (aujourd'hui)</li>
+ <li><a href="/cgi-bin/koha/overdue.pl">Ouvrages en retard</a></li>
+ <li><a href="/cgi-bin/koha/reports/inventory.pl">R�colement</a></li>
</ul>
<!-- TMPL_INCLUDE NAME="reports-bottom.inc" -->
Oops, something went wrong. Retry.

0 comments on commit 58951e5

Please sign in to comment.