[Koha-cvs] koha/intranet/cgi-bin/acqui acqui-home.pl addor... [rel_TG]

Tumer Garip tgarip at neu.edu.tr
Sat Mar 10 02:07:50 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_TG
Changes by:	Tumer Garip <tgarip1957>	07/03/10 01:07:50

Added files:
	intranet/cgi-bin/acqui: acqui-home.pl addorder.pl basket.pl 
	                        bookfund.pl booksellers.pl currency.pl 
	                        finishreceive.pl histsearch.pl 
	                        lateorders.pl neworderempty.pl 
	                        newordersuggestion.pl parcel.pl 
	                        select-late.pl supplier.pl 
	                        updatesupplier.pl 

Log message:
	fresh files for rel_TG

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/acqui-home.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/addorder.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/basket.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/bookfund.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/booksellers.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/currency.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/finishreceive.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/histsearch.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/lateorders.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/neworderempty.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/newordersuggestion.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/parcel.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/select-late.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/supplier.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/intranet/cgi-bin/acqui/updatesupplier.pl?cvsroot=koha&only_with_tag=rel_TG&rev=1.1.2.1

Patches:
Index: acqui-home.pl
===================================================================
RCS file: acqui-home.pl
diff -N acqui-home.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ acqui-home.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+
+# 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
+
+# $Id: acqui-home.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+
+=head1 NAME
+
+acqui-home.pl
+
+=head1 DESCRIPTION
+
+this script is the main page for acqui/
+It presents the budget's dashboard, another table about differents currency with 
+their rates and the pending suggestions.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item $status
+C<$status> is the status a suggestion could has. Default value is 'ASKED'.
+thus, it can be REJECTED, ACCEPTED, ORDERED, ASKED, AVAIBLE
+
+=back
+
+=cut
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Suggestions;
+use C4::Acquisition;
+use C4::Bookfund;
+use C4::Members;
+
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/acqui-home.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { acquisition => 1 },
+        debug           => 1,
+    }
+);
+
+# budget
+my $me= C4::Context->userenv;
+my $homebranch=$me->{'branch'} ;
+my @results = GetBookFunds($homebranch);
+my $count = scalar @results;
+my $classlist   = '';
+my $total       = 0;
+my $totspent    = 0;
+my $totcomtd    = 0;
+my $totavail    = 0;
+my @loop_budget = ();
+
+for (my $i=0; $i<$count; $i++){
+	my ($spent,$comtd)=GetBookFundBreakdown($results[$i]->{'bookfundid'});
+	my $avail=$results[$i]->{'budgetamount'}-($spent+$comtd);
+	my %line;
+	$line{bookfundname} = $results[$i]->{'bookfundname'};
+	$line{budgetamount} = $results[$i]->{'budgetamount'};
+	$line{spent} = sprintf  ("%.2f", $spent);
+	$line{comtd} = sprintf  ("%.2f",$comtd);
+	$line{avail}  = sprintf  ("%.2f",$avail);
+	push @loop_budget, \%line;
+	$total+=$results[$i]->{'budgetamount'};
+	$totspent+=$spent;
+	$totcomtd+=$comtd;
+	$totavail+=$avail;
+}
+
+# currencies
+my @rates = GetCurrencies();
+my $count = scalar @rates;
+
+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;
+}
+
+# suggestions
+my $status           = $query->param('status') || "ASKED";
+my $suggestion       = CountSuggestion($status);
+my $suggestions_loop = &SearchSuggestion( '', '', '', '', $status, '' );
+
+$template->param(
+    classlist        => $classlist,
+    type             => 'intranet',
+    loop_budget      => \@loop_budget,
+    loop_currency    => \@loop_currency,
+    total            => sprintf( "%.2f", $total ),
+    suggestion       => $suggestion,
+    suggestions_loop => $suggestions_loop,
+    totspent         => sprintf( "%.2f", $totspent ),
+    totcomtd         => sprintf( "%.2f", $totcomtd ),
+    totavail         => sprintf( "%.2f", $totavail ),
+    nobudget         => $#results == -1 ? 1 : 0
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;

Index: addorder.pl
===================================================================
RCS file: addorder.pl
diff -N addorder.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ addorder.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,225 @@
+#!/usr/bin/perl
+
+#script to add an order into the system
+#written 29/2/00 by chris at katipo.co.nz
+
+# 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
+
+
+=head1 NAME
+
+addorder.pl
+
+=head1 DESCRIPTION
+
+this script allows to add an order.
+It is called by :
+
+=item neworderbiblio.pl to add an order from nothing.
+
+=item neworderempty.pl to add an order from an existing biblio.
+
+=item newordersuggestion.pl to add an order from an existing suggestion.
+
+=head1 CGI PARAMETERS
+
+All of the cgi parameters below are related to the new order.
+
+=over 4
+
+=item C<ordnum>
+the number of this new order.
+
+=item C<basketno>
+the number of this new basket
+
+=item C<booksellerid>
+the bookseller the librarian has to pay.
+
+=item C<existing>
+
+=item C<title>
+the title of the record ordered.
+
+=item C<author>
+the author of the record ordered.
+
+=item C<copyrightdate>
+the copyrightdate of the record ordered.
+
+=item C<ISBN>
+the ISBN of the record ordered.
+
+=item C<format>
+
+=item C<quantity>
+the quantity to order.
+
+=item C<list_price>
+the price of this order.
+
+=item C<branch>
+the branch where this order will be received.
+
+=item C<series>
+
+=item C<notes>
+Notes on this basket.
+
+=item C<bookfund>
+bookfund use to pay this order.
+
+=item C<sort1> & C<sort2>
+
+=item C<rrp>
+
+=item C<ecost>
+
+=item C<gst>
+
+=item C<budget>
+
+=item C<cost>
+
+=item C<sub>
+
+=item C<invoice>
+the number of the invoice for this order.
+
+=item C<publishercode>
+
+=item C<suggestionid>
+if it is an order from an existing suggestion : the id of this suggestion.
+
+=item C<donation>
+
+=back
+
+=cut
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Acquisition;
+use C4::Suggestions;
+use C4::Biblio;
+use C4::Interface::CGI::Output;
+
+my $input = new CGI;
+# get_template_and_user used only to check auth & get user id
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/booksellers.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { acquisition => 1 },
+        debug           => 1,
+    }
+);
+
+
+# get CGI parameters
+my $ordnum       = $input->param('ordnum');
+my $basketno     = $input->param('basketno');
+my $booksellerid = $input->param('booksellerid');
+my $existing     = $input->param('existing');    # existing biblio, (not basket or order)
+my $title         = $input->param('title');
+my $author        = $input->param('author');
+my $copyrightdate = $input->param('copyrightdate');
+my $isbn          = $input->param('ISBN');
+my $itemtype      = $input->param('format');
+my $quantity      = $input->param('quantity');
+my $listprice     = $input->param('list_price');
+my $branch        = $input->param('branch');
+my $discount=$input->param('discount');
+if ( $listprice eq '' ) {
+    $listprice = 0;
+}
+my $series = $input->param('series');
+my $notes         = $input->param('notes');
+my $bookfundid      = $input->param('bookfundid');
+my $sort1         = $input->param('sort1');
+my $sort2         = $input->param('sort2');
+my $rrp           = $input->param('rrp');
+my $ecost         = $input->param('ecost');
+my $gst           = $input->param('gstrate');
+my $budget        = $input->param('budget');
+my $unitprice         = $input->param('unitprice');
+my $sub           = $input->param('sub');
+my $purchaseordernumber       = $input->param('purchaseordernumber');
+my $publishercode = $input->param('publishercode');
+my $suggestionid  = $input->param('suggestionid');
+my $donation      = $input->param('donation');
+my $user          = $input->remote_user;
+my $biblionumber=$input->param('biblionumber');
+my $createbibitem = $input->param('createbibitem');
+
+# create, modify or delete biblio
+# create if $quantity>=0 and $existing='no'
+# modify if $quantity>=0 and $existing='yes'
+# delete if $quantity has been se to 0 by the librarian
+my $dbh=C4::Context->dbh;
+
+if ($quantity ne '0'){
+    #check to see if biblio exists
+    if ( $existing eq 'no' ) {
+        #if it doesnt its created on template
+        # change suggestion status if applicable
+        if ($suggestionid) {
+my $data=GetSuggestion($suggestionid);
+
+ my $biblio={title=>$data->{title},author=>$data->{author},publishercode=>$data->{publishercode},copyrightdate=>$data->{copyrightdate},isbn=>$data->{isbn},place=>$data->{place},};
+my $xmlhash=XMLkoha2marc($dbh,$biblio,"biblios");
+$biblionumber = NEWnewbiblio($dbh,$xmlhash,"");
+
+            ModStatus( $suggestionid, 'ORDERED', '', $biblionumber,$input );
+        }
+    }## biblio didnot exist now created
+
+    
+
+   
+    if ($ordnum) {
+
+        # 		warn "MODORDER $title / $ordnum / $quantity / $bookfund";
+        ModOrder(
+            $title,   $ordnum,   $quantity,     $listprice,
+            $biblionumber,  $basketno, $booksellerid, $loggedinuser,
+            $notes,   $bookfundid,    $rrp,
+            $ecost,   $gst,      $budget,       $unitprice,
+            $purchaseordernumber, $sort1,    $sort2,$discount,$branch
+        );
+    }
+    else {
+        ( $basketno, $ordnum ) = NewOrder(
+            $basketno,  $biblionumber,       $title,        $quantity,
+            $listprice, $booksellerid, $loggedinuser, $notes,
+            $bookfundid,    $rrp,          $ecost,
+            $gst,       $budget,       $unitprice,         $sub,
+            $purchaseordernumber,   $sort1,        $sort2, $discount,$branch
+        );
+    }
+
+}
+else {
+#    $biblionumber = $input->param('biblionumber');
+    DelOrder( $biblionumber, $ordnum,$loggedinuser );
+}
+
+print $input->redirect("basket.pl?basketno=$basketno");

