[Koha-cvs] CVS: koha/acqui addorder.pl,1.12,1.13 basket.pl,1.6,1.7 modorders.pl,1.4,1.5 newbasket2.pl,1.10,1.11 newbiblio.pl,1.10,1.11 order.pl,1.6,1.7 receive.pl,1.6,1.7 recieveorder.pl,1.5,1.6

Paul POULAIN tipaul at users.sourceforge.net
Thu Feb 13 18:28:00 CET 2003


Update of /cvsroot/koha/koha/acqui
In directory sc8-pr-cvs1:/tmp/cvs-serv13800/acqui

Modified Files:
	addorder.pl basket.pl modorders.pl newbasket2.pl newbiblio.pl 
	order.pl receive.pl recieveorder.pl 
Log Message:
Road to 1.9.1
* templating of normal acquisitions
* some graphic changes (use of yellow color as "acquisition/cataloguin" symbol, header consistency...)
* minor reordering of screens (newbasket.pl now unused)
* few bugfixes

When templating finished, the recieving of a book will be ended by a "calatoguing" screen.
Cataloguing will be MARC cataloguing or non-MARC cataloguing, depending on "acquisitions" system parameter.


Index: addorder.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/addorder.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** addorder.pl	28 Jan 2003 15:02:39 -0000	1.12
--- addorder.pl	13 Feb 2003 17:27:47 -0000	1.13
***************
*** 99,101 ****
  }
  
! print $input->redirect("newbasket.pl?id=$supplier&basket=$basketno");
--- 99,101 ----
  }
  
! print $input->redirect("basket.pl?basket=$basketno");

Index: basket.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/basket.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** basket.pl	13 Oct 2002 07:37:21 -0000	1.6
--- basket.pl	13 Feb 2003 17:27:49 -0000	1.7
***************
*** 24,76 ****
  # Suite 330, Boston, MA  02111-1307 USA
  
  use C4::Catalogue;
  use C4::Biblio;
  use C4::Output;
  use CGI;
  use strict;
  
! my $input=new CGI;
! print $input->header();
! my $basket=$input->param('basket');
! my ($count, at results)=basket($basket);
! print startpage;
! 
! my @inp=startmenu('acquisitions');
! 
! my $count3=@inp;
! for (my $i=0;$i<$count3;$i++){
!       $inp[$i]=~ s/leftmargin=0 topmargin=0\>/leftmargin=0 topmargin=0 onload='update(orderform)'\>/;
!     }
! print @inp;
! # print $count;
! my ($count2, at booksellers)=bookseller($results[0]->{'booksellerid'});
! 
! print <<printend
! <div align=right>
! Our Reference: $basket<br>
! Authorised By: $results[0]->{'authorisedby'}<br>
! $results[0]->{'entrydate'};
! </div>
! <FONT SIZE=6><em>Shopping Basket For: <a href=supplier.pl?id=$results[0]->{'booksellerid'}></a> $booksellers[0]->{'name'}</em></FONT>
! <a href=newbasket.pl?id=$results[0]->{'booksellerid'}&basket=$basket>Add more orders</a>
! <CENTER>
! <FORM ACTION="/cgi-bin/koha/search.pl" method=post>
!  <b>Search ISBN, Title or Author:</b> <INPUT TYPE="text"  SIZE="25"   NAME="recieve">
! </form>
! <p>
! <FORM ACTION="/cgi-bin/koha/acqui/modorders.pl" method=post name=orderform>
! <table border=0 cellspacing=0 cellpadding=5>
! <tr valign=top bgcolor=#99cc33>
!   <td background="/images/background-mem.gif"><b>ORDER</b></td>
!   <td background="/images/background-mem.gif"><b>ISBN</b></td>
!   <td background="/images/background-mem.gif"><b>TITLE</b></td>
!   <td background="/images/background-mem.gif"><b>AUTHOR</b></td>
!   <td background="/images/background-mem.gif"><b>RRP</b></td>
!   <td background="/images/background-mem.gif"><b>\$EST</b></td>
!   <td background="/images/background-mem.gif"><b>QUANTITY</b></td>
!   <td background="/images/background-mem.gif"><b>TOTAL</b></td></tr>
! printend
! ;
  
  
  my $line_total; # total of each line
--- 24,59 ----
  # Suite 330, Boston, MA  02111-1307 USA
  
+ use C4::Auth;
  use C4::Catalogue;
  use C4::Biblio;
  use C4::Output;
  use CGI;
+ use C4::Interface::CGI::Output;
+ use C4::Database;
+ use HTML::Template;
+ use C4::Catalogue;
  use strict;
  
! my $query =new CGI;
! my $basket=$query ->param('basket');
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "acqui/basket.tmpl",
! 			     query => $query,
! 			     type => "intranet",
! 			     authnotrequired => 0,
! 			     flagsrequired => {acquisition => 1},
! 			     debug => 1,
! 			     });
! 
! my ($count, at results);
! if ($basket eq ''){
! 	$basket=newbasket();
! 	$results[0]->{'booksellerid'}=$query->param('id');
! 	$results[0]->{'authorisedby'} = $loggedinuser;
! } else {
! 	($count, at results)=basket($basket);
! }
  
+ my ($count2, at booksellers)=bookseller($results[0]->{'booksellerid'});
  
  my $line_total; # total of each line
