moredetail.pl presents circulation information taken from the
[koha.git] / moredetail.pl
1 #!/usr/bin/perl
2
3 #script to display detailed information
4 #written 8/11/99
5
6 use strict;
7 #use DBI;
8 use C4::Search;
9 use C4::Koha;
10 use C4::Output;
11 use C4::Acquisitions;
12
13 use CGI;
14 my $input = new CGI;
15 print $input->header;
16 #whether it is called from the opac of the intranet
17 my $type=$input->param('type');
18 #setup colours
19 my $main;
20 my $secondary;
21 if ($type eq 'opac'){
22   $main='#99cccc';
23   $secondary='#efe5ef';
24 } else {
25   $main='#cccc99';
26   $secondary='#ffffcc';
27 }
28 print startpage();
29 print startmenu($type);
30 my $blah;
31
32 my $bib=$input->param('bib');
33 my $title=$input->param('title');
34 my $bi=$input->param('bi');
35 my $data=bibitemdata($bi);
36
37 my (@items)=itemissues($bi);
38 my ($order,$ordernum)=getorder($bi,$bib);
39 #print @items;
40 my $count=@items;
41
42 my $i=0;
43 print center();
44
45 my $dewey = $data->{'dewey'};                                                  
46 $dewey =~ s/0+$//;                                                             
47 if ($dewey eq "000.") { $dewey = "";};                                         
48 if ($dewey < 10){$dewey='00'.$dewey;}                                          
49 if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}                           
50 if ($dewey <= 0){
51   $dewey='';                                                                   
52 }               
53 $dewey=~ s/\.$//;
54 print <<printend
55 <br>
56 <a href=/cgi-bin/koha/request.pl?bib=$bib><img src=/images/requests.gif width=120 height=42 border=0 align=right border=0></a>
57 printend
58 ;
59 if ($type eq 'catmain'){
60   print "<FONT SIZE=6><em>Catalogue Maintenance</em></FONT><br>";
61 }
62 print <<printend
63 <FONT SIZE=6><em><a href=/cgi-bin/koha/detail.pl?bib=$bib&type=intra>$data->{'title'} ($data->{'author'})</a></em></FONT><P>
64 <p>
65 <form action=/cgi-bin/koha/modbibitem.pl>
66 <input type=hidden name=bibitem value=$bi>
67 <input type=hidden name=biblio value=$bib>
68 <!-------------------BIBLIO ITEM------------>
69 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left>
70 <TR VALIGN=TOP>
71 <td  bgcolor="99cc33" background="/images/background-mem.gif" ><B>$data->{'biblioitemnumber'} GROUP - $data->{'description'} </b> </TD>
72 </TR>
73 <tr VALIGN=TOP  >
74 <TD width=210 >
75 <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif"> 
76 <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
77 <br>
78 <FONT SIZE=2  face="arial, helvetica">
79 <b>Biblionumber:</b> $bib<br>
80 <b>Item Type:</b> $data->{'itemtype'}<br>
81 <b>Loan Length:</b> $data->{'loanlength'}<br>
82 <b>Rental Charge:</b> $data->{'rentalcharge'}<br>
83 <b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
84 <b>ISBN:</b> $data->{'isbn'}<br>
85 <b>Publisher:</b> $data->{'publishercode'} <br>
86 <b>Place:</b> $data->{'place'}<br>
87 <b>Date:</b> $data->{'publicationyear'}<br>
88 <b>Volume:</b> $data->{'volumeddesc'}<br>
89 <b>Pages:</b> $data->{'pages'}<br>
90 <b>Illus:</b> $data->{'illus'}<br>
91 <b>Size:</b> $data->{'size'}<br>
92 <b>Notes:</b> $data->{'bnotes'}<br>
93 <b>No. of Items:</b> $count
94
95 printend
96 ;
97 if ($type eq 'catmain'){
98   print "<br><a href=/cgi-bin/koha/maint/shiftbib.pl?bi=$data->{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift to another biblio</a>";
99  
100 }
101 print <<printend
102
103 </font>
104 </TD>
105 </tr>
106 </table>
107 </form>
108 printend
109 ;
110
111 for (my $i=0;$i<$count;$i++){
112 print <<printend
113 <img src="/images/holder.gif" width=16 height=300 align=left>
114 <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width=220 >                            
115 <TR VALIGN=TOP>
116 <td  bgcolor="99cc33" background="/images/background-mem.gif"><B>BARCODE $items[$i]->{'barcode'}</b></TD>
117 </TR>
118 <tr VALIGN=TOP  >
119 <TD width=220 >
120 <form action=/cgi-bin/koha/moditem.pl method=post>
121 <input type=hidden name=bibitem value=$bi>
122 <input type=hidden name=item value=$items[$i]->{'itemnumber'}>
123 <input type=hidden name=type value=$type>
124 <INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 src="/images/modify-mem.gif"> 
125 <INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 src="/images/delete-mem.gif"> 
126 <br>
127 printend
128 ;
129 $items[$i]->{'itemlost'}=~ s/0/No/;
130 $items[$i]->{'itemlost'}=~ s/1/Yes/;
131 $items[$i]->{'withdrawn'}=~ s/0/No/;
132 $items[$i]->{'withdrawn'}=~ s/1/Yes/;
133 $items[$i]->{'replacementprice'}+=0.00;
134
135 my $year=substr($items[$i]->{'timestamp0'},0,4);
136 my $mon=substr($items[$i]->{'timestamp0'},4,2);
137 my $day=substr($items[$i]->{'timestamp0'},6,2);
138 $items[$i]->{'timestamp0'}="$day/$mon/$year";
139
140 $items[$i]->{'dateaccessioned'} = slashifyDate($items[$i]->{'dateaccessioned'});
141 $items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});
142
143 print <<printend
144 <FONT SIZE=2  face="arial, helvetica">
145 <b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
146 <b>Last seen:</b> $items[$i]->{'datelastseen'}<br>
147 <b>Last borrowed:</b> $items[$i]->{'timestamp0'}<br>
148 printend
149 ;
150 if ($items[$i] eq 'Available'){
151   print "<b>Currently on issue to:</b><br>";
152 } else {
153   print "<b>Currently on issue to:</b> <a href=/cgi-bin/koha/moremember.pl?bornum=$items[$i]->{'borrower0'}>$items[$i]->{'card'}</a><br>";
154 }
155 print <<printend
156 <b>Last Borrower 1:</b> $items[$i]->{'card0'}<br>
157 <b>Last Borrower 2:</b> $items[$i]->{'card1'}<br>
158 <b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
159 <b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
160 <b>Item lost:</b> $items[$i]->{'itemlost'}<br>
161 <b>Paid for:</b> $items[$i]->{'paidfor'}<br>
162 <b>Notes:</b> $items[$i]->{'itemnotes'}<br>
163 <b>Renewals:</b> $items[$i]->{'renewals'}<br>
164 <b><a href=/cgi-bin/koha/acqui/acquire.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a> Date: $items[$i]->{'dateaccessioned'}<br>
165 printend
166 ;
167 if ($items[$i]->{'wthdrawn'} eq '1'){
168   $items[$i]->{'wthdrawn'}="Yes";
169 } else {
170   $items[$i]->{'wthdrawn'}="No";
171 }
172 print <<printend
173 <b>Cancelled: $items[$i]->{'wthdrawn'}<br>
174 <b><a href=/cgi-bin/koha/bookcount.pl?&bib=$bib&bi=$bi&itm=$items[$i]->{'itemnumber'}>Total Issues:</a></b> $items[$i]->{'issues'}<br>
175 <b>Group Number:</b> $bi <br>
176 <b>Biblio number:</b> $bib <br>
177
178
179
180 </font>
181 </TD>
182 </tr>
183 </table>
184 </form>
185 printend
186 ;
187 }
188 print <<printend
189 <p>
190 </form>
191 printend
192 ;
193
194
195 print endcenter();
196
197 print endmenu($type);
198 print endpage();