Index: basket.pl
===================================================================
RCS file: basket.pl
diff -N basket.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ basket.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,189 @@
+#!/usr/bin/perl
+
+#script to show display basket of orders
+#written by chris at katipo.co.nz 24/2/2000
+
+# 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
+
+# $Id: basket.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+use strict;
+use C4::Auth;
+use C4::Koha;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+use C4::Bookfund;
+use C4::Bookseller;
+use C4::Date;
+
+=head1 NAME
+
+basket.pl
+
+=head1 DESCRIPTION
+
+ This script display all informations about basket for the supplier given
+ on input arg. Moreover, it allow to add a new order for this supplier from
+ an existing record, a suggestion or from a new record.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item $basketno
+
+this parameter seems to be unused.
+
+=item supplierid
+
+the supplier this script have to display the basket.
+
+=item order
+
+
+
+=back
+
+=cut
+
+my $query        = new CGI;
+my $basketno     = $query->param('basketno');
+my $booksellerid = $query->param('supplierid');
+my $order        = $query->param('order');
+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 $basket = GetBasket($basketno);
+$basket->{authorisedbyname};
+# FIXME : the query->param('supplierid') below is probably useless. The bookseller is always known from the basket
+# if no booksellerid in parameter, get it from basket
+$booksellerid = $basket->{booksellerid} unless $booksellerid;
+my @booksellers = GetBookSeller($booksellerid);
+my $count2 = scalar @booksellers;
+
+# get librarian branch...
+if ( C4::Context->preference("IndependantBranches") ) {
+    my $userenv = C4::Context->userenv;
+    unless ( $userenv->{flags} == 1 ) {
+        my $validtest = ( $basket->{creationdate} eq '' )
+          || ( $basket->{branch}  eq '' )
+          || ( $userenv->{branch} eq $basket->{branch} )
+          || ( $userenv->{branch} eq '' )
+          || ( $basket->{branch}  eq '' );
+        unless ($validtest) {
+            print $query->redirect("../mainpage.pl");
+            exit 1;
+        }
+    }
+}
+
+# if new basket, pre-fill infos
+$basket->{creationdate} = ""            unless ( $basket->{creationdate} );
+$basket->{authorisedby} = $loggedinuser unless ( $basket->{authorisedby} );
+
+my ( $count, @results );
+ at results  = GetOrders( $basketno, $order );
+$count = scalar @results;
+my $line_total;     # total of each line
+my $gist =C4::Context->preference('gist');           # GST 
+my $toggle = 0;
+
+# my $line_total_est; # total of each line
+my $sub_total_est;      # total of line totals
+my $gist_est;           # GST
+my $grand_total_est;    # $subttotal + $gist_est - $disc_est
+my $disc_est;
+my $qty_total;
+
+my @books_loop;
+for ( my $i = 0 ; $i < $count ; $i++ ) {
+     $line_total = $results[$i]->{'quantity'} * $results[$i]->{'rrp'};
+    $sub_total_est += $line_total ;
+   $disc_est +=$line_total *$results[$i]->{'discount'}/100;
+   $gist_est +=($line_total  - ($line_total *$results[$i]->{'discount'}/100))*$results[$i]->{'gst'}/100;
+   
+   
+    $qty_total += $results[$i]->{'quantity'};
+    my %line;
+   if ( $toggle == 0 ) {
+        $line{color} = '#EEEEEE';
+        $toggle = 1;
+    }
+    else {
+        $line{color} = 'white';
+        $toggle = 0;
+    }
+    $line{ordernumber}      = $results[$i]->{'ordernumber'};
+    $line{publishercode}    = $results[$i]->{'publishercode'};
+    $line{isbn}             = $results[$i]->{'isbn'};
+    $line{booksellerid}     = $booksellers[0]->{'id'};
+    $line{basketno}         = $basketno;
+    $line{title}            = $results[$i]->{'title'};
+    $line{notes}            = $results[$i]->{'notes'};
+    $line{author}           = $results[$i]->{'author'};
+    $line{i}                = $i;
+    $line{rrp}              = sprintf( "%.2f", $results[$i]->{'rrp'} );
+    $line{ecost}            = sprintf( "%.2f", $results[$i]->{'ecost'} );
+      $line{discount}            = sprintf( "%.2f", $results[$i]->{'discount'} );
+    $line{quantity}         = $results[$i]->{'quantity'};
+    $line{quantityrecieved} = $results[$i]->{'quantityreceived'};
+    $line{line_total}       = sprintf( "%.2f", $line_total );
+    $line{biblionumber}     = $results[$i]->{'biblionumber'};
+    $line{bookfundid}       = $results[$i]->{'bookfundid'};
+    $line{odd}              = $i % 2;
+if  ($line{quantityrecieved}>0){$line{donotdelete}=1;}
+    push @books_loop, \%line;
+$template->param(purchaseordernumber    => $results[0]->{'purchaseordernumber'},
+		booksellerinvoicenumber=>$results[0]->{booksellerinvoicenumber},);
+}
+$grand_total_est =  sprintf( "%.2f", $sub_total_est - $disc_est+$gist_est );
+
+$template->param(
+    basketno         => $basketno,
+    creationdate     => format_date( $basket->{creationdate} ),
+    authorisedby     => $basket->{authorisedby},
+    authorisedbyname => $basket->{authorisedbyname},
+    closedate        => format_date( $basket->{closedate} ),
+    active           => $booksellers[0]->{'active'},
+    booksellerid     => $booksellers[0]->{'id'},
+    name             => $booksellers[0]->{'name'},
+    address1         => $booksellers[0]->{'address1'},
+    address2         => $booksellers[0]->{'address2'},
+    address3         => $booksellers[0]->{'address3'},
+    address4         => $booksellers[0]->{'address4'},
+    entrydate        => format_date( $results[0]->{'entrydate'} ),
+    books_loop       => \@books_loop,
+    count            => $count,
+    gist             => $gist,
+    sub_total_est    =>  sprintf( "%.2f",$sub_total_est),
+    gist_est         =>  sprintf( "%.2f",$gist_est),
+    disc_est	=> sprintf( "%.2f",$disc_est),
+    grand_total_est  => $grand_total_est,
+    currency         => $booksellers[0]->{'listprice'},
+    qty_total        => $qty_total,
+);
+output_html_with_http_headers $query, $cookie, $template->output;