***************
*** 78,139 ****
  my $gist;      # GST
  my $grand_total; # $subttotal + $gist
  
  for (my $i=0;$i<$count;$i++){
! my $rrp=$results[$i]->{'listprice'};
! if ($results[$i]->{'currency'} ne 'NZD'){
! $rrp=curconvert($results[$i]->{'currency'},$rrp);
! }
  
! $line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
! $sub_total+=$line_total;
! $gist=sprintf("%.2f",$sub_total*0.125);
! $grand_total=$sub_total+$gist;
! 
! print <<EOP
! <tr valign=top bgcolor=#ffffcc>
!   <td>$results[$i]->{'ordernumber'}</td>
!   <td>$results[$i]->{'isbn'}</td>
!   <td><a href="newbiblio.pl?ordnum=$results[$i]->{'ordernumber'}&id=$results[$i]->{'booksellerid'}&basket=$basket">$results[$i]->{'title'}</a></td>
!   <td>$results[$i]->{'author'}</td>
!   <td>\$<input type=text name=rrp$i size=6 value="$results[$i]->{'rrp'}"></td>
!   <td>\$<input type=text name=eup$i size=6 value="$results[$i]->{'ecost'}"></td>
!   <td><input type=text name=quantity$i size=6 value=$results[$i]->{'quantity'} onchange='update(this.form)'></td>
!   <td>\$<input type=text name=total$i size=10 value=$line_total></td>
!   <input type=hidden name=ordnum$i value=$results[$i]->{'ordernumber'}>
!   <input type=hidden name=bibnum$i value=$results[$i]->{'biblionumber'}>
! </tr>
! EOP
! ;
  }
! #
! print "<input type=hidden name=number value=$count>
! <input type=hidden name=basketno value=\"$basket\">";
! print <<EOP
! <tr valign=top bgcolor=white><td colspan=6 rowspan=3  bgcolor=#cccc99  background="/images/background-mem.gif">
!   <b>HELP</b><br>
!   To cancel an order, just change the quantity to 0 and click "save changes".<br>
!   To change any of the catalogue or accounting information attached to an order,  click on the title.<br>
!   To add new orders to this supplier, start with a search. </td>
!   <td><b>SubTotal</b></td>
!   <td>\$<input type=text name=subtotal size=10 value=$sub_total></td></tr>
! <tr valign=top bgcolor=white>
!   <td><b>GST</b></td>
!   <td>\$<input type=text name=gst size=10 value=$gist></td></tr>
! <tr valign=top bgcolor=white><td><b>TOTAL</b></td>
!   <td>\$<input type=text name=grandtotal size=10 value=$grand_total></td></tr>
! <tr valign=top bgcolor=white>
!   <td></td>
!   <td></td>
!   <td></td>
!   <td></td>
!   <td></td>
!   <td></td>
!   <td colspan=3><input type=image  name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right></td></tr>
! </table>
! </CENTER>
! EOP
!   ;
! 
! print endmenu('acquisitions');
! 
! print endpage;
--- 61,107 ----
  my $gist;      # GST
  my $grand_total; # $subttotal + $gist
+ my $toggle=0;
  
+ my @books_loop;
  for (my $i=0;$i<$count;$i++){
! 	my $rrp=$results[$i]->{'listprice'};
! 	$rrp=curconvert($results[$i]->{'currency'},$rrp);
  
! 	$line_total=$results[$i]->{'quantity'}*$results[$i]->{'ecost'};
! 	$sub_total+=$line_total;
! 	$gist=sprintf("%.2f",$sub_total*0.125);
! 	$grand_total=$sub_total+$gist;
! 	my %line;
! 	if ($toggle==0){
! 		$line{color}='#ffffcc';
! 		$toggle=1;
! 	} else {
! 		$line{color}='white';
! 		$toggle=0;
! 	}
! 	$line{ordernumber} = $results[$i]->{'ordernumber'};
! 	$line{isbn} = $results[$i]->{'isbn'};
! 	$line{booksellerid} = $results[$i]->{'booksellerid'};
! 	$line{basket}=$basket;
! 	$line{title} = $results[$i]->{'title'};
! 	$line{author} = $results[$i]->{'author'};
! 	$line{i} = $i;
! 	$line{rrp} = $results[$i]->{'rrp'};
! 	$line{ecost} = $results[$i]->{'ecost'};
! 	$line{quantity} = $results[$i]->{'quantity'};
! 	$line{line_total} = $line_total;
! 	$line{biblionumber} = $results[$i]->{'biblionumber'};
! 	push @books_loop, \%line;
  }
! $template->param(basket => $basket,
! 						authorisedby => $results[0]->{'authorisedby'},
! 						entrydate =>$results[0]->{'entrydate'},
! 						id=> $results[0]->{'booksellerid'},
! 						name => $booksellers[0]->{'name'},
! 						books_loop => \@books_loop,
! 						count =>$count,
! 						subtotal => $sub_total,
! 						gist => $gist,
! 						grand_total =>$grand_total,
! 						);
! output_html_with_http_headers $query, $cookie, $template->output;

Index: modorders.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/modorders.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** modorders.pl	14 Aug 2002 18:12:52 -0000	1.4
--- modorders.pl	13 Feb 2003 17:27:50 -0000	1.5
***************
*** 27,49 ****
  use C4::Catalogue;
  use C4::Biblio;
- #use Date::Manip;
  
  my $input = new CGI;
- #print $input->header;
- #print startpage();
- #print startmenu('acquisitions');
- #print $input->Dump;
  my $basketno=$input->param('basketno');
  my $count=$input->param('number');
  for (my $i=0;$i<$count;$i++){
!   my  $bibnum=$input->param("bibnum$i");
!   my $ordnum=$input->param("ordnum$i");
!   my $quantity=$input->param("quantity$i");
!   if ($quantity == 0){
!     delorder($bibnum,$ordnum);
!   }
  }
  print $input->redirect("basket.pl?basket=$basketno");