Index: bookfund.pl
===================================================================
RCS file: bookfund.pl
diff -N bookfund.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ bookfund.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,102 @@
+#!/usr/bin/perl -w
+
+# Copyright 2006 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 C4::Context;
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+
+my $dbh      = C4::Context->dbh;
+my $input    = new CGI;
+my $bookfund = $input->param('bookfund');
+my $start    = $input->param('start');
+my $end      = $input->param('end');
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/bookfund.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { acquisition => 1 },
+        debug           => 1,
+    }
+);
+
+my $query = '
+SELECT quantity,
+       datereceived,
+       freight,
+       unitprice,
+       listprice,
+       ecost,
+       quantityreceived AS qrev,
+       subscription,
+       title,
+       itemtype,
+       aqorders.biblionumber,
+       aqorders.booksellerinvoicenumber,
+       quantity-quantityreceived AS tleft,
+       aqorders.ordernumber AS ordnum,
+       entrydate,
+       budgetdate,
+       booksellerid,
+       aqbasket.basketno
+  FROM aqorders
+    INNER JOIN aqorderbreakdown
+      ON aqorderbreakdown.ordernumber = aqorders.ordernumber
+    INNER JOIN aqbasket
+      ON aqbasket.basketno = aqorders.basketno
+    LEFT JOIN biblio
+      ON biblio.biblionumber = aqorders.biblionumber
+  WHERE bookfundid = ?
+    AND budgetdate >= ?
+    AND budgetdate < ?
+    AND (datecancellationprinted IS NULL
+         OR datecancellationprinted = \'0000-00-00\')
+';
+##warn $query;
+my $sth = $dbh->prepare($query);
+$sth->execute( $bookfund, $start, $end );
+my @commited_loop;
+
+my $total = 0;
+while ( my $data = $sth->fetchrow_hashref ) {
+    my $left = $data->{'tleft'};
+    if ( !$left || $left eq '' ) {
+        $left = $data->{'quantity'};
+    }
+    if ( $left && $left > 0 ) {
+        my $subtotal = $left * $data->{'ecost'};
+        $data->{subtotal} = $subtotal;
+        $data->{'left'} = $left;
+        push @commited_loop, $data;
+        $total += $subtotal;
+    }
+}
+
+$template->param(
+    COMMITEDLOOP => \@commited_loop,
+    total        => $total
+);
+$sth->finish;
+#$dbh->disconnect;
+
+output_html_with_http_headers $input, $cookie, $template->output;

Index: booksellers.pl
===================================================================
RCS file: booksellers.pl
diff -N booksellers.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ booksellers.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+#script to show suppliers and orders
+#written by chris at katipo.co.nz 23/2/2000
+
+# 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
+
+# $Id: booksellers.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+=head1 NAME
+
+booksellers.pl
+
+=head1 DESCRIPTION
+
+this script displays the list of suppliers & orders like C<$supplier> given on input arg.
+thus, this page brings differents features like to display supplier's details,
+to add an order for a specific supplier or to just add a new supplier.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item supplier
+
+C<$supplier> is the suplier we have to search order.
+=back
+
+=item op
+
+C<OP> can be equals to 'close' if we have to close a basket before building the page.
+
+=item basket
+
+the C<basket> we have to close if op is equal to 'close'.
+
+=back
+
+=cut
+
+use strict;
+use C4::Auth;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+use C4::Date;
+use C4::Bookseller;
+
+my $query = new CGI;
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/booksellers.tmpl",
+        query           => $query,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { acquisition => 1 },
+        debug           => 1,
+    }
+);
+
+#parameters
+my $supplier = $query->param('supplier');
+
+my @suppliers = GetBookSeller($supplier);
+my $count = scalar @suppliers;
+
+# check if we have to "close" a basket before building page
+my $op     = $query->param('op');
+my $basketno = $query->param('basketno');
+if ( $op eq 'close' ) {
+    CloseBasket($basketno);
+}
+
+#build result page
+my $toggle = 0;
+ my $ordcount;
+my @loop_suppliers;
+for ( my $i = 0 ; $i < $count ; $i++ ) {
+   my $orders  = GetPendingOrders( $suppliers[$i]->{'id'} );
+ my    $ordercount = scalar @$orders;
+$ordcount+=$ordercount;
+    my %line;
+    if ( $toggle == 0 ) {
+        $line{even} = 1;
+        $toggle = 1;
+    }
+    else {
+        $line{even} = 0;
+        $toggle = 0;
+    }
+    $line{supplierid} = $suppliers[$i]->{'id'};
+    $line{name}       = $suppliers[$i]->{'name'};
+    $line{active}     = $suppliers[$i]->{'active'};
+    $line{ordcount}=$ordercount;	
+    my @loop_basket;
+     foreach my $order(@$orders){
+        push @loop_basket, $order;
+    }
+    $line{loop_basket} = \@loop_basket;
+    push @loop_suppliers, \%line;
+}
+$template->param(
+    loop_suppliers          => \@loop_suppliers,
+    supplier                => $supplier,
+    count                   => $ordcount,
+    intranetcolorstylesheet =>
+    C4::Context->preference("intranetcolorstylesheet"),
+    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+    IntranetNav        => C4::Context->preference("IntranetNav"),
+);
+
+output_html_with_http_headers $query, $cookie, $template->output;

Index: currency.pl
===================================================================
RCS file: currency.pl
diff -N currency.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ currency.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+
+# $Id: currency.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+#written by chris at katipo.co.nz
+#9/10/2000
+#script to display and update currency rates
+
+
+# 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 CGI;
+use C4::Acquisition;
+use C4::Biblio;
+use C4::Bookfund;
+
+my $input=new CGI;
+
+my @params=$input->param;
+foreach my $param (@params){
+	if ($param ne 'type' && $param !~ /submit/){
+		my $data=$input->param($param);
+#		warn "$data / $param";
+		ModCurrencies($param,$data);
+}
+}
+print $input->redirect('/cgi-bin/koha/acqui/acqui-home.pl');

Index: finishreceive.pl
===================================================================
RCS file: finishreceive.pl
diff -N finishreceive.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ finishreceive.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+
+#script to add a new item and to mark orders as received
+#written 1/3/00 by chris at katipo.co.nz
+
+# 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
+
+# this script makes the items, addorder.pl has already made the biblio and biblioitem records: MASON
+
+
+=head1 NAME
+
+finishreceive.pl
+
+=head1 DESCRIPTION
+TODO
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+TODO
+
+=back
+
+=cut
+
+use strict;
+use C4::Acquisition;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Auth;
+use C4::Bookseller;
+
+my $input = new CGI;
+
+my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/finishreceive.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { editcatalogue => 1 },
+        debug           => 1,
+    }
+);
+
+my @biblionumber     = $input->param('biblionumber');
+my @ordnum           = $input->param('ordernumber');
+my $cost             = $input->param('invoicetotal');
+my $locacost             = $input->param('localtotal');
+my $invoiceno        = $input->param('invoice');
+my @replacement    = $input->param('actual');
+my @gst            = $input->param('gstrate');
+my $freight        = $input->param('actualfreight');
+my @freightperitem = $input->param('freight');
+my $supplierid     = $input->param('supplierid');
+my @title         = $input->param('title');
+my $currencyrate=$input->param('currencyrate');
+my @bookfund      = $input->param('bookfund');
+my @discount     = $input->param('discount');
+my @quantrec      = $input->param('received');
+my $totalreceived=$input->param('totalreceived');
+my $incgst=$input->param('incgst');
+my $ecost;
+my $unitprice;
+my $listprice;
+
+my @supplier=GetBookSeller($supplierid);
+my $count=scalar @quantrec;
+my @additems;
+
+ for (my $i=0; $i<$count;$i++){
+ $freightperitem[$i]=$freight/$totalreceived unless  $freightperitem[$i];
+$listprice=$replacement[$i];
+  $replacement[$i]= $replacement[$i]*$currencyrate;
+	if ($incgst){
+	$ecost= ($replacement[$i]*100/($gst[$i]+100))*(100 - $discount[$i])/100;
+	}else{
+	$ecost= $replacement[$i]*(100 - $discount[$i])/100;
+	}
+$unitprice=$ecost + $ecost*$gst[$i]/100;
+    	if ( $quantrec[$i] != 0 ) {
+       	 # save the quantity recieved.
+        	ModReceiveOrder( $biblionumber[$i], $ordnum[$i], $quantrec[$i], $unitprice,
+            $invoiceno, $freightperitem[$i], $replacement[$i] ,$listprice,$input );   
+  	push @additems,{biblionumber=>$biblionumber[$i],itemcount=>$quantrec[$i], title=>$title[$i],supplier=>$supplier[0]->{name},rrp=>$replacement[$i],};
+
+	}
+}
+$template->param(loopbiblios => \@additems,);
+                      
+ output_html_with_http_headers $input, $cookie, $template->output;
\ No newline at end of file

Index: histsearch.pl
===================================================================
RCS file: histsearch.pl
diff -N histsearch.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ histsearch.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+
+# 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
+
+# $Id: histsearch.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+
+=head1 NAME
+
+histsearch.pl
+
+=head1 DESCRIPTION
+this script offer a interface to search among order.
+
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item title
+if the script has to filter the results on title.
+
+=item author
+if the script has to filter the results on author.
+
+=item name
+if the script has to filter the results on supplier.
+
+=item fromplacedon
+to filter on started date.
+
+=item toplacedon
+to filter on ended date.
+
+=back
+
+=cut
+
+use strict;
+require Exporter;
+use CGI;
+use C4::Auth;       # get_template_and_user
+use C4::Interface::CGI::Output;
+use C4::Acquisition;
+
+my $input = new CGI;
+my $title = $input->param('title');
+my $author = $input->param('author');
+my $name = $input->param('name');
+my $from_placed_on = $input->param('fromplacedon');
+my $to_placed_on = $input->param('toplacedon');
+
+my $dbh = C4::Context->dbh;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "acqui/histsearch.tmpl",
+			     query => $input,
+			     type => "intranet",
+			     authnotrequired => 0,
+			     flagsrequired => {acquisition => 1},
+			     debug => 1,
+			     });
+my ($order_loop,$total_qty,$total_price,$total_qtyreceived)= &GetHistory($title,$author,$name,$from_placed_on,$to_placed_on);
+$template->param(suggestions_loop => $order_loop,
+				total_qty => $total_qty,
+				total_qtyreceived => $total_qtyreceived,
+				total_price => sprintf  ("%.2f",$total_price),
+				numresults => scalar(@$order_loop),
+				title => $title,
+				author => $author,
+				name => $name,
+				from_placed_on =>$from_placed_on,
+				to_placed_on =>$to_placed_on,
+				intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+		IntranetNav => C4::Context->preference("IntranetNav"),
+);
+output_html_with_http_headers $input, $cookie, $template->output;

Index: lateorders.pl
===================================================================
RCS file: lateorders.pl
diff -N lateorders.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lateorders.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,122 @@
+#!/usr/bin/perl
+
+# 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
+
+# $Id: lateorders.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+=head1 NAME
+
+lateorders.pl
+
+=head1 DESCRIPTION
+
+this script shows late orders for a specific supplier, branch and delay
+given on input arg.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item supplierid
+To know on which supplier this script have to display late order.
+
+=item delay
+To know the time boundary. Default value is 30 days.
+
+=item branch
+To know on which branch this script have to display late order.
+
+=back
+
+=cut
+
+use strict;
+use CGI;
+use C4::Bookseller;
+use C4::Auth;
+use C4::Koha;
+use C4::Output;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use C4::Acquisition;
+
+my $query = new CGI;
+my ($template, $loggedinuser, $cookie)
+= get_template_and_user(
+                {template_name => "acqui/lateorders.tmpl",
+				query => $query,
+				type => "intranet",
+				authnotrequired => 0,
+				flagsrequired => {acquisition => 1},
+				debug => 1,
+				});
+
+my $supplierid = $query->param('supplierid');
+my $delay = $query->param('delay');
+my $branch = $query->param('branch');
+
+#default value for delay
+$delay = 30 unless $delay;
+
+my %supplierlist = GetBooksellersWithLateOrders($delay,$branch);
+my @select_supplier;
+push @select_supplier,"";
+foreach my $supplierid (keys %supplierlist){
+	push @select_supplier, $supplierid;
+}
+
+my $CGIsupplier=CGI::scrolling_list( -name     => 'supplierid',
+			-values   => \@select_supplier,
+			-default  => $supplierid,
+			-labels   => \%supplierlist,
+			-size     => 1,
+			-tabindex=>'',
+			-multiple => 0 );
+
+$template->param(Supplier=>$supplierlist{$supplierid}) if ($supplierid);
+
+my $branches = GetBranches;
+
+my @branchloop;
+foreach my $thisbranch (sort keys %$branches) {
+	my %row =(value => $thisbranch,
+				branchname => $branches->{$thisbranch}->{'branchname'},
+			);
+	push @branchloop, \%row;
+}
+my $CGIbranch=CGI::scrolling_list( -name     => 'branch',
+				-values   => \@branchloop,
+				-labels   => $branches,
+				-size     => 1,
+ 				-tabindex=>'',
+				-multiple => 0 );
+
+my @lateorders = GetLateOrders($delay,$supplierid,$branch);
+my $count = scalar @lateorders;
+
+my $total;
+foreach my $lateorder (@lateorders){
+	$total+=$lateorder->{subtotal};
+}
+$template->param(delay=>$delay) if ($delay);
+$template->param(
+	branchloop => \@branchloop,
+	CGIsupplier => $CGIsupplier,
+	lateorders => \@lateorders,
+	total=>$total,
+	intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+	);
+output_html_with_http_headers $query, $cookie, $template->output;