- #print $input->dump;
- #print endmenu('acquisitions');
- #print endpage();
--- 27,41 ----
  use C4::Catalogue;
  use C4::Biblio;
  
  my $input = new CGI;
  my $basketno=$input->param('basketno');
  my $count=$input->param('number');
  for (my $i=0;$i<$count;$i++){
! 	my  $bibnum=$input->param("bibnum$i");
! 	my $ordnum=$input->param("ordnum$i");
! 	my $quantity=$input->param("quantity$i");
! 	if ($quantity == 0){
! 		delorder($bibnum,$ordnum);
! 	}
  }
  print $input->redirect("basket.pl?basket=$basketno");

Index: newbasket2.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/newbasket2.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** newbasket2.pl	2 Feb 2003 07:18:37 -0000	1.10
--- newbasket2.pl	13 Feb 2003 17:27:50 -0000	1.11
***************
*** 41,50 ****
    $type = 'intra';
  }
- #setup colours
- my $main;
- my $secondary;
-   $main='#cccc99';
-   $secondary='#ffffcc';
- 
  
  #print $input->dump;
--- 41,44 ----
***************
*** 132,136 ****
  while ($i < $count2){
  		my %lineres;
! 		my $coltab;
  
  	my $result=$results[$i];
--- 126,130 ----
  while ($i < $count2){
  		my %lineres;
! 		my $toggle;
  
  	my $result=$results[$i];
***************
*** 146,213 ****
  	my $location='';
  	my $word=$result->{'author'};
! 		$word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
! 		$word=~ s/  //g;
! 		$word=~ s/ /%20/g;
! 		$word=~ s/\,/\,%20/g;
! 		$word=~ s/\n//g;
! 		$lineres{word}=$word;
! 		$lineres{type}=$type;
! 
! 		my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
! 		if ($nacount > 0){
! 			$location .= "On Loan";
! 			if ($nacount >1 ){
! 				$location .= " ($nacount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($lcount > 0){
! 			$location .= "Levin";
! 			if ($lcount >1 ){
! 				$location .= " ($lcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($fcount > 0){
! 			$location .= "Foxton";
! 			if ($fcount >1 ){
! 				$location .= " ($fcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($scount > 0){
! 			$location .= "Shannon";
! 			if ($scount >1 ){
! 				$location .= " ($scount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($lostcount > 0){
! 			$location .= "Lost";
! 			if ($lostcount >1 ){
! 				$location .= " ($lostcount)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($mending > 0){
! 			$location .= "Mending";
! 			if ($mending >1 ){
! 				$location .= " ($mending)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($transit > 0){
! 			$location .= "In Transit";
! 			if ($transit >1 ){
! 				$location .= " ($transit)";
! 			}
! 			$location.=" ";
! 		}
! 		if ($colour == 1){
! 			$coltab=$secondary;
! 			$colour=0;
  	} else{
! 			$coltab=$main;
! 			$colour=1;
  	}
  	$lineres{author2}=$author2;
--- 140,207 ----
  	my $location='';
  	my $word=$result->{'author'};
! 	$word=~ s/([a-z]) +([a-z])/$1%20$2/ig;
! 	$word=~ s/  //g;
! 	$word=~ s/ /%20/g;
! 	$word=~ s/\,/\,%20/g;
! 	$word=~ s/\n//g;
! 	$lineres{word}=$word;
! 	$lineres{type}=$type;
! 
! 	my ($count,$lcount,$nacount,$fcount,$scount,$lostcount,$mending,$transit)=C4::Search::itemcount($env,$result->{'biblionumber'},$type);
! 	if ($nacount > 0){
! 		$location .= "On Loan";
! 		if ($nacount >1 ){
! 			$location .= " ($nacount)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($lcount > 0){
! 		$location .= "Levin";
! 		if ($lcount >1 ){
! 			$location .= " ($lcount)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($fcount > 0){
! 		$location .= "Foxton";
! 		if ($fcount >1 ){
! 			$location .= " ($fcount)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($scount > 0){
! 		$location .= "Shannon";
! 		if ($scount >1 ){
! 			$location .= " ($scount)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($lostcount > 0){
! 		$location .= "Lost";
! 		if ($lostcount >1 ){
! 			$location .= " ($lostcount)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($mending > 0){
! 		$location .= "Mending";
! 		if ($mending >1 ){
! 			$location .= " ($mending)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($transit > 0){
! 		$location .= "In Transit";
! 		if ($transit >1 ){
! 			$location .= " ($transit)";
! 		}
! 		$location.=" ";
! 	}
! 	if ($colour == 1){
! 		$toggle='#ffffcc';
! 		$colour = 0;
  	} else{
! 		$colour = 1;
! 		$toggle='white';
  	}
  	$lineres{author2}=$author2;
***************
*** 220,224 ****
  	$lineres{title}=$result->{title};
  	$lineres{author}=$result->{author};
! 	$lineres{coltab}=$coltab;
  	$lineres{itemcount}=$count;
  	$lineres{location}=$location;
--- 214,218 ----
  	$lineres{title}=$result->{title};
  	$lineres{author}=$result->{author};
! 	$lineres{toggle}=$toggle;
  	$lineres{itemcount}=$count;
  	$lineres{location}=$location;

Index: newbiblio.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/newbiblio.pl,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** newbiblio.pl	6 Feb 2003 06:35:26 -0000	1.10
--- newbiblio.pl	13 Feb 2003 17:27:51 -0000	1.11
***************
*** 29,35 ****
  use C4::Output;
  use C4::Search;
  
  my $input=new CGI;
! print $input->header();
  my $id=$input->param('id');
  my $title=$input->param('title');
--- 29,41 ----
  use C4::Output;
  use C4::Search;
+ use C4::Auth;
+ use C4::Biblio;
+ use C4::Output;
+ use C4::Interface::CGI::Output;
+ use C4::Database;
+ use HTML::Template;
  
  my $input=new CGI;
! #print $input->header();
  my $id=$input->param('id');
  my $title=$input->param('title');
***************
*** 39,343 ****
  my $ordnum=$input->param('ordnum');
  my $biblio=$input->param('biblio');
  my $data;
  my $new;
  if ($ordnum eq ''){
!   $new='yes';
!   $ordnum=newordernum;
!   if ($biblio) {
!   		$data=bibdata($biblio);
  	}
-   if ($data->{'title'} eq ''){
-     $data->{'title'}=$title;
-     $data->{'author'}=$author;
-     $data->{'copyrightdate'}=$copyright;
-   }
  }else {
!   $data=getsingleorder($ordnum);
!   $biblio=$data->{'biblionumber'};
! }
! 
! print startpage;
! 
! print startmenu('acquisitions');
! 
! 
! my $basket=$input->param('basket');
! print <<printend
! 
! 
! <script language="javascript" type="text/javascript">
! 
! <!--
! 
! function update(f){
!   //collect values
!   quantity=f.quantity.value
!   discount=f.discount.value
!   listinc=parseInt(f.listinc.value)
!   currency=f.currency.value
!   applygst=parseInt(f.applygst.value)
!   listprice=f.list_price.value
!   //  rrp=f.rrp.value
!   //  ecost=f.ecost.value  //budgetted cost
!   //  GST=f.GST.value
!   //  total=f.total.value
!   //make useful constants out of the above
!   exchangerate=f.elements[currency].value      //get exchange rate
!   gst_on=(!listinc && applygst);
!   //do real stuff
!   rrp=listprice*exchangerate;
!   ecost=rrp*(100-discount)/100
!   GST=0;
!   if (gst_on){
!     rrp=rrp*1.125;
!     GST=ecost*0.125
!   }
! 
!   total=(ecost+GST)*quantity
! 
! 
!   f.rrp.value=display(rrp)
!   f.ecost.value=display(ecost)
!   f.GST.value=display(GST)
!   f.total.value=display(total)
! 
! }
! 
! 
! 
! function messenger(X,Y,etc){
! win=window.open("","mess","height="+X+",width="+Y+",screenX=150,screenY=0");
! win.focus();
! win.document.close();
! win.document.write("<body link='#333333' bgcolor='#ffffff' text='#000000'><font size=2><p><br>");
! win.document.write(etc);
! win.document.write("<center><form><input type=button onclick='self.close()' value=Close></form></center>");
! win.document.write("</font></body></html>");
! }
! //-->
! 
! </script>
! <form action=/cgi-bin/koha/acqui/addorder.pl method=post name=frusin>
! printend
! ;
! 
! if ($biblio eq ''){
!   print "<input type=hidden name=existing value=no>";
! }
! 
! print <<printend
! <!--$title-->
! <input type=hidden name=ordnum value=$ordnum>
! <input type=hidden name=basket value=$basket>
! <input type=hidden name=supplier value=$id>
! <input type=hidden name=biblio value=$biblio>
! <input type=hidden name=bibitemnum value=$data->{'biblioitemnumber'}>
! <input type=hidden name=oldtype value=$data->{'itemtype'}>
! <input type=hidden name=discount value=$booksellers[0]->{'discount'}>
! <input type=hidden name=listinc value=$booksellers[0]->{'listincgst'}>
! <input type=hidden name=currency value=$booksellers[0]->{'listprice'}>
! <input type=hidden name=applygst value=$booksellers[0]->{'gstreg'}>
! printend
! ;
! my ($count2,$currencies)=getcurrencies;
! for (my $i=0;$i<$count2;$i++){
!   print "<input type=hidden name=\"$currencies->[$i]->{'currency'}\" value=$currencies->[0]->{'rate'}>\n";
  }
! if ($new ne 'yes'){
!   print "<input type=hidden name=orderexists value=yes>\n";
  }
- print <<printend
- <a href=basket.pl?basket=$basket><img src=/images/view-basket.gif width=187 heigth=42 border=0 align=right alt="View Basket"></a>
- <FONT SIZE=6><em>$ordnum - Order Details </em></FONT><br>
- Shopping Basket For: $booksellers[0]->{'name'}
- <P>
- <CENTER>
- <TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width="40%">
- <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>CATALOGUE DETAILS</B></td></tr>
- <TR VALIGN=TOP>
- <TD><b>Title *</b></td>
- <td><input type=text size=20 name=title value="$data->{'title'}">
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>Author</td>
- <td><input type=text size=20 name=author value="$data->{'author'}" >
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>Copyright Date</td>
- <td><input type=text size=20 name=copyright value="$data->{'copyrightdate'}">
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>Format</td>
- <td>
- <select name=format size=1>
- printend
- ;
  
- my $dbh = C4::Context->dbh;
  my $query="Select itemtype,description from itemtypes order by description";
  my $sth=$dbh->prepare($query);
  $sth->execute;
! print "<option value=\"\">Please choose:\n";
! while (my $data2=$sth->fetchrow_hashref){
! 	if ($data2->{'itemtype'} eq $data->{'itemtype'}) {
!   		print "<option value=\"" . $data2->{'itemtype'} . "\" SELECTED>" . $data2->{'description'} . "\n";
! 	} else {
!   		print "<option value=\"" . $data2->{'itemtype'} . "\">" . $data2->{'description'} . "\n";
! 	}
  }
- $sth->finish;
- 
- print <<printend
- </select>
- 
  
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD>ISBN</td>
! <td><input type=text size=20 name=ISBN value=$data->{'isbn'}>
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD>Series</td>
! <td><input type=text size=20 name=Series value="$data->{'seriestitle'}">
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD>Branch</td>
! <td><select name=branch size=1>
! printend
! ;
  my @branches;
! ($count2, at branches)=branches();
  for (my $i=0;$i<$count2;$i++){
!   print "<option value=$branches[$i]->{'branchcode'}";
!   if ($data->{'branchcode'} == $branches[$i]->{'branchcode'}){
!     print " Selected";
!   }
!   print ">$branches[$i]->{'branchname'}";
  }
! 
! print <<printend
! </select>
! </td>
! </tr>
! <TR VALIGN=TOP  bgcolor=#ffffcc>
! <TD >Item Barcode</td>
! <td><input type=text size=20 name=barcode value=
! printend
! ;
  
  my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
  	# See whether barcodes should be automatically allocated.
  	# Defaults to 0, meaning "no".
  if ($auto_barcode eq '1') {
!   my $dbh = C4::Context->dbh;
!   my $query="Select barcode from items order by barcode desc";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   my $data=$sth->fetchrow_hashref;
!   print $data->{'barcode'}+1;
!   $sth->finish;
  }
  
- print <<printend
- >
- </td>
- </tr>
- </table>
- <img src="/images/holder.gif" width=32 height=250 align=left>
- <table border=1 cellspacing=0 cellpadding=5 width="40%">
- <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>ACCOUNTING DETAILS</B></td></tr>
- <TR VALIGN=TOP>
- <TD>Quantity</td>
- <td><input type=text size=20 name=quantity value="$data->{'quantity'}" onchange='update(this.form)' >
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>Bookfund</td>
- <td><select name=bookfund size=1>
- printend
- ;
- 
  my @bookfund;
  ($count2, at bookfund)=bookfunds();
  for (my $i=0;$i<$count2;$i++){
!   print "<option value=$bookfund[$i]->{'bookfundid'}";
!   if ($data->{'bookfundid'} == $bookfund[$i]->{'bookfundid'}){
!     print " Selected";
!   }
!   print ">$bookfund[$i]->{'bookfundname'}";
  }
  
! print <<printend
! </select>
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD>Suppliers List Price</td>
! <td><input type=text size=20 name=list_price value="$data->{'listprice'}" onchange='update(this.form)'>
! </tr>
! <TR VALIGN=TOP>
! <TD>Replacement Cost <br>
! <FONT SIZE=2>(NZ\$ inc GST)</td>
! <td><input type=text size=20 name=rrp value="$data->{'rrp'}" onchange='update(this.form)'>
! </tr>
! <TR VALIGN=TOP>
! <TD>
! Budgeted Cost<BR>
! <FONT SIZE=2>(NZ\$ ex GST, inc discount)</FONT> </td>
! <td><input type=text size=20 name=ecost value="$data->{'ecost'}" onchange='update(this.form)'>
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD>
! Budgeted GST</td>
! <td><input type=text size=20 name=GST value="" onchange='update(this.form)'>
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD><B>
! BUDGETED TOTAL</B></td>
! <td><input type=text size=20 name=total value="" onchange='update(this.form)'>
! </td>
! </tr>
! <TR VALIGN=TOP  bgcolor=#ffffcc>
! <TD>Actual Cost</td>
! <td><input type=text size=20 name=cost>
! </td>
! </tr>
! <TR VALIGN=TOP  bgcolor=#ffffcc>
! <TD>Invoice Number *</td>
! <td><input type=text size=20 name=invoice >
! <TR VALIGN=TOP>
! <TD>Notes</td>
! <td><input type=text size=20 name=notes value="$data->{'notes'}">
! </td>
! </tr>
! <TR VALIGN=TOP>
! <TD colspan=2>
! <input type=image  name=submit src=/images/add-order.gif border=0 width=187 height=42 align=right>
! </td>
! </tr>
! </table>
! </form>
! </center>
! <table>
! <tr><td bgcolor=#cccc99  background="/images/background-mem.gif"><B>HELP</B><br>
! <UL>
! <LI>If ordering more than one copy of an item you will be prompted to  choose additional bookfunds, and put in additional barcodes at the next screen<P>
! <LI><B>Bold</B> fields must be filled in to create a new bibilo and item.<p>
! <LI>Shaded fields can be used to do a "quick" receive, when items have been purchased locally or gifted. In this case the quantity "ordered" will also  be entered into the database as the quantity received.
! </UL>
! </td></tr></table>
! <p> &nbsp; </p>
! printend
! ;
! 
! print endmenu('acquisitions');
  
- print endpage;
--- 45,179 ----
  my $ordnum=$input->param('ordnum');
  my $biblio=$input->param('biblio');
+ my $basket=$input->param('basket');
  my $data;
  my $new;
+ my $dbh = C4::Context->dbh;
  if ($ordnum eq ''){
! 	$new='yes';
! 	warn "NEW : YES";
! 	$ordnum=newordernum;
! 	if ($biblio) {
! 			$data=bibdata($biblio);
! 	}
! 	if ($data->{'title'} eq ''){
! 		$data->{'title'}=$title;
! 		$data->{'author'}=$author;
! 		$data->{'copyrightdate'}=$copyright;
  	}
  }else {
! 	$data=getsingleorder($ordnum);
! 	$biblio=$data->{'biblionumber'};
  }
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "acqui/newbiblio.tmpl",
! 			     query => $input,
! 			     type => "intranet",
! 			     authnotrequired => 0,
! 			     flagsrequired => {acquisition => 1},
! 			     debug => 1,
! 			     });
! 
! #my ($count2,$currencies)=getcurrencies;
! my ($count,$rates)=getcurrencies();
! my @loop_currency = ();
! for (my $i=0;$i<$count;$i++){
! 	my %line;
! 	$line{currency} = $rates->[$i]->{'currency'};
! 	$line{rate} = $rates->[$i]->{'rate'};
! 	push @loop_currency, \%line;
  }
  
  my $query="Select itemtype,description from itemtypes order by description";
  my $sth=$dbh->prepare($query);
  $sth->execute;
! my  @itemtype;
! my %itemtypes;
! push @itemtype, "";
! $itemtypes{''} = "Please choose";
! while (my ($value,$lib) = $sth->fetchrow_array) {
! 	push @itemtype, $value;
! 	$itemtypes{$value}=$lib;
  }
  
! my $CGIitemtype=CGI::scrolling_list( -name     => 'format',
! 			-values   => \@itemtype,
! 			-default  => $data->{'itemtype'},
! 			-labels   => \%itemtypes,
! 			-size     => 1,
! 			-multiple => 0 );
! $sth->finish;
! # TODO
  my @branches;
! my @select_branch;
! my %select_branches;
! my ($count2, at branches)=branches();
  for (my $i=0;$i<$count2;$i++){
! 	push @select_branch, $branches[$i]->{'branchcode'};#
!   	$select_branches{$branches[$i]->{'branchcode'}} = $branches[$i]->{'branchname'};
  }
! my $CGIbranch=CGI::scrolling_list( -name     => 'branch',
! 			-values   => \@select_branch,
! 			-default  => $data->{'branchcode'},
! 			-labels   => \%select_branches,
! 			-size     => 1,
! 			-multiple => 0 );
  
  my $auto_barcode = C4::Context->boolean_preference("autoBarcode") || 0;
  	# See whether barcodes should be automatically allocated.
  	# Defaults to 0, meaning "no".
+ my $barcode;
  if ($auto_barcode eq '1') {
! 	$sth=$dbh->prepare("Select max(barcode) from items");
! 	$sth->execute;
! 	my $data=$sth->fetchrow_hashref;
! 	$barcode = $data->{'barcode'}+1;
! 	$sth->finish;
  }
  
  my @bookfund;
+ my @select_bookfund;
+ my %select_bookfunds;
  ($count2, at bookfund)=bookfunds();
  for (my $i=0;$i<$count2;$i++){
! 	push @select_bookfund, $bookfund[$i]->{'bookfundid'};
! 	$select_bookfunds{$bookfund[$i]->{'bookfundid'}} = $bookfund[$i]->{'bookfundname'}
  }
+ my $CGIbookfund=CGI::scrolling_list( -name     => 'bookfund',
+ 			-values   => \@select_bookfund,
+ 			-default  => $data->{'bookfundid'},
+ 			-labels   => \%select_bookfunds,
+ 			-size     => 1,
+ 			-multiple => 0 );
+ 
+ $template->param( existing => $biblio,
+ 						title => $title,
+ 						ordnum => $ordnum,
+ 						basket => $basket,
+ 						id => $id,
+ 						biblio => $biblio,
+ 						biblioitemnumber => $data->{'biblioitemnumber'},
+ 						itemtype => $data->{'itemtype'},
+ 						discount => $booksellers[0]->{'discount'},
+       					listingcst => $booksellers[0]->{'listincgst'},
+ 						listprice => $booksellers[0]->{'listprice'},
+ 						gstreg => $booksellers[0]->{'gstreg'},
+ 						name => $booksellers[0]->{'name'},
+ 						loop_currencies => \@loop_currency,
+ 						orderexists => ($new eq 'yes')?0:1,
+ 						title => $data->{'title'},
+ 						author => $data->{'author'},
+ 						copyrightdate => $data->{'copyrightdate'},
+ 						CGIitemtype => $CGIitemtype,
+ 						CGIbranch => $CGIbranch,
+ 						CGIbookfund => $CGIbookfund,
+ 						isbn => $data->{'isbn'},
+ 						seriestitle => $data->{'seriestitle'},
+ 						quantity => $data->{'quantity'},
+ 						listprice => $data->{'listprice'},
+ 						rrp => $data->{'rrp'},
+ 						ecost => $data->{'ecost'},
+ 						notes => $data->{'notes'},
+ 						barcode => $data->{'barcode'},);
  
! output_html_with_http_headers $input, $cookie, $template->output;
  

Index: order.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/order.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** order.pl	10 Feb 2003 13:38:45 -0000	1.6
--- order.pl	13 Feb 2003 17:27:51 -0000	1.7
***************
*** 69,78 ****
  	for (my $i2=0;$i2<$ordcount;$i2++){
  		my %inner_line;
! 	warn "bask : ".$orders->[$i2]->{'basketno'};
! 			$inner_line{basketno} =$orders->[$i2]->{'basketno'};
! 			$inner_line{total} =$orders->[$i2]->{'count(*)'};
! 			$inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'};
! 			$inner_line{entrydate} = $orders->[$i2]->{'entrydate'};
! 			push @loop_basket, \%inner_line;
  	}
  	$line{loop_basket} = \@loop_basket;
--- 69,77 ----
  	for (my $i2=0;$i2<$ordcount;$i2++){
  		my %inner_line;
! 		$inner_line{basketno} =$orders->[$i2]->{'basketno'};
! 		$inner_line{total} =$orders->[$i2]->{'count(*)'};
! 		$inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'};
! 		$inner_line{entrydate} = $orders->[$i2]->{'entrydate'};
! 		push @loop_basket, \%inner_line;
  	}
  	$line{loop_basket} = \@loop_basket;

Index: receive.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/receive.pl,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** receive.pl	13 Oct 2002 07:38:02 -0000	1.6
--- receive.pl	13 Feb 2003 17:27:51 -0000	1.7
***************
*** 24,35 ****
  # Suite 330, Boston, MA  02111-1307 USA
  
  use C4::Catalogue;
  use C4::Biblio;
  use C4::Output;
  use CGI;
  use strict;
  
  my $input=new CGI;
- print $input->header();
  my $id=$input->param('id');
  my ($count, at booksellers)=bookseller($id);
--- 24,39 ----
  # Suite 330, Boston, MA  02111-1307 USA
  
+ use C4::Auth;
  use C4::Catalogue;
  use C4::Biblio;
  use C4::Output;
  use CGI;
+ use C4::Interface::CGI::Output;
+ use C4::Database;
+ use HTML::Template;
+ use C4::Catalogue;
  use strict;
  
  my $input=new CGI;
  my $id=$input->param('id');
  my ($count, at booksellers)=bookseller($id);
***************
*** 39,85 ****
  my $user=$input->remote_user;
  my $date=localtime(time);
- print startpage;
- 
- print startmenu('acquisitions');
- 
- print <<EOP
- 
- <div align=right>
- Invoice: $invoice<br>
- Received By: $user<br>
- $date
- </div>
- <FONT SIZE=6><em>Receipt Summary For : <a href=whitcoulls.html>$booksellers[0]->{'name'}</a> </em></FONT>
- <CENTER>
  
! <FORM ACTION="/cgi-bin/koha/acqui/acquire.pl">
! <input type=hidden name=gst value=$gst>
! <input type=hidden name=freight value=$freight>
! <input type=hidden name=invoice value=$invoice>
  
- <b>Search ISBN or Title:</b> <INPUT TYPE="text"  SIZE="25"   NAME="recieve">
- </form>
- <p>
- <FORM ACTION="" method=post name=orderform>
- 
- <table border=0 cellspacing=0 cellpadding=5>
- <tr valign=top bgcolor=#99cc33>
- <td background="/images/background-mem.gif"><b>BASKET</b></td>
- <td background="/images/background-mem.gif"><b>ISBN</b></td>
- <td background="/images/background-mem.gif"><b>TITLE</b></td>
- <td background="/images/background-mem.gif"><b>AUTHOR</b></td>
- <td background="/images/background-mem.gif"><b>ACTUAL</b></td>
- <td background="/images/background-mem.gif"><b>P&P</b></td>
- <td background="/images/background-mem.gif"><b>QTY</b></td>
- <td background="/images/background-mem.gif"><b>TOTAL</b></td></tr>
- 
- EOP
- ;
  my @results;
  ($count, at results)=invoice($invoice);
  if ($invoice eq ''){
!   ($count, at results)=getallorders($id);
  }
- print $count;
  my $totalprice=0;
  my $totalfreight=0;
--- 43,61 ----
  my $user=$input->remote_user;
  my $date=localtime(time);
  
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "acqui/recieve.tmpl",
! 			     query => $input,
! 			     type => "intranet",
! 			     authnotrequired => 0,
! 			     flagsrequired => {acquisition => 1},
! 			     debug => 1,
! 			     });
  
  my @results;
  ($count, at results)=invoice($invoice);
  if ($invoice eq ''){
! 	($count, at results)=getallorders($id);
  }
  my $totalprice=0;
  my $totalfreight=0;
***************
*** 87,162 ****
  my $total;
  my $tototal;
  for (my$i=0;$i<$count;$i++){
!  $total=($results[$i]->{'unitprice'} + $results[$i]->{'freight'}) * $results[$i]->{'quantityreceived'};
! $results[$i]->{'unitprice'}+=0;
! print <<EOP
! <tr valign=top bgcolor=#ffffcc>
! <td>$results[$i]->{'basketno'}</td>
! <td>$results[$i]->{'isbn'}</td>
! <td><a href="acquire.pl?recieve=$results[$i]->{'ordernumber'}&biblio=$results[$i]->{'biblionumber'}&invoice=$invoice&gst=$gst&freight=$freight">$results[$i]->{'title'}</a></td>
! <td>$results[$i]->{'author'}</td>
! <td>\$$results[$i]->{'unitprice'}</td>
! <td></td>
! <td>$results[$i]->{'quantityreceived'}</td>
! <td>\$ $total</td>
! </tr>
! EOP
! ;
! $totalprice+=$results[$i]->{'unitprice'};
! $totalfreight+=$results[$i]->{'freight'};
! $totalquantity+=$results[$i]->{'quantityreceived'};
! $tototal+=$total;
  }
  $totalfreight=$freight;
  $tototal=$tototal+$freight;
  
! my $grandtot=$tototal+$gst;
! print <<EOP
! <tr valign=top bgcolor=white>
! <td colspan=8><hr>
! </td></tr>
! 
! 
! 
! <tr valign=top bgcolor=white>
! <td></td>
! <td></td>
! <td></td>
! <td><b>SUBTOTALS</b></td>
! <td>\$$totalprice</td>
! <td>$totalfreight</td>
! <td>$totalquantity</td>
! <td>\$$tototal</td>
! </tr>
! <tr valign=top bgcolor=white>
! <td colspan=5 rowspan=2  bgcolor=#99cc33 background="/images/background-mem.gif">
! <b>HELP</b>
! <br>
! The total at the bottom of the page should be within a few cents of the total for the invoice.<p>
! When you have finished this invoice save the changes.
! </td>
! <td colspan=2 align=right><b>GST</b></td>
! <td>\$$gst</td>
! </tr>
! <tr valign=top bgcolor=white>
! <td colspan=2 align=right ><b>TOTAL</b></td>
! <td>\$$grandtot</td>
! </tr>
! <tr valign=top bgcolor=white>
! <td></td>
! <td></td>
! <td></td>
! <td></td>
! <td></td>
! <td></td>
! <td colspan=3><input type=image  name=submit src=/images/save-changes.gif border=0 width=187 height=42 align=right></td>
! </tr>
! </table>
! </CENTER>
! EOP
! ;
! 
! 
! print endmenu('acquisitions');
! 
! print endpage;
--- 63,116 ----
  my $total;
  my $tototal;
+ my $toggle;
+ my @loop_orders = ();
  for (my$i=0;$i<$count;$i++){
! 	warn "nb : ".$results[$i]->{'ordernumber'};
! 	$total=($results[$i]->{'unitprice'} + $results[$i]->{'freight'}) * $results[$i]->{'quantityreceived'};
! 	$results[$i]->{'unitprice'}+=0;
! 	my %line;
! 	if ($toggle==0){
! 		$line{color}='#ffffcc';
! 		$toggle=1;
! 	} else {
! 		$line{color}='white';
! 		$toggle=0;
! 	}
! 	$line{basketno} = $results[$i]->{'basketno'};
! 	$line{isbn} = $results[$i]->{'isbn'};
! 	$line{ordernumber} = $results[$i]->{'ordernumber'};
! 	$line{biblionumber} = $results[$i]->{'biblionumber'};
! 	$line{invoice} = $invoice;
! 	$line{gst} = $gst;
! 	$line{title} = $results[$i]->{'title'};
! 	$line{author} = $results[$i]->{'author'};
! 	$line{unitprice} = $results[$i]->{'unitprice'};
! 	$line{quantityrecieved} = $results[$i]->{'quantityreceived'};
! 	$line{total} = $total;
! 	push @loop_orders, \%line;
! 	$totalprice+=$results[$i]->{'unitprice'};
! 	$totalfreight+=$results[$i]->{'freight'};
! 	$totalquantity+=$results[$i]->{'quantityreceived'};
! 	$tototal+=$total;
  }
+ 
  $totalfreight=$freight;
  $tototal=$tototal+$freight;
  
! $template->param(invoice => $invoice,
! 						user => $user,
! 						date => $date,
! 						name => $booksellers[0]->{'name'},
! 						gst => $gst,
! 						freight => $freight,
! 						invoice => $invoice,
! 						count => $count,
! 						loop_orders => \@loop_orders,
! 						totalprice => $totalprice,
! 						totalfreight => $totalfreight,
! 						totalquantity => $totalquantity,
! 						tototal => $tototal,
! 						gst => $gst,
! 						grandtot => $tototal+$gst,
! 						);
! output_html_with_http_headers $input, $cookie, $template->output;

Index: recieveorder.pl
===================================================================
RCS file: /cvsroot/koha/koha/acqui/recieveorder.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** recieveorder.pl	13 Oct 2002 07:38:10 -0000	1.5
--- recieveorder.pl	13 Feb 2003 17:27:52 -0000	1.6
***************
*** 23,79 ****
  # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
  # Suite 330, Boston, MA  02111-1307 USA
- 
- use C4::Catalogue;
- use C4::Biblio;
- use C4::Output;
- use CGI;
  use strict;
  
  my $input=new CGI;
- print $input->header();
  my $id=$input->param('id');
  my ($count, at booksellers)=bookseller($id);
- print startpage;
- 
- print startmenu('acquisitions');
- 
- print <<EOP
- 
- <FONT SIZE=6><em>Receive Orders From Supplier <a href=whitcoulls.html>$booksellers[0]->{'name'}</a></em></FONT>
- <p>
- <CENTER>
- <form method=post action="receive.pl">
- <input type=hidden name=id value=$id>
- <p>
- <table border=1 cellspacing=0 cellpadding=5>
- <tr valign=top bgcolor=#99cc33><td background="/images/background-mem.gif" colspan=2><B>SUPPLIER INVOICE INFORMATION</B></td></tr>
- <TR VALIGN=TOP >
- <TD>Supplier Invoice Number</td>
- <td><input type=text size=20 name=invoice>
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>GST</td>
- <td><input type=text size=20 name=gst>
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD>Freight</td>
- <td><input type=text size=20 name=freight>
- </td>
- </tr>
- <TR VALIGN=TOP>
- <TD></td>
- <td><input type=image  name=submit src=/images/continue.gif border=0 width=120 height=42>
- </td>
- </tr>
- </table>
- </CENTER>
- 
- EOP
- ;
- 
  
! print endmenu('acquisitions');
  
! print endpage;
--- 23,48 ----
  # 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::Auth;
+ use C4::Output;
+ use C4::Interface::CGI::Output;
+ use C4::Database;
+ use HTML::Template;
+ use C4::Catalogue;
  
  my $input=new CGI;
  my $id=$input->param('id');
  my ($count, at booksellers)=bookseller($id);
  
! my ($template, $loggedinuser, $cookie)
!     = get_template_and_user({template_name => "acqui/recieveorder.tmpl",
! 			     query => $input,
! 			     type => "intranet",
! 			     authnotrequired => 0,
! 			     flagsrequired => {acquisition => 1},
! 			     debug => 1,
! 			     });
! $template->param(name => $booksellers[0]->{'name'},id => $id,);
  
! output_html_with_http_headers $input, $cookie, $template->output;





More information about the Koha-cvs mailing list