Index: neworderempty.pl
===================================================================
RCS file: neworderempty.pl
diff -N neworderempty.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ neworderempty.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,315 @@
+#!/usr/bin/perl
+
+#script to show display basket of orders
+#written by chris at katipo.co.nz 24/2/2000
+
+# 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
+
+
+=head1 NAME
+
+neworderempty.pl
+
+=head1 DESCRIPTION
+this script allows to create a new record to order it. This record shouldn't exist
+on database.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item booksellerid
+the bookseller the librarian has to buy a new book.
+
+=item title
+the title of this new record.
+
+=item author
+the author of this new record.
+
+=item copyright
+the copyright of this new record.
+
+=item ordnum
+the number of this order.
+
+=item biblio
+
+=item basketno
+the basket number for this new order.
+
+=item suggestionid
+if this order comes from a suggestion.
+
+=item close
+
+=back
+
+=cut
+
+use strict;
+use CGI;
+use C4::Context;
+use C4::Auth;
+use C4::Bookfund;
+use C4::Bookseller;
+use C4::Acquisition;
+use C4::Suggestions;
+use C4::Biblio;
+use C4::Search;
+use C4::Koha;
+use C4::Interface::CGI::Output;
+use C4::Members;
+use C4::Input;
+use C4::Date;
+
+my $input        = new CGI;
+my $booksellerid = $input->param('booksellerid');
+my $title        = $input->param('title');
+my $author       = $input->param('author');
+my $copyright    = $input->param('copyright');
+my @booksellers  = GetBookSeller($booksellerid);
+my $count        = scalar @booksellers;
+my $ordnum       = $input->param('ordnum');
+my $biblionumber       = $input->param('biblionumber');
+my $basketno     = $input->param('basketno');
+my $suggestionid = $input->param('suggestionid');
+my $close        = $input->param('close');
+my $data;
+my $new;
+
+my $dbh = C4::Context->dbh;
+
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+    {
+        template_name   => "acqui/neworderempty.tmpl",
+        query           => $input,
+        type            => "intranet",
+        authnotrequired => 0,
+        flagsrequired   => { acquisition => 1 },
+        debug           => 1,
+    }
+);
+my $me= C4::Context->userenv;
+my $homebranch=$me->{'branch'} ;
+my $branch;
+my $bookfundid;
+my $discount= $booksellers[0]->{'discount'};
+my $gstrate=C4::Context->preference('gist')*100;
+if ( $ordnum eq '' ) {    # create order
+    $new = 'yes';
+    if ( $biblionumber  ) {
+	my $record=XMLgetbibliohash($dbh,$biblionumber);
+          ###Error checking if a non existent biblionumber given manually
+	if (!$record){
+	print $input->redirect("/cgi-bin/koha/acqui/basket.pl?supplierid=$booksellerid");
+	}
+	 $data = XMLmarc2koha_onerecord($dbh,$record,"biblios");
+    }elsif($suggestionid){
+	$data = GetSuggestion($suggestionid);
+    
+   	 if ( $data->{'title'} eq '' ) {
+        	$data->{'title'}         = $title;
+       	 $data->{'author'}        = $author;
+       	 $data->{'copyrightdate'} = $copyright;
+    	}
+   }### if biblionumber
+ if ($basketno){
+	 my $basket = GetBasket( $basketno);
+	my @orders=GetOrders($basketno);
+		if (@orders){
+		$template->param(
+    		purchaseordernumber     =>  $orders[0]->{purchaseordernumber}, );
+		}
+	$template->param(
+    	creationdate     => format_date( $basket->{creationdate} ),
+    	authorisedbyname => $basket->{authorisedbyname},);
+  }else{
+	
+	my $date = get_today();
+	$template->param(
+    	creationdate     => format_date($date),
+    	authorisedbyname => $loggedinuser,);
+  }
+}else {    #modify order
+    $data   = GetSingleOrder($ordnum);
+    $biblionumber = $data->{'biblionumber'};
+    #get basketno and suppleirno. too!
+    my $data2 = GetBasket( $data->{'basketno'} );
+    $basketno     = $data->{'basketno'};
+    $booksellerid = $data2->{'booksellerid'};
+    $discount=$data->{'discount'};
+       $gstrate=$data->{'gst'} ;
+    $bookfundid =$data->{'bookfundid'};
+ my $aqbookfund=GetBookFund($data->{'bookfundid'});
+$branch=$aqbookfund->{branchcode};
+$template->param(	
+	purchaseordernumber     =>  $data->{purchaseordernumber},
+    	creationdate     => format_date( $data2->{creationdate} ),
+    	authorisedbyname => $data2->{authorisedbyname},);
+	
+}
+
+
+
+# get currencies (for exchange rates calcs if needed)
+my @rates = GetCurrencies();
+my $count = scalar @rates;
+
+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;
+}
+
+
+
+
+
+# build branches list
+my $branches = GetBranches;
+my @branchloop;
+foreach my $thisbranch ( sort keys %$branches ) {
+my $selected=1 if $thisbranch eq $branch;
+     my %row = ( 
+        value      => $thisbranch,
+        branchname => $branches->{$thisbranch}->{'branchname'},
+	selected=>$selected ,
+    );
+    push @branchloop, \%row;
+}
+$template->param( branchloop => \@branchloop );
+
+# build bookfund list
+
+my $count2;
+my @bookfund;
+my @select_bookfund;
+my %select_bookfunds;
+my $selbookfund;
+ at bookfund = GetBookFunds($homebranch);
+$count2 = scalar @bookfund;
+
+for ( my $i = 0 ; $i < $count2 ; $i++ ) {
+    push @select_bookfund, $bookfund[$i]->{'bookfundid'};
+    $select_bookfunds{ $bookfund[$i]->{'bookfundid'} } =
+      $bookfund[$i]->{'bookfundname'};
+	if ($bookfund[$i]->{'bookfundid'} eq $bookfundid){
+	$selbookfund=1;
+	}
+}
+my $CGIbookfund = CGI::scrolling_list(
+    -name     => 'bookfundid',
+    -values   => \@select_bookfund,
+    -default  => $data->{'bookfundid'},
+    -labels   => \%select_bookfunds,
+    -size     => 1,
+    -selected =>$selbookfund,
+    -multiple => 0
+);
+
+my $bookfundname;
+
+if ($close) {
+    $bookfundid   = $data->{'bookfundid'};
+    $bookfundname = $select_bookfunds{$bookfundid};
+}
+
+#Build sort lists
+my $CGIsort1 = buildCGIsort( "Asort1", "sort1", $data->{'sort1'} );
+if ($CGIsort1) {
+    $template->param( CGIsort1 => $CGIsort1 );
+}
+else {
+    $template->param( sort1 => $data->{'sort1'} );
+}
+
+my $CGIsort2 = buildCGIsort( "Asort2", "sort2", $data->{'sort2'} );
+if ($CGIsort2) {
+    $template->param( CGIsort2 => $CGIsort2 );
+}
+else {
+    $template->param( sort2 => $data->{'sort2'} );
+}
+
+my $bibitemsexists;
+
+#
+
+    $template->param( bibitemexists => "1" ) if $biblionumber;
+	 my @bibitemloop;
+          my %line;
+        $line{isbn}             = $data->{'isbn'};
+        $line{itemtype}         = $data->{'itemtype'};
+        $line{volumeddesc}      = $data->{'volumeddesc'};
+        push( @bibitemloop, \%line );
+
+        $template->param( bibitemloop => \@bibitemloop );
+    
+
+
+# fill template
+$template->param(
+    close        => $close,
+    bookfundid   => $bookfundid,
+    bookfundname => $bookfundname
+  )
+  if ($close);
+
+$template->param(
+    existing         => $biblionumber,
+    ordnum           => $ordnum,
+    basketno         => $basketno,
+    booksellerid     => $booksellerid,
+    suggestionid     => $suggestionid,
+    biblionumber           => $biblionumber,
+    itemtype         => $data->{'itemtype'},
+    discount         => $discount,
+    listincgst       => $booksellers[0]->{'listincgst'},
+    listprice        => $booksellers[0]->{'listprice'},
+    gstreg           => $booksellers[0]->{'gstreg'},
+    invoiceinc       => $booksellers[0]->{'invoiceincgst'},
+    invoicedisc      => $booksellers[0]->{'invoicedisc'},
+    nocalc           => $booksellers[0]->{'nocalc'},
+    name             => $booksellers[0]->{'name'},
+    currency         => $booksellers[0]->{'listprice'},
+    gstrate          =>$gstrate,
+    loop_currencies  => \@loop_currency,
+    orderexists      => ( $new eq 'yes' ) ? 0 : 1,
+    title            => $data->{'title'},
+    author           => $data->{'author'},
+    copyrightdate    => $data->{'copyrightdate'},
+    CGIbookfund      => $CGIbookfund,
+    isbn             => $data->{'isbn'},
+    seriestitle      => $data->{'seriestitle'},
+    quantity         => $data->{'quantity'},
+    listprice        => $data->{'listprice'},
+    rrp              => $data->{'rrp'},
+    invoice          => $data->{'booksellerinvoicenumber'},
+    ecost            => $data->{'ecost'},
+    total		=>$data->{'unitprice'}* $data->{'quantity'},
+  unitprice            => $data->{'unitprice'},
+ gst        => $data->{'ecost'}*$gstrate/100,
+    notes            => $data->{'notes'},
+    publishercode    => $data->{'publishercode'},
+#     donation         => $donation
+);
+
+output_html_with_http_headers $input, $cookie, $template->output;

Index: newordersuggestion.pl
===================================================================
RCS file: newordersuggestion.pl
diff -N newordersuggestion.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ newordersuggestion.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,172 @@
+#!/usr/bin/perl
+
+# 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
+
+# $Id: newordersuggestion.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+=head1 NAME
+newordersuggestion.pl
+
+=head1 DESCRIPTION
+this script allow to add an order from a existing suggestion.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item basketno
+the number of this basket.
+
+=item booksellerid
+the bookseller who sells this record.
+
+=item title
+the title of this record suggested.
+
+=item author
+the author of this suggestion.
+
+=item note
+this param allow to enter a note with this suggestion.
+
+=item copyrightdate
+the copyright date for this suggestion.
+
+=item publishercode
+
+=item volumedesc
+
+=item publicationyear
+the publication year of this record.
+
+=item place
+
+=item isbn
+the isbn of this suggestion.
+
+=item duplicateNumber
+is the biblionumber to put to the new suggestion.
+
+=item suggestionid
+the id of the suggestion to select.
+
+=item op
+can be equal to
+    * connectDuplicate :
+        then call to the function : ConnectSuggestionAndBiblio.
+        i.e set the biblionumber of this suggestion.
+    * else :
+        is the default value.
+=back
+
+=cut
+
+use strict;
+require Exporter;
+use CGI;
+use C4::Auth;       # get_template_and_user
+use C4::Interface::CGI::Output;
+use C4::Suggestions;
+use C4::Biblio;
+use C4::Search;
+
+my $input = new CGI;
+
+my $basketno = $input->param('basketno');
+my $supplierid = $input->param('booksellerid');
+my $title = $input->param('title');
+my $author = $input->param('author');
+my $note = $input->param('note');
+my $copyrightdate =$input->param('copyrightdate');
+my $publishercode = $input->param('publishercode');
+my $volumedesc = $input->param('volumedesc');
+my $publicationyear = $input->param('publicationyear');
+my $place = $input->param('place');
+my $isbn = $input->param('isbn');
+my $duplicateNumber = $input->param('duplicateNumber');
+my $suggestionid = $input->param('suggestionid');
+
+my $status = 'ACCEPTED'; # the suggestion had to be accepeted before to order it.
+my $suggestedbyme = -1; # search ALL suggestors
+my $op = $input->param('op');
+$op = 'else' unless $op;
+
+my $dbh = C4::Context->dbh;
+my ($template, $borrowernumber, $cookie)
+    = get_template_and_user({template_name => "acqui/newordersuggestion.tmpl",
+			     type => "intranet",
+			     query => $input,
+			     authnotrequired => 1,
+			     flagsrequired => {acquisition => 1},
+			 });
+
+if ($op eq 'connectDuplicate') {
+	ConnectSuggestionAndBiblio($suggestionid,$duplicateNumber);
+}
+my $suggestions_loop= &SearchSuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
+foreach (@$suggestions_loop) {
+	unless ($_->{biblionumber}) {
+		my (@kohafields, @and_or, @value, @relation,  $offset,$length);
+		# search on biblio.title
+		if ($_->{title}) {
+			push @kohafields, "title";
+			push @and_or, "\@and";
+			push @relation, "\@attr 5=1";
+			push @value, $_->{title};
+		}
+		if ($_->{author}) {
+			push @kohafields, "author";
+			push @and_or, "\@and";
+			push @relation, "";
+			push @value, $_->{author};
+		}
+		# ... and on publicationyear.
+		if ($_->{publicationyear}) {
+			push @kohafields, "copyrightdate";
+			push @and_or, "\@and";
+			push @relation, "";
+			push @value, $_->{publicationyear};
+		}
+		# ... and on publisher.
+		if ($_->{publishercode}) {
+			push @kohafields, "publishercode";
+			push @and_or, "\@and";
+			push @relation, "";
+			push @value, $_->{publishercode};
+		}
+	
+		my ($nbresult,$facets, at finalresult) = ZEBRAsearch_kohafields(\@kohafields,\@value,\@relation,"",\@and_or,0,"",0,1);
+
+		# there is at least 1 result => return the 1st one
+		if ($nbresult) {
+			$_->{duplicateBiblionumber} = $finalresult[0]->{biblionumber};
+		}
+	}
+}
+$template->param(suggestions_loop => $suggestions_loop,
+				title => $title,
+				author => $author,
+				publishercode => $publishercode,
+				status => $status,
+				suggestedbyme => $suggestedbyme,
+				basketno => $basketno,
+				supplierid => $supplierid,
+				"op_$op" => 1,
+				intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+		IntranetNav => C4::Context->preference("IntranetNav"),
+);
+output_html_with_http_headers $input, $cookie, $template->output;

Index: parcel.pl
===================================================================
RCS file: parcel.pl
diff -N parcel.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ parcel.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,187 @@
+#!/usr/bin/perl
+
+# $Id: parcel.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+#script to recieve orders
+#written by chris at katipo.co.nz 24/2/2000
+
+
+# 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
+
+
+=head1 NAME
+
+parcel.pl
+
+=head1 DESCRIPTION
+This script shows all orders receipt or pending for a given supplier.
+It allows to write an order as 'received' when he arrives.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item supplierid
+To know the supplier this script has to show orders.
+
+=item code
+is the bookseller invoice number.
+
+=item freight
+
+
+=item gst
+
+
+=item datereceived
+To filter the results list on this given date.
+
+=back
+
+=cut
+use strict;
+use C4::Auth;
+use C4::Acquisition;
+use C4::Bookseller;
+use C4::Bookfund;
+use C4::Biblio;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Date;
+use Time::localtime;
+
+
+my $input=new CGI;
+my $supplierid=$input->param('supplierid');
+my $basketno=$input->param('basketno');
+my @booksellers=GetBookSeller($supplierid);
+my $count = scalar @booksellers;
+
+my @datetoday = localtime();
+my $date = (1900+$datetoday[5])."-".($datetoday[4]+1)."-". $datetoday[3];
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "acqui/parcel.tmpl",
+                 query => $input,
+                 type => "intranet",
+                 authnotrequired => 0,
+                 flagsrequired => {acquisition => 1},
+                 debug => 1,
+});
+
+my @booksellers=GetBookSeller($supplierid);
+
+my $gstreg=$booksellers[0]->{gstreg};
+my $incgst=$booksellers[0]->{'invoiceincgst'};
+my $invcurrency=$booksellers[0]->{'invoiceprice'};
+my $discount=$booksellers[0]->{'discount'};
+my $currencyrate;
+# get currencies (for exchange rates calcs if needed)
+my @rates = GetCurrencies();
+my $count = scalar @rates;
+
+for ( my $i = 0 ; $i < $count ; $i++ ) {
+ if ($rates[$i]->{'currency'} eq $invcurrency){
+    $currencyrate     = $rates[$i]->{'rate'};
+   }
+}
+my $me=C4::Context->userenv;
+my $user=$me->{'cardnumber'};
+my $totalprice=0;
+my $totalfreight=0;
+my $totalquantity=0;
+my $totaldiscount=0;
+my $total;
+my $tototal;
+my $toggle;
+my $totalgst;
+my $totaltoreceive;
+my $totaltoprice;
+my $totaltogst;
+my $totaltodiscount;
+my @loop_orders;
+my $countpendings;
+my $invoice;
+##Receiving a single basket or all baskets of a supplier
+unless($basketno){
+my $pendingorders = GetPendingOrders($supplierid);
+$countpendings = scalar @$pendingorders;
+foreach my $pendingorder (@$pendingorders){
+ my @orders=GetOrders($pendingorder->{basketno});
+  foreach my $order(@orders){
+  $order->{toreceive}=$order->{quantity} - $order->{quantityreceived};
+  $totalquantity+=$order->{quantity};
+  $totaltoreceive+=$order->{toreceive};
+  $totalprice+=$order->{rrp}*$order->{quantity};
+  $totaltoprice+=$order->{rrp}*$order->{toreceive};
+  $totalgst+=(($order->{rrp}*$order->{quantity}) -($order->{rrp}*$order->{quantity}*$order->{discount}/100))* $order->{gst}/100;
+  $totaltogst+=(($order->{rrp}*$order->{toreceive}) -($order->{rrp}*$order->{toreceive}*$order->{discount}/100))* $order->{gst}/100;
+  $totaldiscount +=$order->{rrp}*$order->{quantity}*$order->{discount}/100;
+  $totaltodiscount +=$order->{rrp}*$order->{toreceive}*$order->{discount}/100;
+  $order->{actualrrp}=sprintf( "%.2f",$order->{rrp}/$currencyrate);
+	push @loop_orders, $order;
+  }	
+}
+  
+}else{
+## one basket
+$countpendings=1;
+
+my @orders=GetOrders($basketno);
+  foreach my $order(@orders){
+$invoice=$order->{booksellerinvoicenumber} unless $invoice;
+  $order->{toreceive}=$order->{quantity} - $order->{quantityreceived};
+  $totalquantity+=$order->{quantity};
+  $totaltoreceive+=$order->{toreceive};
+  $totalprice+=$order->{rrp}*$order->{quantity};
+  $totaltoprice+=$order->{rrp}*$order->{toreceive};
+  $totalgst+=(($order->{rrp}*$order->{quantity}) -($order->{rrp}*$order->{quantity}*$order->{discount}/100))* $order->{gst}/100;
+  $totaltogst+=(($order->{rrp}*$order->{toreceive}) -($order->{rrp}*$order->{toreceive}*$order->{discount}/100))* $order->{gst}/100;
+  $totaldiscount +=$order->{rrp}*$order->{quantity}*$order->{discount}/100;
+  $totaltodiscount +=$order->{rrp}*$order->{toreceive}*$order->{discount}/100;
+  $order->{actualrrp}=sprintf( "%.2f",$order->{rrp}/$currencyrate);
+	push @loop_orders, $order;
+  }	
+}
+undef $invcurrency if ($currencyrate ==1);
+
+$template->param( invoice=>$invoice,
+                        date => format_date($date),
+                        name => $booksellers[0]->{'name'},
+                        supplierid => $supplierid,
+                        countpending => $countpendings,
+                        loop_orders => \@loop_orders,
+ 	          user=>$user,
+	         totalquantity=>$totalquantity,
+	         totaltoreceive=>$totaltoreceive,
+	          totalprice=>sprintf( "%.2f",$totalprice),
+	         totalactual =>sprintf( "%.2f",$totaltoprice/$currencyrate),
+                        totalgst=>sprintf( "%.2f",$totalgst),
+                        actualgst=>sprintf( "%.2f",$totaltogst/$currencyrate),
+		totaldiscount=>sprintf( "%.2f",$totaldiscount),
+		actualdiscount=>sprintf( "%.2f",$totaltodiscount/$currencyrate),	
+		total=>sprintf( "%.2f",$totalprice+$totalgst-$totaldiscount),
+		gstreg=>$gstreg,
+                            gstrate=>C4::Context->preference('gist')*100,
+		currencyrate=>$currencyrate,
+		incgst =>$incgst,
+		invcurrency=>$invcurrency ,
+                        intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+        intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+        IntranetNav => C4::Context->preference("IntranetNav"),
+                        );
+output_html_with_http_headers $input, $cookie, $template->output;

Index: select-late.pl
===================================================================
RCS file: select-late.pl
diff -N select-late.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ select-late.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+
+# $Id: select-late.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+#script to show suppliers and orders
+#written by chris at katipo.co.nz 23/2/2000
+
+
+# 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::Auth;
+use C4::Biblio;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Context;
+use C4::Date;
+use C4::Acquisition;
+
+my $query=new CGI;
+my $dbh = C4::Context->dbh;
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "acqui/select-late.tmpl",
+			     query => $query,
+			     type => "intranet",
+			     authnotrequired => 0,
+			     flagsrequired => {acquisition => 1},
+			     debug => 1,
+			     });
+
+my $supplier=$query->param('id');
+my @suppliers=GetBookSeller($supplier);
+my $count = scalar @suppliers;
+
+my $sth = $dbh->prepare("select s.serialseq from serial s, subscription u where s.subscriptionid = u.subscriptionid and u.aqbooksellerid = ? and s.status = 2");
+
+$sth->execute($supplier);
+my  @final;
+while (my $sol = $sth->fetchrow_hashref)
+{
+    push @final, $sol;
+}
+
+$template->param(@loop_sol => \@final);
+
+my $colour='#EEEEEE';
+my $toggle=0;
+my @loop_suppliers;
+for (my $i=0; $i<$count; $i++) {
+	my $orders = GetPendingOrders($suppliers[$i]->{'id'});
+    my $ordcount = scalar @$orders;
+    
+	my %line;
+	if ($toggle==0){
+		$line{color}='#EEEEEE';
+		$toggle=1;
+	} else {
+		$line{color}='white';
+		$toggle=0;
+	}
+	$line{id} =$suppliers[$i]->{'id'};
+	$line{name} = $suppliers[$i]->{'name'};
+	$line{active} = $suppliers[$i]->{'active'};
+	$line{total} = $orders->[0]->{'count(*)'};
+	$line{authorisedby} = $orders->[0]->{'authorisedby'};
+	$line{entrydate} = $orders->[0]->{'entrydate'};
+	my @loop_basket;
+	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} = format_date($orders->[$i2]->{'entrydate'});
+		push @loop_basket, \%inner_line;
+	}
+	$line{loop_basket} = \@loop_basket;
+	push @loop_suppliers, \%line;
+}
+$template->param(loop_suppliers => \@loop_suppliers,
+						supplier => $supplier,
+						count => $count,
+						intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
+		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
+		IntranetNav => C4::Context->preference("IntranetNav"),
+						);
+
+output_html_with_http_headers $query, $cookie, $template->output;

Index: supplier.pl
===================================================================
RCS file: supplier.pl
diff -N supplier.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ supplier.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+# $Id: supplier.pl,v 1.1.2.1 2007/03/10 01:07:50 tgarip1957 Exp $
+
+#script to show display basket of orders
+#written by chris at katipo.co.nz 24/2/2000
+
+# 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
+
+=head1 NAME
+
+supplier.pl
+
+=head1 DESCRIPTION
+this script shows the details for a bookseller given on input arg.
+It allows to edit & save information about this bookseller.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+=item supplierid
+To know the bookseller this script has to display details.
+
+=back
+
+=cut
+
+use strict;
+use C4::Auth;
+use C4::Acquisition;
+use C4::Biblio;
+use CGI;
+use C4::Interface::CGI::Output;
+use C4::Bookseller;
+use C4::Bookfund;
+
+my $query=new CGI;
+my $id=$query->param('supplierid');
+my @booksellers = GetBookSeller($id);
+my $count = scalar @booksellers;
+
+my ($template, $loggedinuser, $cookie)
+    = get_template_and_user({template_name => "acqui/supplier.tmpl",
+			     query => $query,
+			     type => "intranet",
+			     authnotrequired => 0,
+			     flagsrequired => {acquisition => 1},
+			     debug => 1,
+			     });
+
+#build array for currencies
+my @currencies = GetCurrencies();
+my $count = scalar @currencies;
+
+my @loop_pricescurrency;
+my @loop_invoicecurrency;
+for (my $i=0;$i<$count;$i++) {
+	if ($booksellers[0]->{'listprice'} eq $currencies[$i]->{'currency'}) {
+		push @loop_pricescurrency, { currency => "<option selected=\"selected\" value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>" };
+	} else {
+		push @loop_pricescurrency, { currency => "<option value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
+	}
+	if ($booksellers[0]->{'invoiceprice'} eq $currencies[$i]->{'currency'}) {
+		push @loop_invoicecurrency, { currency => "<option selected=\"selected\" value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
+	} else {
+		push @loop_invoicecurrency, { currency => "<option value=\"$currencies[$i]->{'currency'}\">$currencies[$i]->{'currency'}</option>"};
+	}
+}
+$template->param(id => $id,
+					name => $booksellers[0]->{'name'},
+					postal =>$booksellers[0]->{'postal'},
+					address1 => $booksellers[0]->{'address1'},
+					address2 => $booksellers[0]->{'address2'},
+					address3 => $booksellers[0]->{'address3'},
+					address4 => $booksellers[0]->{'address4'},
+					phone =>$booksellers[0]->{'phone'},
+					fax => $booksellers[0]->{'fax'},
+					url => $booksellers[0]->{'url'},
+					contact => $booksellers[0]->{'contact'},
+					contpos => $booksellers[0]->{'contpos'},
+					contphone => $booksellers[0]->{'contphone'},
+					contaltphone => $booksellers[0]->{'contaltphone'},
+					contfax => $booksellers[0]->{'contfax'},
+					contemail => $booksellers[0]->{'contemail'},
+					contnotes => $booksellers[0]->{'contnotes'},
+					notes => $booksellers[0]->{'notes'},
+					active => $booksellers[0]->{'active'},
+					specialty => $booksellers[0]->{'specialty'},
+					gstreg => $booksellers[0]->{'gstreg'},
+					listincgst => $booksellers[0]->{'listincgst'},
+					invoiceincgst => $booksellers[0]->{'invoiceincgst'},
+					discount => $booksellers[0]->{'discount'},
+					loop_pricescurrency => \@loop_pricescurrency,
+					loop_invoicecurrency => \@loop_invoicecurrency,);
+
+output_html_with_http_headers $query, $cookie, $template->output;

Index: updatesupplier.pl
===================================================================
RCS file: updatesupplier.pl
diff -N updatesupplier.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ updatesupplier.pl	10 Mar 2007 01:07:50 -0000	1.1.2.1
@@ -0,0 +1,96 @@
+#!/usr/bin/perl
+
+#script to show suppliers and orders
+#written by chris at katipo.co.nz 23/2/2000
+
+
+# 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
+
+=head1 NAME
+updatesupplier.pl
+
+=head1 DESCRIPTION
+this script allow to update or create (if id == 0)
+a supplier. This script is called from acqui/supplier.pl.
+
+=head1 CGI PARAMETERS
+
+=over 4
+
+All informations regarding this supplier are listed on input parameter.
+Here is the list :
+supplier, id, company, company_postal, physical, company_phone,
+physical, company_phone, company_fax, website, company_contact_name,
+company_contact_position, contact_phone, contact_phone_2, contact_fax,
+company_email, contact_notes, notes, status, publishers_imprints,
+list_currency, gst, list_gst, invoice_gst, discount.
+
+=back
+
+=cut
+
+use C4::Bookseller;
+use C4::Biblio;
+use C4::Output;
+use CGI;
+use strict;
+
+my $input=new CGI;
+#print $input->header();
+my $supplier=$input->param('supplier');
+#print startpage;
+my %data;
+$data{'id'}=$input->param('id');
+
+$data{'name'}=$input->param('company');
+$data{'postal'}=$input->param('company_postal');
+my $address=$input->param('physical');
+my @addresses=split('\n',$address);
+$data{'address1'}=$addresses[0];
+$data{'address2'}=$addresses[1];
+$data{'address3'}=$addresses[2];
+$data{'address4'}=$addresses[3];
+$data{'phone'}=$input->param('company_phone');
+$data{'fax'}=$input->param('company_fax');
+$data{'url'}=$input->param('website');
+$data{'contact'}=$input->param('company_contact_name');
+$data{'contpos'}=$input->param('company_contact_position');
+$data{'contphone'}=$input->param('contact_phone');
+$data{'contaltphone'}=$input->param('contact_phone_2');
+$data{'contfax'}=$input->param('contact_fax');
+$data{'contemail'}=$input->param('company_email');
+$data{'contnotes'}=$input->param('contact_notes');
+# warn "".$data{'contnotes'};
+$data{'notes'}=$input->param('notes');
+$data{'active'}=$input->param('status');
+$data{'specialty'}=$input->param('publishers_imprints');
+$data{'listprice'}=$input->param('list_currency');
+$data{'invoiceprice'}=$input->param('invoice_currency');
+$data{'gstreg'}=$input->param('gst');
+$data{'listincgst'}=$input->param('list_gst');
+$data{'invoiceincgst'}=$input->param('invoiceincgst');
+$data{'discount'}=$input->param('discount');
+my $id=$input->param('id');
+if ($data{'id'} != 0){
+  ModBookseller(\%data);
+} else {
+  $id=AddBookseller(\%data);
+}
+
+#redirect to booksellers.pl
+print $input->redirect("booksellers.pl?supplier=$id");





More information about the Koha-cvs mailing list