Bugzilla – Attachment 10135 Details for
Bug 5339
Parcel closing in acq
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 5339 rebased and rolled into one commit. Capstone for Elliott
Bug-5339-rebased-and-rolled-into-one-commit-Capsto.patch (text/plain), 123.48 KB, created by
MJ Ray (software.coop)
on 2012-06-10 15:55:26 UTC
(
hide
)
Description:
Bug 5339 rebased and rolled into one commit. Capstone for Elliott
Filename:
MIME Type:
Creator:
MJ Ray (software.coop)
Created:
2012-06-10 15:55:26 UTC
Size:
123.48 KB
patch
obsolete
>From 3df5b5b94a4a2a1418bab93c750ea9d524a212a6 Mon Sep 17 00:00:00 2001 >From: Elliott Davis <tdavis@uttyler.edu> >Date: Tue, 1 May 2012 08:27:32 +0000 >Subject: [PATCH] Bug 5339 rebased and rolled into one commit. Capstone for Elliott > >--- > C4/Acquisition.pm | 406 +++++++++++++++- > C4/Bookseller.pm | 5 +- > C4/Budgets.pm | 24 +- > acqui/addorderiso2709.pl | 2 - > acqui/finishreceive.pl | 12 +- > acqui/invoice.pl | 214 ++++++++ > acqui/invoices.pl | 154 ++++++ > acqui/orderreceive.pl | 34 +- > acqui/parcel.pl | 264 +++++------ > acqui/parcels.pl | 61 ++- > acqui/spent.pl | 47 ++- > catalogue/moredetail.pl | 8 +- > installer/data/mysql/kohastructure.sql | 26 +- > installer/data/mysql/updatedatabase.pl | 62 +++ > .../prog/en/includes/acquisitions-menu.inc | 1 + > .../prog/en/modules/acqui/histsearch.tt | 6 +- > .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 195 ++++++++ > .../prog/en/modules/acqui/invoices.tt | 237 +++++++++ > .../prog/en/modules/acqui/orderreceive.tt | 9 +- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 513 ++++++++++---------- > .../intranet-tmpl/prog/en/modules/acqui/parcels.tt | 85 +++-- > .../intranet-tmpl/prog/en/modules/acqui/spent.tt | 40 +- > .../prog/en/modules/catalogue/moredetail.tt | 8 +- > 23 files changed, 1888 insertions(+), 525 deletions(-) > create mode 100755 acqui/invoice.pl > create mode 100755 acqui/invoices.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt > >diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm >index bebc3a8..8717b21 100644 >--- a/C4/Acquisition.pm >+++ b/C4/Acquisition.pm >@@ -62,6 +62,15 @@ BEGIN { > &GetParcels &GetParcel > &GetContracts &GetContract > >+ &GetInvoices >+ &GetInvoice >+ &GetInvoiceDetails >+ &AddInvoice >+ &ModInvoice >+ &DelInvoice >+ &CloseInvoice >+ &ReopenInvoice >+ > &GetItemnumbersFromOrder > > &AddClaim >@@ -1138,7 +1147,7 @@ C<$ordernumber>. > sub ModReceiveOrder { > my ( > $biblionumber, $ordernumber, $quantrec, $user, $cost, >- $invoiceno, $freight, $rrp, $budget_id, $datereceived >+ $invoiceid, $rrp, $budget_id, $datereceived > ) > = @_; > my $dbh = C4::Context->dbh; >@@ -1164,14 +1173,13 @@ sub ModReceiveOrder { > UPDATE aqorders > SET quantityreceived=? > , datereceived=? >- , booksellerinvoicenumber=? >+ , invoiceid=? > , unitprice=? >- , freight=? > , rrp=? > , quantity=? > WHERE biblionumber=? AND ordernumber=?"); > >- $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$quantrec,$biblionumber,$ordernumber); >+ $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$quantrec,$biblionumber,$ordernumber); > $sth->finish; > > # create a new order for the remaining items, and set its bookfund. >@@ -1183,10 +1191,10 @@ sub ModReceiveOrder { > my $newOrder = NewOrder($order); > } else { > $sth=$dbh->prepare("update aqorders >- set quantityreceived=?,datereceived=?,booksellerinvoicenumber=?, >- unitprice=?,freight=?,rrp=? >+ set quantityreceived=?,datereceived=?,invoiceid=?, >+ unitprice=?,rrp=? > where biblionumber=? and ordernumber=?"); >- $sth->execute($quantrec,$datereceived,$invoiceno,$cost,$freight,$rrp,$biblionumber,$ordernumber); >+ $sth->execute($quantrec,$datereceived,$invoiceid,$cost,$rrp,$biblionumber,$ordernumber); > $sth->finish; > } > return $datereceived; >@@ -1341,9 +1349,10 @@ sub GetParcel { > LEFT JOIN aqbasket ON aqbasket.basketno=aqorders.basketno > LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber > LEFT JOIN biblio ON aqorders.biblionumber=biblio.biblionumber >+ LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid > WHERE > aqbasket.booksellerid = ? >- AND aqorders.booksellerinvoicenumber LIKE ? >+ AND aqinvoices.invoicenumber LIKE ? > AND aqorders.datereceived = ? "; > > my @query_params = ( $supplierid, $code, $datereceived ); >@@ -1416,18 +1425,19 @@ sub GetParcels { > my $dbh = C4::Context->dbh; > my @query_params = (); > my $strsth =" >- SELECT aqorders.booksellerinvoicenumber, >+ SELECT aqinvoices.invoicenumber, > datereceived,purchaseordernumber, > count(DISTINCT biblionumber) AS biblio, > sum(quantity) AS itemsexpected, > sum(quantityreceived) AS itemsreceived > FROM aqorders LEFT JOIN aqbasket ON aqbasket.basketno = aqorders.basketno >+ LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid > WHERE aqbasket.booksellerid = ? and datereceived IS NOT NULL > "; > push @query_params, $bookseller; > > if ( defined $code ) { >- $strsth .= ' and aqorders.booksellerinvoicenumber like ? '; >+ $strsth .= ' and aqinvoices.invoicenumber like ? '; > # add a % to the end of the code to allow stemming. > push @query_params, "$code%"; > } >@@ -1442,7 +1452,7 @@ sub GetParcels { > push @query_params, $dateto; > } > >- $strsth .= "group by aqorders.booksellerinvoicenumber,datereceived "; >+ $strsth .= "group by aqinvoices.invoicenumber,datereceived "; > > # can't use a placeholder to place this column name. > # but, we could probably be checking to make sure it is a column that will be fetched. >@@ -1657,7 +1667,7 @@ sub GetHistory { > aqorders.quantityreceived, > aqorders.ecost, > aqorders.ordernumber, >- aqorders.booksellerinvoicenumber as invoicenumber, >+ aqinvoices.invoicenumber, > aqbooksellers.id as id, > aqorders.biblionumber > FROM aqorders >@@ -1665,7 +1675,8 @@ sub GetHistory { > LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid=aqbasketgroups.id > LEFT JOIN aqbooksellers ON aqbasket.booksellerid=aqbooksellers.id > LEFT JOIN biblioitems ON biblioitems.biblionumber=aqorders.biblionumber >- LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber"; >+ LEFT JOIN biblio ON biblio.biblionumber=aqorders.biblionumber >+ LEFT JOIN aqinvoices ON aqorders.invoiceid = aqinvoices.invoiceid"; > > $query .= " LEFT JOIN borrowers ON aqbasket.authorisedby=borrowers.borrowernumber" > if ( C4::Context->preference("IndependantBranches") ); >@@ -1716,8 +1727,8 @@ sub GetHistory { > } > > if ($booksellerinvoicenumber) { >- $query .= " AND (aqorders.booksellerinvoicenumber LIKE ? OR aqbasket.booksellerinvoicenumber LIKE ?)"; >- push @query_params, "%$booksellerinvoicenumber%", "%$booksellerinvoicenumber%"; >+ $query .= " AND aqinvoices.invoicenumber LIKE ? "; >+ push @query_params, "%$booksellerinvoicenumber%"; > } > > if ( C4::Context->preference("IndependantBranches") ) { >@@ -1858,7 +1869,372 @@ sub AddClaim { > "; > my $sth = $dbh->prepare($query); > $sth->execute($ordernumber); >+} >+ >+=head3 GetInvoices >+ >+ my @invoices = GetInvoices( >+ invoicenumber => $invoicenumber, >+ suppliername => $suppliername, >+ shipmentdatefrom => $shipmentdatefrom, # ISO format >+ shipmentdateto => $shipmentdateto, # ISO format >+ billingdatefrom => $billingdatefrom, # ISO format >+ billingdateto => $billingdateto, # ISO format >+ isbneanissn => $isbn_or_ean_or_issn, >+ title => $title, >+ invoicenote => $invoicenote >+ author => $author, >+ publisher => $publisher, >+ publicationyear => $publicationyear, >+ branchcode => $branchcode, >+ order_by => $order_by >+ ); >+ >+Return a list of invoices that match all given criteria. >+ >+$order_by is "column_name (asc|desc)", where column_name is any of >+'invoicenumber', 'booksellerid', 'shipmentdate', 'billingdate', 'closedate', >+'shipmentcost', 'shipmentcost_budgetid'. >+ >+asc is the default if omitted >+ >+=cut >+ >+sub GetInvoices { >+ my %args = @_; >+ >+ my @columns = qw(invoicenumber booksellerid shipmentdate billingdate >+ closedate shipmentcost shipmentcost_budgetid invoicenote); >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ SELECT aqinvoices.*, aqbooksellers.name AS suppliername, >+ COUNT( >+ DISTINCT IF( >+ aqorders.datereceived IS NOT NULL, >+ aqorders.biblionumber, >+ NULL >+ ) >+ ) AS receivedbiblios, >+ SUM(aqorders.quantityreceived) AS receiveditems >+ FROM aqinvoices >+ LEFT JOIN aqbooksellers ON aqbooksellers.id = aqinvoices.booksellerid >+ LEFT JOIN aqorders ON aqorders.invoiceid = aqinvoices.invoiceid >+ LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber >+ LEFT JOIN biblioitems ON biblio.biblionumber = biblioitems.biblionumber >+ LEFT JOIN subscription ON biblio.biblionumber = subscription.biblionumber >+ }; >+ >+ my @bind_args; >+ my @bind_strs; >+ if($args{supplierid}) { >+ push @bind_strs, " aqinvoices.booksellerid = ? "; >+ push @bind_args, $args{supplierid}; >+ } >+ if($args{invoicenumber}) { >+ push @bind_strs, " aqinvoices.invoicenumber LIKE ? "; >+ push @bind_args, "%$args{invoicenumber}%"; >+ } >+ if($args{invoicenote}) { >+ push @bind_strs, " aqinvoices.invoicenote LIKE ? "; >+ push @bind_args, "%$args{invoicenote}%"; >+ } >+ if($args{suppliername}) { >+ push @bind_strs, " aqbooksellers.name LIKE ? "; >+ push @bind_args, "%$args{suppliername}%"; >+ } >+ if($args{shipmentdatefrom}) { >+ push @bind_strs, " aqinvoices.shipementdate >= ? "; >+ push @bind_args, $args{shipementdatefrom}; >+ } >+ if($args{shipmentdateto}) { >+ push @bind_strs, " aqinvoices.shipementdate <= ? "; >+ push @bind_args, $args{shipementdateto}; >+ } >+ if($args{billingdatefrom}) { >+ push @bind_strs, " aqinvoices.billingdate >= ? "; >+ push @bind_args, $args{billingdatefrom}; >+ } >+ if($args{billingdateto}) { >+ push @bind_strs, " aqinvoices.billingdate <= ? "; >+ push @bind_args, $args{billingdateto}; >+ } >+ if($args{isbneanissn}) { >+ push @bind_strs, " (biblioitems.isbn LIKE ? OR biblioitems.ean LIKE ? OR biblioitems.issn LIKE ? ) "; >+ push @bind_args, $args{isbneanissn}, $args{isbneanissn}, $args{isbneanissn}; >+ } >+ if($args{title}) { >+ push @bind_strs, " biblio.title LIKE ? "; >+ push @bind_args, $args{title}; >+ } >+ if($args{author}) { >+ push @bind_strs, " biblio.author LIKE ? "; >+ push @bind_args, $args{author}; >+ } >+ if($args{publisher}) { >+ push @bind_strs, " biblioitems.publishercode LIKE ? "; >+ push @bind_args, $args{publisher}; >+ } >+ if($args{publicationyear}) { >+ push @bind_strs, " biblioitems.publicationyear = ? "; >+ push @bind_args, $args{publicationyear}; >+ } >+ if($args{branchcode}) { >+ push @bind_strs, " aqorders.branchcode = ? "; >+ push @bind_args, $args{branchcode}; >+ } >+ >+ $query .= " WHERE " . join(" AND ", @bind_strs) if @bind_strs; >+ $query .= " GROUP BY aqinvoices.invoiceid "; >+ >+ if($args{order_by}) { >+ my ($column, $direction) = split / /, $args{order_by}; >+ if(grep /^$column$/, @columns) { >+ $direction ||= 'ASC'; >+ $query .= " ORDER BY $column $direction"; >+ } >+ } >+ >+ my $sth = $dbh->prepare($query); >+ $sth->execute(@bind_args); >+ >+ my $results = $sth->fetchall_arrayref({}); >+ return @$results; >+} >+ >+=head3 GetInvoice >+ >+ my $invoice = GetInvoice($invoiceid); >+ >+Get informations about invoice with given $invoiceid >+ >+Return a hash filled with aqinvoices.* fields >+ >+=cut >+ >+sub GetInvoice { >+ my ($invoiceid) = @_; >+ my $invoice; >+ >+ return unless $invoiceid; >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ SELECT * >+ FROM aqinvoices >+ WHERE invoiceid = ? >+ }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); >+ >+ $invoice = $sth->fetchrow_hashref; >+ return $invoice; >+} >+ >+=head3 GetInvoiceDetails >+ >+ my $invoice = GetInvoiceDetails($invoiceid) >+ >+Return informations about an invoice + the list of related order lines >+ >+Orders informations are in $invoice->{orders} (array ref) >+ >+=cut >+ >+sub GetInvoiceDetails { >+ my ($invoiceid) = @_; >+ my $invoice; >+ >+ return unless $invoiceid; >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ SELECT aqinvoices.*, aqbooksellers.name AS suppliername >+ FROM aqinvoices >+ LEFT JOIN aqbooksellers ON aqinvoices.booksellerid = aqbooksellers.id >+ WHERE invoiceid = ? >+ }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); >+ >+ $invoice = $sth->fetchrow_hashref; >+ >+ $query = qq{ >+ SELECT aqorders.*, biblio.* >+ FROM aqorders >+ LEFT JOIN biblio ON aqorders.biblionumber = biblio.biblionumber >+ WHERE invoiceid = ? >+ }; >+ $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); >+ $invoice->{orders} = $sth->fetchall_arrayref({}); >+ $invoice->{orders} ||= []; # force an empty arrayref if fetchall_arrayref fails > >+ return $invoice; >+} >+ >+=head3 AddInvoice >+ >+ my $invoiceid = AddInvoice( >+ invoicenumber => $invoicenumber, >+ booksellerid => $booksellerid, >+ shipmentdate => $shipmentdate, >+ billingdate => $billingdate, >+ closedate => $closedate, >+ shipmentcost => $shipmentcost, >+ shipmentcost_budgetid => $shipmentcost_budgetid >+ ); >+ >+Create a new invoice and return its id or undef if it fails. >+ >+=cut >+ >+sub AddInvoice { >+ my %invoice = @_; >+ >+ return unless(%invoice and $invoice{invoicenumber}); >+ >+ my @columns = qw(invoicenumber booksellerid shipmentdate billingdate >+ closedate shipmentcost shipmentcost_budgetid invoicenote); >+ >+ my @set_strs; >+ my @set_args; >+ foreach my $key (keys %invoice) { >+ if(0 < grep(/^$key$/, @columns)) { >+ push @set_strs, "$key = ?"; >+ push @set_args, ($invoice{$key} || undef); >+ } >+ } >+ >+ my $rv; >+ if(@set_args > 0) { >+ my $dbh = C4::Context->dbh; >+ my $query = "INSERT INTO aqinvoices SET "; >+ $query .= join (",", @set_strs); >+ my $sth = $dbh->prepare($query); >+ $rv = $sth->execute(@set_args); >+ if($rv) { >+ $rv = $dbh->last_insert_id(undef, undef, 'aqinvoices', undef); >+ } >+ } >+ return $rv; >+} >+ >+=head3 ModInvoice >+ >+ ModInvoice( >+ invoiceid => $invoiceid, # Mandatory >+ invoicenumber => $invoicenumber, >+ booksellerid => $booksellerid, >+ shipmentdate => $shipmentdate, >+ billingdate => $billingdate, >+ closedate => $closedate, >+ shipmentcost => $shipmentcost, >+ shipmentcost_budgetid => $shipmentcost_budgetid >+ ); >+ >+Modify an invoice, invoiceid is mandatory. >+ >+Return undef if it fails. >+ >+=cut >+ >+sub ModInvoice { >+ my %invoice = @_; >+ >+ return unless(%invoice and $invoice{invoiceid}); >+ >+ my @columns = qw(invoicenumber booksellerid shipmentdate billingdate >+ closedate shipmentcost shipmentcost_budgetid invoicenote); >+ >+ my @set_strs; >+ my @set_args; >+ foreach my $key (keys %invoice) { >+ if(0 < grep(/^$key$/, @columns)) { >+ push @set_strs, "$key = ?"; >+ push @set_args, ($invoice{$key} || undef); >+ } >+ } >+ >+ my $dbh = C4::Context->dbh; >+ my $query = "UPDATE aqinvoices SET "; >+ $query .= join(",", @set_strs); >+ $query .= " WHERE invoiceid = ?"; >+ >+ my $sth = $dbh->prepare($query); >+ $sth->execute(@set_args, $invoice{invoiceid}); >+} >+ >+=head3 DelInvoice >+ >+ DelInvoice($invoiceid); >+ >+Delete an invoice. >+ >+=cut >+ >+sub DelInvoice { >+ my ($invoiceid) = @_; >+ >+ return unless $invoiceid; >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ Delete from aqinvoices >+ WHERE invoiceid = ? >+ }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); >+} >+ >+=head3 CloseInvoice >+ >+ CloseInvoice($invoiceid); >+ >+Close an invoice. >+ >+Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => undef); >+ >+=cut >+ >+sub CloseInvoice { >+ my ($invoiceid) = @_; >+ >+ return unless $invoiceid; >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ UPDATE aqinvoices >+ SET closedate = CAST(NOW() AS DATE) >+ WHERE invoiceid = ? >+ }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); >+} >+ >+=head3 ReopenInvoice >+ >+ ReopenInvoice($invoiceid); >+ >+Reopen an invoice >+ >+Equivalent to ModInvoice(invoiceid => $invoiceid, closedate => C4::Dates->new()->output('iso')) >+ >+=cut >+ >+sub ReopenInvoice { >+ my ($invoiceid) = @_; >+ >+ return unless $invoiceid; >+ >+ my $dbh = C4::Context->dbh; >+ my $query = qq{ >+ UPDATE aqinvoices >+ SET closedate = NULL >+ WHERE invoiceid = ? >+ }; >+ my $sth = $dbh->prepare($query); >+ $sth->execute($invoiceid); > } > > 1; >diff --git a/C4/Bookseller.pm b/C4/Bookseller.pm >index 3fded79..959d417 100644 >--- a/C4/Bookseller.pm >+++ b/C4/Bookseller.pm >@@ -64,12 +64,11 @@ sub GetBookSeller { > my $searchstring = shift; > $searchstring = q{%} . $searchstring . q{%}; > my $query = >-'select aqbooksellers.*, count(*) as basketcount from aqbooksellers left join aqbasket ' >- . 'on aqbasket.booksellerid = aqbooksellers.id where name like ? group by aqbooksellers.id order by name'; >+'select aqbooksellers.*, count(*) as basketcount from aqbooksellers left join aqbasket on aqbasket.booksellerid = aqbooksellers.id left join aqinvoices on aqbooksellers.id = aqinvoices.booksellerid where name like ? or basketname like ? or invoicenumber like ? group by aqbooksellers.id order by name'; > > my $dbh = C4::Context->dbh; > my $sth = $dbh->prepare($query); >- $sth->execute($searchstring); >+ $sth->execute($searchstring, $searchstring, $searchstring); > my $resultset_ref = $sth->fetchall_arrayref( {} ); > return @{$resultset_ref}; > } >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index 7c867e0..e4aa889 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -309,9 +309,19 @@ sub GetBudgetSpent { > quantityreceived > 0 AND > datecancellationprinted IS NULL > |); >- > $sth->execute($budget_id); > my $sum = $sth->fetchrow_array; >+ >+ $sth = $dbh->prepare(qq| >+ SELECT SUM(shipmentcost) AS sum >+ FROM aqinvoices >+ WHERE shipmentcost_budgetid = ? >+ AND closedate IS NOT NULL >+ |); >+ $sth->execute($budget_id); >+ my ($shipmentcost_sum) = $sth->fetchrow_array; >+ $sum += $shipmentcost_sum; >+ > return $sum; > } > >@@ -325,9 +335,19 @@ sub GetBudgetOrdered { > quantityreceived = 0 AND > datecancellationprinted IS NULL > |); >- > $sth->execute($budget_id); > my $sum = $sth->fetchrow_array; >+ >+ $sth = $dbh->prepare(qq| >+ SELECT SUM(shipmentcost) AS sum >+ FROM aqinvoices >+ WHERE shipmentcost_budgetid = ? >+ AND closedate IS NULL >+ |); >+ $sth->execute($budget_id); >+ my ($shipmentcost_sum) = $sth->fetchrow_array; >+ $sum += $shipmentcost_sum; >+ > return $sum; > } > >diff --git a/acqui/addorderiso2709.pl b/acqui/addorderiso2709.pl >index 8d9c0e3..f8fc251 100755 >--- a/acqui/addorderiso2709.pl >+++ b/acqui/addorderiso2709.pl >@@ -190,13 +190,11 @@ if ($op eq ""){ > # 3rd add order > my $patron = C4::Members->GetMember( borrowernumber => $loggedinuser ); > my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} ); >- my ($invoice); > # get quantity in the MARC record (1 if none) > my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1; > my %orderinfo = ( > "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'}, > "quantity", $quantity, "branchcode", $branch, >- "booksellerinvoicenumber", $invoice, > "budget_id", $budget_id, "uncertainprice", 1, > "sort1", $cgiparams->{'sort1'},"sort2", $cgiparams->{'sort2'}, > "notes", $cgiparams->{'notes'}, "budget_id", $cgiparams->{'budget_id'}, >diff --git a/acqui/finishreceive.pl b/acqui/finishreceive.pl >index d09a40a..fadacde 100755 >--- a/acqui/finishreceive.pl >+++ b/acqui/finishreceive.pl >@@ -45,14 +45,14 @@ my $origquantityrec=$input->param('origquantityrec'); > my $quantityrec=$input->param('quantityrec'); > my $quantity=$input->param('quantity'); > my $unitprice=$input->param('cost'); >-my $invoiceno=$input->param('invoice'); >-my $datereceived=$input->param('datereceived'); >+my $invoiceid = $input->param('invoiceid'); >+my $invoice = GetInvoice($invoiceid); >+my $invoiceno = $invoice->{invoicenumber}; >+my $datereceived= $invoice->{shipmentdate}; > my $replacement=$input->param('rrp'); > my $gst=$input->param('gst'); >-my $freight=$input->param('freight'); > my $booksellerid = $input->param('booksellerid'); > my $cnt=0; >-my $error_url_str; > my $ecost = $input->param('ecost'); > my $note = $input->param("note"); > >@@ -96,12 +96,12 @@ if ($quantityrec > $origquantityrec ) { > } > > # save the quantity received. >- $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoiceno,$freight,$replacement,undef,$datereceived); >+ $datereceived = ModReceiveOrder($biblionumber,$ordernumber, $quantityrec ,$user,$unitprice,$invoice->{invoiceid},$replacement,undef,$datereceived); > } > > update_item( $_ ) foreach GetItemnumbersFromOrder( $ordernumber ); > >-print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoice=$invoiceno&booksellerid=$booksellerid&freight=$freight&gst=$gst&datereceived=$datereceived$error_url_str"); >+print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); > > ################################ End of script ################################ > >diff --git a/acqui/invoice.pl b/acqui/invoice.pl >new file mode 100755 >index 0000000..dc03f7f >--- /dev/null >+++ b/acqui/invoice.pl >@@ -0,0 +1,214 @@ >+#!/usr/bin/perl >+ >+# Copyright 2011 BibLibre SARL >+# 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., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 NAME >+ >+invoice.pl >+ >+=head1 DESCRIPTION >+ >+Invoice details >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use CGI; >+use C4::Auth; >+use C4::Output; >+use C4::Acquisition; >+use C4::Bookseller qw/GetBookSellerFromId/; >+use C4::Budgets; >+ >+my $input = new CGI; >+my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { >+ template_name => 'acqui/invoice.tmpl', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { 'acquisition' => '*' }, >+ debug => 1, >+} ); >+ >+my $invoiceid = $input->param('invoiceid'); >+my $op = $input->param('op'); >+ >+if($op && $op eq 'close') { >+ CloseInvoice($invoiceid); >+ my $referer = $input->param('referer'); >+ if($referer) { >+ print $input->redirect($referer); >+ exit 0; >+ } >+}elsif($op && $op eq 'reopen') { >+ ReopenInvoice($invoiceid); >+ my $referer = $input->param('referer'); >+ if($referer) { >+ print $input->redirect($referer); >+ exit 0; >+ } >+}elsif($op && $op eq 'mod') { >+ my $shipmentdate = $input->param('shipmentdate'); >+ my $billingdate = $input->param('billingdate'); >+ my $shipmentcost = $input->param('shipmentcost'); >+ my $invoicenote = $input->param('invoicenote'); >+ my $shipment_budget_id = $input->param('shipment_budget_id'); >+ ModInvoice( >+ invoiceid => $invoiceid, >+ shipmentdate => C4::Dates->new($shipmentdate)->output("iso"), >+ billingdate => C4::Dates->new($billingdate)->output("iso"), >+ shipmentcost => $shipmentcost, >+ invoicenote => $invoicenote, >+ shipmentcost_budgetid => $shipment_budget_id >+ ); >+ $template->param(modified => 1); >+} >+ >+my $details = GetInvoiceDetails($invoiceid); >+my $bookseller = GetBookSellerFromId($details->{booksellerid}); >+my @orders_loop = (); >+my $orders = $details->{'orders'}; >+my $qty_total; >+my @books_loop; >+my @book_foot_loop; >+my %foot; >+my $total_quantity = 0; >+my $total_rrp = 0; >+my $total_est = 0; >+foreach my $order (@$orders) { >+ my $line = get_infos( $order, $bookseller); >+ >+ $total_quantity += $$line{quantity}; >+ $total_rrp += $order->{quantity} * $order->{rrp}; >+ $total_est += $order->{quantity} * $order->{'ecost'}; >+ >+ my %row = (%$order, %$line); >+ push @orders_loop, \%row; >+} >+ >+my $gist = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; >+my $discount = $bookseller->{'discount'} ? ($bookseller->{discount} / 100) : 0; >+my $total_est_gste; >+my $total_est_gsti; >+my $total_rrp_gsti; # RRP Total, GST included >+my $total_rrp_gste; # RRP Total, GST excluded >+my $gist_est; >+my $gist_rrp; >+if ($gist){ >+ # if we have GST >+ if ( $bookseller->{'listincgst'} ) { >+ # if prices already includes GST >+ >+ # we know $total_rrp_gsti >+ $total_rrp_gsti = $total_rrp; >+ # and can reverse compute other values >+ $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); >+ >+ $gist_rrp = $total_rrp_gsti - $total_rrp_gste; >+ $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); >+ $total_est_gsti = $total_est; >+ } else { >+ # if prices does not include GST >+ >+ # then we use the common way to compute other values >+ $total_rrp_gste = $total_rrp; >+ $gist_rrp = $total_rrp_gste * $gist; >+ $total_rrp_gsti = $total_rrp_gste + $gist_rrp; >+ $total_est_gste = $total_est; >+ $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); >+ } >+ $gist_est = $gist_rrp - ( $gist_rrp * $discount ); >+} else { >+ $total_rrp_gsti = $total_rrp; >+ $total_est_gsti = $total_est; >+} >+my $total_gsti_shipment = $total_est_gsti + $details->{shipmentcost}; >+ >+my $format = "%.2f"; >+$template->param( >+ total_rrp_gste => sprintf($format, $total_rrp_gste), >+ total_rrp_gsti => sprintf($format, $total_rrp_gsti), >+ total_est_gste => sprintf($format, $total_est_gste), >+ total_est_gsti => sprintf($format, $total_est_gsti), >+ gist_rrp => sprintf($format, $gist_rrp), >+ gist_est => sprintf($format, $gist_est), >+ total_gsti_shipment => sprintf($format, $total_gsti_shipment), >+ gist => sprintf($format, $gist * 100), >+); >+ >+my $budgets = GetBudgets(); >+my @budgets_loop; >+my $shipmentcost_budgetid = $details->{shipmentcost_budgetid}; >+foreach (@$budgets) { >+ my %line = %{ $_ }; >+ if($shipmentcost_budgetid and $_->{'budget_id'} == $shipmentcost_budgetid) { >+ $line{'selected'} = 1; >+ } >+ push @budgets_loop, \%line; >+} >+ >+$template->param( >+ invoiceid => $details->{'invoiceid'}, >+ invoicenumber => $details->{'invoicenumber'}, >+ suppliername => $details->{'suppliername'}, >+ supplierid => $details->{'booksellerid'}, >+ datereceived => $details->{'datereceived'}, >+ shipmentdate => $details->{'shipmentdate'}, >+ billingdate => $details->{'billingdate'}, >+ invoiceclosedate => $details->{'closedate'}, >+ shipmentcost => sprintf($format, $details->{'shipmentcost'} || 0), >+ invoicenote => $details->{'invoicenote'}, >+ orders_loop => \@orders_loop, >+ total_quantity => $total_quantity, >+ invoiceincgst => $bookseller->{invoiceincgst}, >+ currency => $bookseller->{listprice}, >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+ budgets_loop => \@budgets_loop, >+); >+ >+sub get_infos { >+ my $order = shift; >+ my $bookseller = shift; >+ my $qty = $order->{'quantity'} || 0; >+ if ( !defined $order->{quantityreceived} ) { >+ $order->{quantityreceived} = 0; >+ } >+ my $budget = GetBudget( $order->{'budget_id'} ); >+ >+ my %line = %{ $order }; >+ $line{order_received} = ( $qty == $order->{'quantityreceived'} ); >+ $line{budget_name} = $budget->{budget_name}; >+ $line{total} = $qty * $order->{ecost}; >+ >+ if ( $line{uncertainprice} ) { >+ $line{rrp} .= ' (Uncertain)'; >+ } >+ if ( $line{'title'} ) { >+ my $volume = $order->{'volume'}; >+ my $seriestitle = $order->{'seriestitle'}; >+ $line{'title'} .= " / $seriestitle" if $seriestitle; >+ $line{'title'} .= " / $volume" if $volume; >+ } else { >+ $line{'title'} = "Deleted bibliographic notice, can't find title."; >+ } >+ >+ return \%line; >+} >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/invoices.pl b/acqui/invoices.pl >new file mode 100755 >index 0000000..e041ebf >--- /dev/null >+++ b/acqui/invoices.pl >@@ -0,0 +1,154 @@ >+#!/usr/bin/perl >+ >+# Copyright 2011 BibLibre SARL >+# 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., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+=head1 NAME >+ >+invoices.pl >+ >+=head1 DESCRIPTION >+ >+Search for invoices >+ >+=cut >+ >+use strict; >+use warnings; >+ >+use CGI; >+use C4::Auth; >+use C4::Output; >+ >+use C4::Acquisition; >+use C4::Bookseller qw/GetBookSeller/; >+use C4::Branch; >+ >+my $input = new CGI; >+my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { >+ template_name => 'acqui/invoices.tmpl', >+ query => $input, >+ type => 'intranet', >+ authnotrequired => 0, >+ flagsrequired => { 'acquisition' => '*' }, >+ debug => 1, >+} ); >+ >+my $invoicenumber = $input->param('invoicenumber'); >+my $invoicenote = $input->param('invoicenote'); >+my $supplier = $input->param('supplier'); >+my $billingdatefrom = $input->param('billingdatefrom'); >+my $billingdateto = $input->param('billingdateto'); >+my $isbneanissn = $input->param('isbneanissn'); >+my $title = $input->param('title'); >+my $author = $input->param('author'); >+my $publisher = $input->param('publisher'); >+my $publicationyear = $input->param('publicationyear'); >+my $branch = $input->param('branch'); >+my $op = $input->param('op'); >+ >+my @results_loop = (); >+if($op and $op eq "do_search") { >+ my $billingdatefrom_iso = C4::Dates->new($billingdatefrom)->output("iso"); >+ my $billingdateto_iso = C4::Dates->new($billingdateto)->output("iso"); >+ my @invoices = GetInvoices( >+ invoicenumber => $invoicenumber, >+ invoicenote => $invoicenote, >+ suppliername => $supplier, >+ billingdatefrom => $billingdatefrom_iso, >+ billingdateto => $billingdateto_iso, >+ isbneanissn => $isbneanissn, >+ title => $title, >+ author => $author, >+ publisher => $publisher, >+ publicationyear => $publicationyear, >+ branchcode => $branch >+ ); >+ foreach (@invoices) { >+ my %row = ( >+ invoiceid => $_->{invoiceid}, >+ billingdate => $_->{billingdate}, >+ invoicenumber => $_->{invoicenumber}, >+ invoicenote => $_->{invoicenote}, >+ suppliername => $_->{suppliername}, >+ receivedbiblios => $_->{receivedbiblios}, >+ receiveditems => $_->{receiveditems}, >+ subscriptionid => $_->{subscriptionid}, >+ closedate => $_->{closedate}, >+ ); >+ push @results_loop, \%row; >+ } >+} >+ >+ >+# Build suppliers list >+my @suppliers = GetBookSeller(undef); >+my @suppliers_loop = (); >+my $suppliername; >+foreach (@suppliers) { >+ my $selected = 0; >+ if ($supplier && $supplier == $_->{'id'}) { >+ $selected = 1; >+ $suppliername = $_->{'name'}; >+ } >+ my %row = ( >+ suppliername => $_->{'name'}, >+ supplierid => $_->{'id'}, >+ selected => $selected, >+ ); >+ push @suppliers_loop, \%row; >+} >+ >+# Build branches list >+my $branches = GetBranches(); >+my @branches_loop = (); >+my $branchname; >+foreach (sort keys %$branches) { >+ my $selected = 0; >+ if ($branch && $branch eq $_) { >+ $selected = 1; >+ $branchname = $branches->{$_}->{'branchname'}; >+ } >+ my %row = ( >+ branchcode => $_, >+ branchname => $branches->{$_}->{'branchname'}, >+ selected => $selected, >+ ); >+ push @branches_loop, \%row; >+} >+ >+$template->param( >+ do_search => ($op and $op eq "do_search") ? 1 : 0, >+ results_loop => \@results_loop, >+ invoicenumber => $invoicenumber, >+ invoicenote => $invoicenote, >+ supplier => $supplier, >+ suppliername => $suppliername, >+ billingdatefrom => $billingdatefrom, >+ billingdateto => $billingdateto, >+ isbneanissn => $isbneanissn, >+ title => $title, >+ author => $author, >+ publisher => $publisher, >+ publicationyear => $publicationyear, >+ branch => $branch, >+ branchname => $branchname, >+ suppliers_loop => \@suppliers_loop, >+ branches_loop => \@branches_loop, >+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >+); >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/orderreceive.pl b/acqui/orderreceive.pl >index 2b59698..85ea45a 100755 >--- a/acqui/orderreceive.pl >+++ b/acqui/orderreceive.pl >@@ -40,9 +40,9 @@ to know on what supplier this script has to display receive order. > > =item receive > >-=item invoice >+=item invoiceid > >-the number of this invoice. >+the id of this invoice. > > =item freight > >@@ -61,7 +61,8 @@ The biblionumber of this order. > =cut > > use strict; >-#use warnings; FIXME - Bug 2505 >+use warnings; >+ > use CGI; > use C4::Context; > use C4::Koha; # GetKohaAuthorisedValues GetItemTypes >@@ -81,26 +82,23 @@ use C4::Suggestions; > my $input = new CGI; > > my $dbh = C4::Context->dbh; >-my $booksellerid = $input->param('booksellerid'); >-my $ordernumber = $input->param('ordernumber'); >+my $invoiceid = $input->param('invoiceid'); >+my $invoice = GetInvoice($invoiceid); >+my $booksellerid = $invoice->{booksellerid}; >+my $freight = $invoice->{shipmentcost}; >+my $datereceived = $invoice->{shipmentdate}; >+my $ordernumber = $input->param('ordernumber'); > my $search = $input->param('receive'); >-my $invoice = $input->param('invoice'); >-my $freight = $input->param('freight'); >-my $datereceived = $input->param('datereceived'); >- > > $datereceived = $datereceived ? C4::Dates->new($datereceived, 'iso') : C4::Dates->new(); > > my $bookseller = GetBookSellerFromId($booksellerid); >-my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); >-my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; >+my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; > my $results = SearchOrder($ordernumber,$search); > >- > my $count = scalar @$results; > my $order = GetOrder($ordernumber); > >- > my $date = @$results[0]->{'entrydate'}; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -166,7 +164,8 @@ if ( $count == 1 ) { > unitprice => @$results[0]->{'unitprice'}, > memberfirstname => $member->{firstname} || "", > membersurname => $member->{surname} || "", >- invoice => $invoice, >+ invoiceid => $invoice->{invoiceid}, >+ invoice => $invoice->{invoicenumber}, > datereceived => $datereceived->output(), > datereceived_iso => $datereceived->output('iso'), > notes => $order->{notes}, >@@ -180,7 +179,7 @@ else { > for ( my $i = 0 ; $i < $count ; $i++ ) { > my %line = %{ @$results[$i] }; > >- $line{invoice} = $invoice; >+ $line{invoice} = $invoice->{invoicenumber}; > $line{datereceived} = $datereceived->output(); > $line{freight} = $freight; > $line{gst} = $gst; >@@ -192,11 +191,12 @@ else { > > $template->param( > loop => \@loop, >- booksellerid => $booksellerid, >+ booksellerid => $booksellerid, >+ invoiceid => $invoice->{invoiceid}, > ); > } > my $op = $input->param('op'); >-if ($op eq 'edit'){ >+if ($op and $op eq 'edit'){ > $template->param(edit => 1); > } > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 5d0d164..0433c4b 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -42,8 +42,6 @@ To know the supplier this script has to show orders. > > is the bookseller invoice number. > >-=item freight >- > > =item gst > >@@ -57,7 +55,8 @@ To filter the results list on this given date. > =cut > > use strict; >-#use warnings; FIXME - Bug 2505 >+use warnings; >+ > use C4::Auth; > use C4::Acquisition; > use C4::Budgets; >@@ -71,16 +70,12 @@ use C4::Suggestions; > use JSON; > > my $input=new CGI; >-my $booksellerid=$input->param('booksellerid'); >-my $bookseller=GetBookSellerFromId($booksellerid); >- >-my $invoice=$input->param('invoice') || ''; >-my $freight=$input->param('freight'); >-my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); >-my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; >-my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) >- : C4::Dates->new($input->param('datereceived'), 'iso') ; >-$datereceived = C4::Dates->new() unless $datereceived; >+ >+my $invoiceid = $input->param('invoiceid'); >+my $invoice = GetInvoiceDetails($invoiceid); >+my $booksellerid = $invoice->{booksellerid}; >+my $bookseller = GetBookSellerFromId($booksellerid); >+my $gst = $bookseller->{gstrate} // C4::Context->preference("gist") // 0; > my $code = $input->param('code'); > my @rcv_err = $input->param('error'); > my @rcv_err_barcode = $input->param('error_bc'); >@@ -90,16 +85,17 @@ my $resultsperpage = $input->param('resultsperpage'); > $resultsperpage = 20 unless ($resultsperpage); > $startfrom=0 unless ($startfrom); > >-if($input->param('format') eq "json"){ >+my $format = $input->param('format') || ''; >+if($format eq "json"){ > my ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "acqui/ajax.tmpl", > query => $input, >- type => "intranet", >+ type => "intranet", > authnotrequired => 0, > flagsrequired => {acquisition => 'order_receive'}, > debug => 1, > }); >- >+ > my @datas; > my $search = $input->param('search') || ''; > my $supplier = $input->param('booksellerid') || ''; >@@ -110,7 +106,7 @@ if($input->param('format') eq "json"){ > foreach my $order (@$orders){ > if($order->{quantityreceived} < $order->{quantity}){ > my $data = {}; >- >+ > $data->{basketno} = $order->{basketno}; > $data->{ordernumber} = $order->{ordernumber}; > $data->{title} = $order->{title}; >@@ -118,14 +114,13 @@ if($input->param('format') eq "json"){ > $data->{isbn} = $order->{isbn}; > $data->{booksellerid} = $order->{booksellerid}; > $data->{biblionumber} = $order->{biblionumber}; >- $data->{freight} = $order->{freight}; > $data->{quantity} = $order->{quantity}; > $data->{ecost} = $order->{ecost}; > $data->{ordertotal} = sprintf("%.2f",$order->{ecost}*$order->{quantity}); > push @datas, $data; > } > } >- >+ > my $json_text = to_json(\@datas); > $template->param(return => $json_text); > output_html_with_http_headers $input, $cookie, $template->output; >@@ -135,7 +130,7 @@ if($input->param('format') eq "json"){ > my ($template, $loggedinuser, $cookie) > = get_template_and_user({template_name => "acqui/parcel.tmpl", > query => $input, >- type => "intranet", >+ type => "intranet", > authnotrequired => 0, > flagsrequired => {acquisition => 'order_receive'}, > debug => 1, >@@ -155,10 +150,9 @@ if( scalar(@rcv_err) ) { > } > > my $cfstr = "%.2f"; # currency format string -- could get this from currency table. >-my @parcelitems = GetParcel($booksellerid, $invoice, $datereceived->output('iso')); >+my @parcelitems = @{ $invoice->{orders} }; > my $countlines = scalar @parcelitems; > my $totalprice = 0; >-my $totalfreight = 0; > my $totalquantity = 0; > my $total; > my $tototal; >@@ -166,15 +160,14 @@ my @loop_received = (); > > for (my $i = 0 ; $i < $countlines ; $i++) { > >- #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) >- $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) >+ $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; > $parcelitems[$i]->{'unitprice'} += 0; > my %line; > %line = %{ $parcelitems[$i] }; >- $line{invoice} = $invoice; >+ $line{invoice} = $invoice->{invoicenumber}; > $line{gst} = $gst; > $line{total} = sprintf($cfstr, $total); >- $line{booksellerid} = $booksellerid; >+ $line{booksellerid} = $invoice->{booksellerid}; > push @loop_received, \%line; > $totalprice += $parcelitems[$i]->{'unitprice'}; > $line{unitprice} = sprintf($cfstr, $parcelitems[$i]->{'unitprice'}); >@@ -184,144 +177,137 @@ for (my $i = 0 ; $i < $countlines ; $i++) { > $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; > $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; > >- #double FIXME - totalfreight is redefined later. >- >-# FIXME - each order in a parcel holds the freight for the whole parcel. This means if you receive a parcel with items from multiple budgets, you'll see the freight charge in each budget.. >- if ($i > 0 && $totalfreight != $parcelitems[$i]->{'freight'}) { >- warn "FREIGHT CHARGE MISMATCH!!"; >- } >- $totalfreight = $parcelitems[$i]->{'freight'}; > $totalquantity += $parcelitems[$i]->{'quantityreceived'}; > $tototal += $total; > } > >-my $pendingorders = GetPendingOrders($booksellerid); >-my $countpendings = scalar @$pendingorders; >- >-# pending orders totals >-my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd); >-my $ordergrandtotal; >-my @loop_orders = (); >-for (my $i = 0 ; $i < $countpendings ; $i++) { >- my %line; >- %line = %{$pendingorders->[$i]}; >- >- $line{quantity}+=0; >- $line{quantityreceived}+=0; >- $line{unitprice}+=0; >- $totalPunitprice += $line{unitprice}; >- $totalPquantity +=$line{quantity}; >- $totalPqtyrcvd +=$line{quantityreceived}; >- $totalPecost += $line{ecost}; >- $line{ecost} = sprintf("%.2f",$line{ecost}); >- $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); >- $line{unitprice} = sprintf("%.2f",$line{unitprice}); >- $line{invoice} = $invoice; >- $line{gst} = $gst; >- $line{total} = $total; >- $line{booksellerid} = $booksellerid; >- $ordergrandtotal += $line{ecost} * $line{quantity}; >- >- my $biblionumber = $line{'biblionumber'}; >- my $countbiblio = CountBiblioInOrders($biblionumber); >- my $ordernumber = $line{'ordernumber'}; >- my @subscriptions = GetSubscriptionsId ($biblionumber); >- my $itemcount = GetItemsCount($biblionumber); >- my $holds = GetHolds ($biblionumber); >- my @items = GetItemnumbersFromOrder( $ordernumber ); >- my $itemholds; >- foreach my $item (@items){ >- my $nb = GetItemHolds($biblionumber, $item); >- if ($nb){ >- $itemholds += $nb; >+if(!defined $invoice->{closedate}) { >+ my $pendingorders = GetPendingOrders($booksellerid); >+ my $countpendings = scalar @$pendingorders; >+ >+ # pending orders totals >+ my ($totalPunitprice, $totalPquantity, $totalPecost, $totalPqtyrcvd); >+ my $ordergrandtotal; >+ my @loop_orders = (); >+ for (my $i = 0 ; $i < $countpendings ; $i++) { >+ my %line; >+ %line = %{$pendingorders->[$i]}; >+ >+ $line{quantity}+=0; >+ $line{quantityreceived}+=0; >+ $line{unitprice}+=0; >+ $totalPunitprice += $line{unitprice}; >+ $totalPquantity +=$line{quantity}; >+ $totalPqtyrcvd +=$line{quantityreceived}; >+ $totalPecost += $line{ecost}; >+ $line{ecost} = sprintf("%.2f",$line{ecost}); >+ $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); >+ $line{unitprice} = sprintf("%.2f",$line{unitprice}); >+ $line{invoice} = $invoice; >+ $line{gst} = $gst; >+ $line{total} = $total; >+ $line{booksellerid} = $booksellerid; >+ $ordergrandtotal += $line{ecost} * $line{quantity}; >+ >+ my $biblionumber = $line{'biblionumber'}; >+ my $countbiblio = CountBiblioInOrders($biblionumber); >+ my $ordernumber = $line{'ordernumber'}; >+ my @subscriptions = GetSubscriptionsId ($biblionumber); >+ my $itemcount = GetItemsCount($biblionumber); >+ my $holds = GetHolds ($biblionumber); >+ my @items = GetItemnumbersFromOrder( $ordernumber ); >+ my $itemholds; >+ foreach my $item (@items){ >+ my $nb = GetItemHolds($biblionumber, $item); >+ if ($nb){ >+ $itemholds += $nb; >+ } > } >- } > >- my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); >- $line{suggestionid} = $suggestion->{suggestionid}; >- $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; >- $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; >+ my $suggestion = GetSuggestionInfoFromBiblionumber($line{biblionumber}); >+ $line{suggestionid} = $suggestion->{suggestionid}; >+ $line{surnamesuggestedby} = $suggestion->{surnamesuggestedby}; >+ $line{firstnamesuggestedby} = $suggestion->{firstnamesuggestedby}; >+ >+ # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 >+ $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds); >+ $line{items} = ($itemcount) - (scalar @items); >+ $line{left_item} = 1 if $line{items} >= 1; >+ $line{left_biblio} = 1 if $countbiblio > 1; >+ $line{biblios} = $countbiblio - 1; >+ $line{left_subscription} = 1 if scalar @subscriptions >= 1; >+ $line{subscriptions} = scalar @subscriptions; >+ $line{left_holds} = ($holds >= 1) ? 1 : 0; >+ $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); >+ $line{holds} = $holds; >+ $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; >+ >+ >+ push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); >+ } > >- # if the biblio is not in other orders and if there is no items elsewhere and no subscriptions and no holds we can then show the link "Delete order and Biblio" see bug 5680 >- $line{can_del_bib} = 1 if $countbiblio <= 1 && $itemcount == scalar @items && !(@subscriptions) && !($holds); >- $line{items} = ($itemcount) - (scalar @items); >- $line{left_item} = 1 if $line{items} >= 1; >- $line{left_biblio} = 1 if $countbiblio > 1; >- $line{biblios} = $countbiblio - 1; >- $line{left_subscription} = 1 if scalar @subscriptions >= 1; >- $line{subscriptions} = scalar @subscriptions; >- $line{left_holds} = 1 if $holds >= 1; >- $line{left_holds_on_order} = 1 if $line{left_holds}==1 && ($line{items} == 0 || $itemholds ); >- $line{holds} = $holds; >- $line{holds_on_order} = $itemholds?$itemholds:$holds if $line{left_holds_on_order}; >- >- >- push @loop_orders, \%line if ($i >= $startfrom and $i < $startfrom + $resultsperpage); >-} >-$freight = $totalfreight unless $freight; >+ my $count = $countpendings; > >-my $count = $countpendings; >+ if ($count>$resultsperpage){ >+ my $displaynext=0; >+ my $displayprev=$startfrom; >+ if(($count - ($startfrom+$resultsperpage)) > 0 ) { >+ $displaynext = 1; >+ } > >-if ($count>$resultsperpage){ >- my $displaynext=0; >- my $displayprev=$startfrom; >- if(($count - ($startfrom+$resultsperpage)) > 0 ) { >- $displaynext = 1; >- } >+ my @numbers = (); >+ for (my $i=1; $i<$count/$resultsperpage+1; $i++) { >+ my $highlight=0; >+ ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); >+ push @numbers, { number => $i, >+ highlight => $highlight , >+ startfrom => ($i-1)*$resultsperpage}; >+ } > >- my @numbers = (); >- for (my $i=1; $i<$count/$resultsperpage+1; $i++) { >- my $highlight=0; >- ($startfrom/$resultsperpage==($i-1)) && ($highlight=1); >- push @numbers, { number => $i, >- highlight => $highlight , >- startfrom => ($i-1)*$resultsperpage}; >+ my $from = $startfrom*$resultsperpage+1; >+ my $to; >+ if($count < (($startfrom+1)*$resultsperpage)){ >+ $to = $count; >+ } else { >+ $to = (($startfrom+1)*$resultsperpage); >+ } >+ $template->param(numbers=>\@numbers, >+ displaynext=>$displaynext, >+ displayprev=>$displayprev, >+ nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), >+ prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) >+ ); > } > >- my $from = $startfrom*$resultsperpage+1; >- my $to; >- if($count < (($startfrom+1)*$resultsperpage)){ >- $to = $count; >- } else { >- $to = (($startfrom+1)*$resultsperpage); >- } >- $template->param(numbers=>\@numbers, >- displaynext=>$displaynext, >- displayprev=>$displayprev, >- nextstartfrom=>(($startfrom+$resultsperpage<$count)?$startfrom+$resultsperpage:$count), >- prevstartfrom=>(($startfrom-$resultsperpage>0)?$startfrom-$resultsperpage:0) >- ); >+ $template->param( >+ countpending => $countpendings, >+ loop_orders => \@loop_orders, >+ ordergrandtotal => sprintf($cfstr, $ordergrandtotal), >+ totalPunitprice => sprintf("%.2f", $totalPunitprice), >+ totalPquantity => $totalPquantity, >+ totalPqtyrcvd => $totalPqtyrcvd, >+ totalPecost => sprintf("%.2f", $totalPecost), >+ ); > } > >-#$totalfreight=$freight; >-$tototal = $tototal + $freight; > > $template->param( >- invoice => $invoice, >- datereceived => $datereceived->output('iso'), >- invoicedatereceived => $datereceived->output('iso'), >- formatteddatereceived => $datereceived->output(), >+ invoiceid => $invoice->{invoiceid}, >+ invoice => $invoice->{invoicenumber}, >+ invoiceclosedate => $invoice->{closedate}, >+ datereceived => $invoice->{'shipmentdate'}, >+ invoicedatereceived => $invoice->{'billingdate'}, >+ formatteddatereceived => $invoice->{'shipmentdate'}, > name => $bookseller->{'name'}, >- booksellerid => $booksellerid, >+ booksellerid => $bookseller->{id}, > gst => $gst, >- freight => $freight, >- invoice => $invoice, > countreceived => $countlines, > loop_received => \@loop_received, >- countpending => $countpendings, >- loop_orders => \@loop_orders, > totalprice => sprintf($cfstr, $totalprice), >- totalfreight => $totalfreight, > totalquantity => $totalquantity, > tototal => sprintf($cfstr, $tototal), >- ordergrandtotal => sprintf($cfstr, $ordergrandtotal), > gst => $gst, > grandtot => sprintf($cfstr, $tototal + $gst), >- totalPunitprice => sprintf("%.2f", $totalPunitprice), >- totalPquantity => $totalPquantity, >- totalPqtyrcvd => $totalPqtyrcvd, >- totalPecost => sprintf("%.2f", $totalPecost), > resultsperpage => $resultsperpage, > ); > output_html_with_http_headers $input, $cookie, $template->output; >- >diff --git a/acqui/parcels.pl b/acqui/parcels.pl >index 173c0c8..3a79e1e 100755 >--- a/acqui/parcels.pl >+++ b/acqui/parcels.pl >@@ -44,9 +44,9 @@ To know the supplier this script has to show orders. > sort list of order by 'orderby'. > Orderby can be equals to > * datereceived desc (default value) >- * aqorders.booksellerinvoicenumber >+ * invoicenumber > * datereceived >- * aqorders.booksellerinvoicenumber desc >+ * invoicenumber desc > > =item filter > >@@ -77,13 +77,15 @@ use C4::Acquisition; > use C4::Bookseller qw/ GetBookSellerFromId /; > > my $input = CGI->new; >-my $booksellerid = $input->param('booksellerid'); >+my $booksellerid = $input->param('booksellerid'); > my $order = $input->param('orderby') || 'datereceived desc'; > my $startfrom = $input->param('startfrom'); > my $code = $input->param('filter'); >+my $invoicenote = $input->param('notefilter'); > my $datefrom = $input->param('datefrom'); > my $dateto = $input->param('dateto'); > my $resultsperpage = $input->param('resultsperpage'); >+my $op = $input->param('op'); > $resultsperpage ||= 20; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -96,8 +98,39 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >+if($op and $op eq 'new') { >+ my $invoicenumber = $input->param('invoice'); >+ my $billingdate = $input->param('billingdate'); >+ my $shipmentdate = $input->param('shipmentdate'); >+ $invoicenote = $input->param('invoicenote'); >+ my $invoiceid = AddInvoice( >+ invoicenumber => $invoicenumber, >+ booksellerid => $booksellerid, >+ invoicenote => $invoicenote, >+ billingdate => C4::Dates->new($billingdate)->output('iso'), >+ shipmentdate => C4::Dates->new($shipmentdate)->output('iso') >+ ); >+ if(defined $invoiceid) { >+ # Successful 'Add' >+ print $input->redirect("/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid"); >+ exit 0; >+ } else { >+ $template->param(error_failed_to_create_invoice => 1); >+ } >+} elsif($op eq 'delete') { >+ my $invoiceid = $input->param('invoiceid'); >+ DelInvoice($invoiceid); >+} >+ > my $bookseller = GetBookSellerFromId($booksellerid); >-my @parcels = GetParcels( $booksellerid, $order, $code, $datefrom, $dateto ); >+my @parcels = GetInvoices( >+ supplierid => $booksellerid, >+ invoicenumber => $code, >+ invoicenote => $invoicenote, >+ shipmentdatefrom => $datefrom, >+ shipmentdateto => $dateto, >+ order_by => $order >+); > my $count_parcels = @parcels; > > # multi page display gestion >@@ -114,14 +147,16 @@ for my $i ( $startfrom .. $last_row) { > > push @{$loopres}, > { number => $i + 1, >- code => $p->{booksellerinvoicenumber}, >- nullcode => $p->{booksellerinvoicenumber} eq 'NULL', >- emptycode => $p->{booksellerinvoicenumber} eq q{}, >- raw_datereceived => $p->{datereceived}, >- datereceived => format_date( $p->{datereceived} ), >- bibcount => $p->{biblio}, >- reccount => $p->{itemsreceived}, >- itemcount => $p->{itemsexpected}, >+ invoiceid => $p->{invoiceid}, >+ code => $p->{invoicenumber}, >+ nullcode => $p->{invoicenumber} eq 'NULL', >+ emptycode => $p->{invoicenumber} eq q{}, >+ raw_datereceived => $p->{shipmentdate}, >+ invoicenote => $p->{invoicenote}, >+ datereceived => format_date( $p->{shipmentdate} ), >+ bibcount => $p->{receivedbiblios} || 0, >+ reccount => $p->{receiveditems} || 0, >+ itemcount => $p->{itemsexpected} || 0, > }; > } > if ($count_parcels) { >@@ -135,7 +170,7 @@ $template->param( > resultsperpage => $resultsperpage, > name => $bookseller->{'name'}, > DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(), >- datereceived_today => C4::Dates->new()->output(), >+ today => C4::Dates->new()->output(), > booksellerid => $booksellerid, > GST => C4::Context->preference('gist'), > ); >diff --git a/acqui/spent.pl b/acqui/spent.pl >index 0dcba98..2d555f9 100755 >--- a/acqui/spent.pl >+++ b/acqui/spent.pl >@@ -60,10 +60,10 @@ SELECT > aqbasket.booksellerid, > itype, > title, >- aqorders.booksellerinvoicenumber, >+ aqorders.invoiceid, >+ aqinvoices.invoicenumber, > quantityreceived, > unitprice, >- freight, > datereceived, > aqorders.biblionumber > FROM (aqorders, aqbasket) >@@ -73,6 +73,8 @@ LEFT JOIN biblio ON > biblio.biblionumber=aqorders.biblionumber > LEFT JOIN aqorders_items ON > aqorders.ordernumber=aqorders_items.ordernumber >+LEFT JOIN aqinvoices ON >+ aqorders.invoiceid = aqinvoices.invoiceid > WHERE > aqorders.basketno=aqbasket.basketno AND > budget_id=? AND >@@ -85,27 +87,48 @@ $sth->execute($bookfund); > if ( $sth->err ) { > die "An error occurred fetching records: " . $sth->errstr; > } >-my $total = 0; >+my $subtotal = 0; > my $toggle; > my @spent; > while ( my $data = $sth->fetchrow_hashref ) { > my $recv = $data->{'quantityreceived'}; > if ( $recv > 0 ) { >- my $subtotal = $recv * ( $data->{'unitprice'} + $data->{'freight'} ); >- $data->{'subtotal'} = sprintf( "%.2f", $subtotal ); >- $data->{'freight'} = sprintf( "%.2f", $data->{'freight'} ); >+ my $rowtotal = $recv * $data->{'unitprice'}; >+ $data->{'rowtotal'} = sprintf( "%.2f", $rowtotal ); > $data->{'unitprice'} = sprintf( "%.2f", $data->{'unitprice'} ); >- $total += $subtotal; >+ $subtotal += $rowtotal; > push @spent, $data; > } > > } >-$total = sprintf( "%.2f", $total ); > >-$template->{VARS}->{'fund'} = $bookfund; >-$template->{VARS}->{'spent'} = \@spent; >-$template->{VARS}->{'total'} = $total; >-$template->{VARS}->{'fund_code'} = $fund_code; >+my $total = $subtotal; >+$query = qq{ >+ SELECT invoicenumber, shipmentcost >+ FROM aqinvoices >+ WHERE shipmentcost_budgetid = ? >+}; >+$sth = $dbh->prepare($query); >+$sth->execute($bookfund); >+my @shipmentcosts; >+while (my $data = $sth->fetchrow_hashref) { >+ push @shipmentcosts, { >+ shipmentcost => sprintf("%.2f", $data->{shipmentcost}), >+ invoicenumber => $data->{invoicenumber} >+ }; >+ $total += $data->{shipmentcost}; >+} > $sth->finish; > >+$total = sprintf( "%.2f", $total ); >+ >+$template->param( >+ fund => $bookfund, >+ spent => \@spent, >+ subtotal => $subtotal, >+ shipmentcosts => \@shipmentcosts, >+ total => $total, >+ fund_code => $fund_code >+); >+ > output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl >index 9d5465b..9a7a18e 100755 >--- a/catalogue/moredetail.pl >+++ b/catalogue/moredetail.pl >@@ -141,17 +141,19 @@ foreach my $item (@items){ > } > > my $order = GetOrderFromItemnumber( $item->{'itemnumber'} ); >- my $basket = GetBasket( $order->{'basketno'} ); >- $item->{'booksellerid'} = $basket->{'booksellerid'}; > $item->{'ordernumber'} = $order->{'ordernumber'}; > $item->{'basketno'} = $order->{'basketno'}; >- $item->{'booksellerinvoicenumber'} = $order->{'booksellerinvoicenumber'}; > $item->{'orderdate'} = $order->{'entrydate'}; > if ($item->{'basketno'}){ > my $basket = GetBasket($item->{'basketno'}); > my $bookseller = GetBookSellerFromId($basket->{'booksellerid'}); > $item->{'vendor'} = $bookseller->{'name'}; > } >+ $item->{'invoiceid'} = $order->{'invoiceid'}; >+ if($item->{invoiceid}) { >+ my $invoice = GetInvoice($item->{invoiceid}); >+ $item->{invoicenumber} = $invoice->{invoicenumber} if $invoice; >+ } > $item->{'datereceived'} = $order->{'datereceived'}; > > if ($item->{notforloantext} or $item->{itemlost} or $item->{damaged} or $item->{wthdrawn}) { >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 4912e19..d1d6a0e 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2715,7 +2715,7 @@ CREATE TABLE `aqorders` ( > `listprice` decimal(28,6) default NULL, > `totalamount` decimal(28,6) default NULL, > `datereceived` date default NULL, >- `booksellerinvoicenumber` mediumtext, >+ invoiceid int(11) default NULL, > `freight` decimal(28,6) default NULL, > `unitprice` decimal(28,6) default NULL, > `quantityreceived` smallint(6) NOT NULL default 0, >@@ -2747,7 +2747,8 @@ CREATE TABLE `aqorders` ( > KEY `biblionumber` (`biblionumber`), > KEY `budget_id` (`budget_id`), > CONSTRAINT `aqorders_ibfk_1` FOREIGN KEY (`basketno`) REFERENCES `aqbasket` (`basketno`) ON DELETE CASCADE ON UPDATE CASCADE, >- CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE >+ CONSTRAINT `aqorders_ibfk_2` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE SET NULL ON UPDATE CASCADE, >+ CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > >@@ -2764,6 +2765,27 @@ CREATE TABLE `aqorders_items` ( > KEY `ordernumber` (`ordernumber`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > >+ >+-- >+-- Table structure for table aqinvoices >+-- >+ >+DROP TABLE IF EXISTS aqinvoices; >+CREATE TABLE aqinvoices ( >+ invoiceid int(11) NOT NULL AUTO_INCREMENT, -- ID of the invoice, primary key >+ invoicenumber mediumtext NOT NULL, -- Name of invoice >+ booksellerid int(11) NOT NULL, -- foreign key to aqbooksellers >+ shipmentdate date default NULL, -- date of shipment >+ billingdate date default NULL, -- date of billing >+ closedate date default NULL, -- invoice close date, NULL means the invoice is open >+ shipmentcost decimal(28,6) default NULL, -- shipment cost >+ shipmentcost_budgetid int(11) default NULL, -- foreign key to aqbudgets, link the shipment cost to a budget >+ PRIMARY KEY (invoiceid), >+ CONSTRAINT aqinvoices_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT aqinvoices_fk_shipmentcost_budgetid FOREIGN KEY (shipmentcost_budgetid) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE >+) ENGINE=InnoDB DEFAULT CHARSET=utf8; >+ >+ > -- > -- Table structure for table `fieldmapping` > -- >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 503c8ee..add4d9d 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5146,6 +5146,68 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+ >+$DBversion = "3.08.01.XXX"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do(" >+ CREATE TABLE aqinvoices ( >+ invoiceid int(11) NOT NULL AUTO_INCREMENT, >+ invoicenumber mediumtext NOT NULL, >+ booksellerid int(11) NOT NULL, >+ shipmentdate date default NULL, >+ billingdate date default NULL, >+ closedate date default NULL, >+ shipmentcost decimal(28,6) default NULL, >+ shipmentcost_budgetid int(11) default NULL, >+ invoicenote varchar(255), >+ PRIMARY KEY (invoiceid), >+ CONSTRAINT aqinvoices_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE, >+ CONSTRAINT aqinvoices_fk_shipmentcost_budgetid FOREIGN KEY (shipmentcost_budgetid) REFERENCES aqbudgets (budget_id) ON DELETE SET NULL ON UPDATE CASCADE >+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8 >+ "); >+ >+ # Fill this new table with existing invoices >+ my $sth = $dbh->prepare(" >+ SELECT aqorders.booksellerinvoicenumber AS invoicenumber, aqbasket.booksellerid >+ FROM aqorders >+ LEFT JOIN aqbasket ON aqorders.basketno = aqbasket.basketno >+ WHERE aqorders.booksellerinvoicenumber IS NOT NULL >+ AND aqorders.booksellerinvoicenumber != '' >+ GROUP BY aqorders.booksellerinvoicenumber >+ "); >+ $sth->execute; >+ my $results = $sth->fetchall_arrayref({}); >+ $sth = $dbh->prepare(" >+ INSERT INTO aqinvoices (invoicenumber, booksellerid) VALUES (?,?) >+ "); >+ foreach(@$results) { >+ $sth->execute($_->{'invoicenumber'}, $_->{'booksellerid'}); >+ } >+ >+ # Add the column in aqorders, fill it with correct value >+ # and then drop booksellerinvoicenumber column >+ $dbh->do(" >+ ALTER TABLE aqorders >+ ADD COLUMN invoiceid int(11) default NULL AFTER booksellerinvoicenumber, >+ ADD CONSTRAINT aqorders_ibfk_3 FOREIGN KEY (invoiceid) REFERENCES aqinvoices (invoiceid) ON DELETE SET NULL ON UPDATE CASCADE >+ "); >+ >+ $dbh->do(" >+ UPDATE aqorders, aqinvoices >+ SET aqorders.invoiceid = aqinvoices.invoiceid >+ WHERE aqorders.booksellerinvoicenumber = aqinvoices.invoicenumber >+ "); >+ >+ $dbh->do(" >+ ALTER TABLE aqorders >+ DROP COLUMN booksellerinvoicenumber >+ "); >+ >+ print "Upgrade to $DBversion done (Add aqinvoices table) \n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >index a0f094c..b67cec2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/acquisitions-menu.inc >@@ -1,6 +1,7 @@ > <ul> > <li><a href="/cgi-bin/koha/acqui/lateorders.pl">Late orders</a></li> > [% IF ( suggestion ) %]<li><a href="/cgi-bin/koha/suggestion/suggestion.pl">Suggestions</a></li>[% ELSE %][% END %] >+ <li><a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a></li> > [% IF ( CAN_user_acquisition_budget_manage ) %] > <li><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets & Funds</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >index 1d6c242..11ab85b 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/histsearch.tt >@@ -89,7 +89,11 @@ > <br />[% suggestions_loo.author %] <br /> [% suggestions_loo.isbn %]</td> > <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% suggestions_loo.id %]">[% suggestions_loo.name %]</a></td> > <td>[% suggestions_loo.creationdate | $KohaDates %]</td> >- <td>[% suggestions_loo.datereceived | $KohaDates %]</td> >+ <td> >+ [% IF suggestions_loo.datereceived %] >+ [% suggestions_loo.datereceived | $KohaDates %] >+ [% END %] >+ </td> > <td>[% suggestions_loo.quantity %]</td> > <td>[% suggestions_loo.ecost %]</td> > </tr> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >new file mode 100644 >index 0000000..b51616b >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt >@@ -0,0 +1,195 @@ >+[% USE KohaDates %] >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Acquisitions › Invoice</title> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+<script type="text/javascript"> >+//<![CDATA[ >+ $(document).ready(function() { >+ $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ bInfo: false, >+ bPaginate: false, >+ bFilter: false, >+ })); >+ Calendar.setup({ >+ inputField: "shipmentdate", >+ ifFormat: "[% DHTMLcalendar_dateformat %]", >+ button: "shipmentdateCalendar" >+ }); >+ Calendar.setup({ >+ inputField: "billingdate", >+ ifFormat: "[% DHTMLcalendar_dateformat %]", >+ button: "billingdateCalendar" >+ }); >+ }); >+//]]> >+</script> >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> › <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">[% invoicenumber %]</a></div> >+ >+<div id="doc3" class="yui-t2"> >+ >+<div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ [% IF ( modified ) %] >+ <div class="dialog"> >+ <p>Invoice has been modified</p> >+ </div> >+ [% END %] >+ <h1>Invoice: [% invoicenumber %]</h1> >+ >+ <p>Supplier: [% suppliername %]</p> >+ <form action="" method="post"> >+ <label for="invoicenote">Invoice note</label> >+ <input type="text" size="20" id="invoicenote" name="invoicenote" value="[% invoicenote %]"/> >+ <p></p> >+ <label for="shipmentdate">Shipment date:</label> >+ [% IF (shipmentdate) %] >+ <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" readonly="readonly" /> >+ [% ELSE %] >+ <input type="text" size="10" id="shipmentdate" name="shipmentdate" readonly="readonly" /> >+ [% END %] >+ <img id="shipmentdateCalendar" alt="Show Calendar" style="cursor:pointer" src="[% themelang %]/lib/calendar/cal.gif" /> >+ <p></p> >+ <label for="billingdate">Billing date:</label> >+ [% IF (billingdate) %] >+ <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" /> >+ [% ELSE %] >+ <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" /> >+ [% END %] >+ <img id="billingdateCalendar" alt="Show Calendar" style="cursor:pointer" src="[% themelang %]/lib/calendar/cal.gif" /> >+ <p></p> >+ <label for="shipmentcost">Shipment cost:</label> >+ <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" /> >+ <label for="shipment_budget_id">Budget:</label> >+ <select id="shipment_budget_id" name="shipment_budget_id"> >+ <option value="">No budget</option> >+ [% FOREACH budget IN budgets_loop %] >+ [% IF ( budget.selected ) %] >+ <option selected="selected" value="[% budget.budget_id %]"> >+ [% ELSE %] >+ <option value="[% budget.budget_id %]"> >+ [% END %] >+ [% budget.budget_name %] >+ </option> >+ [% END %] >+ </select> >+ <input type="hidden" name="op" value="mod" /> >+ <input type="hidden" name="invoiceid" value="[% invoiceid %]" /> >+ <fieldset class="action"> >+ <input type="submit" value="Save"> >+ </fieldset> >+ </form> >+ <p>Status: >+ [% IF ( invoiceclosedate ) %] >+ Closed on [% invoiceclosedate | $KohaDates %]. >+ <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]"> >+ Reopen >+ </a> >+ [% ELSE %] >+ Open. >+ <a href="/cgi-bin/koha/acqui/invoice.pl?op=close&invoiceid=[% invoiceid %]"> >+ Close >+ </a> >+ [% END %] >+ </p> >+ <p> >+ <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a> >+ </p> >+ <h2>Invoice details</h2> >+ [% IF orders_loop.size %] >+ <table id="orderst"> >+ <thead> >+ <tr> >+ <th>Summary</th> >+ <th>Publisher</th> >+ <th>Branch</th> >+ <th>RRP</th> >+ <th>Est.</th> >+ <th>Qty.</th> >+ <th>Total</th> >+ <th>Fund</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH order IN orders_loop %] >+ <tr> >+ <td><p>[% order.title %] >+ [% IF ( order.author ) %] >+ <br /><em>by</em> [% order.author %] >+ [% END %] >+ </p></td> >+ <td> >+ [% IF ( order.publishercode ) %] >+ <p>[% order.publishercode %] >+ [% IF ( order.publicationyear ) %] >+ - [% order.publicationyear %] >+ [% END %] >+ </p> >+ [% END %] >+ </td> >+ <td><p>[% order.branchcode %]</p></td> >+ <td>[% order.rrp %]</td> >+ <td>[% order.ecost %]</td> >+ <td class="number">[% order.quantity %]</td> >+ <td>[% order.total %]</td> >+ <td>[% order.budget_name %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ <tfoot> >+ <tr> >+ <th colspan="3">Total Tax Exc.</th> >+ <th>[% total_rrp_gste %]</th> >+ <th> </th> >+ <th>[% total_quantity %]</th> >+ <th>[% total_est_gste %]</th> >+ <th> </th> >+ </tr> >+ <tr> >+ <th colspan='3'>Tax ([% gist %]%)</th> >+ <th>[% gist_rrp %]</th> >+ <th> </th> >+ <th> </th> >+ <th>[% gist_est %]</th> >+ <th> </th> >+ </tr> >+ <tr> >+ <th colspan='3'>Total Tax Inc. ([% currency %])</th> >+ <th>[% total_rrp_gsti %]</th> >+ <th> </th> >+ <th>[% total_quantity %]</th> >+ <th>[% total_est_gsti %]</th> >+ <th> </th> >+ </tr> >+ <tr> >+ <th colspan="3">Total + Shipment cost ([% currency %])</th> >+ <th> </th> >+ <th> </th> >+ <th>[% total_quantity %]</th> >+ <th>[% total_gsti_shipment %]</th> >+ <th> </th> >+ </tr> >+ </tfoot> >+ </table> >+ [% ELSE %] >+ <p>No orders yet</p> >+ [% END %] >+ </div> >+ </div> >+ <div class="yui-b"> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >new file mode 100644 >index 0000000..c9ad91a >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt >@@ -0,0 +1,237 @@ >+[% USE KohaDates %] >+ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Acquisitions › Invoices</title> >+<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" /> >+[% INCLUDE 'doc-head-close.inc' %] >+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.dataTables.min.js"></script> >+[% INCLUDE 'datatables-strings.inc' %] >+<script type="text/javascript" src="[% themelang %]/js/datatables.js"></script> >+[% INCLUDE 'calendar.inc' %] >+<script type="text/javascript"> >+//<![CDATA[ >+$(document).ready(function() { >+ Calendar.setup({ >+ inputField: "billingdatefrom", >+ ifFormat: "[% DHTMLcalendar_dateformat %]", >+ button: "billingdatefromCalendar" >+ }); >+ Calendar.setup({ >+ inputField: "billingdateto", >+ ifFormat: "[% DHTMLcalendar_dateformat %]", >+ button: "billingdatetoCalendar" >+ }); >+ $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ bInfo: false, >+ bPaginate: false, >+ bFilter: false, >+ aoColumnDefs: [ >+ { "bSortable": false, "aTargets": [6] } >+ ] >+ })); >+}); >+//]]> >+</script> >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'acquisitions-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › Invoices</div> >+ >+<div id="doc3" class="yui-t2"> >+ >+<div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <h1>Invoices</h1> >+ [% IF ( do_search ) %] >+ [% IF ( results_loop ) %] >+ <table id="resultst"> >+ <thead> >+ <tr> >+ <th>Invoice no.</th> >+ <th>Invoice note</th> >+ <th>Vendor</th> >+ <th>Billing date</th> >+ <th>Received biblios</th> >+ <th>Received items</th> >+ <th>Status</th> >+ <th>Actions</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOREACH result IN results_loop %] >+ <tr> >+ <td>[% result.invoicenumber %]</td> >+ <td>[% result.invoicenote %]</td> >+ <td>[% result.suppliername %]</td> >+ <td> >+ [% IF (result.billingdate) %] >+ [% result.billingdate | $KohaDates %] >+ [% END %] >+ </td> >+ <td>[% result.receivedbiblios %]</td> >+ <td>[% result.receiveditems %]</td> >+ <td> >+ [% IF ( result.closedate ) %] >+ Closed on [% result.closedate | $KohaDates %] >+ [% ELSE %] >+ Open >+ [% END %] >+ </td> >+ <td> >+ <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% result.invoiceid %]">Details</a> / >+ [% IF ( result.closedate ) %] >+ <a href="invoice.pl?op=reopen&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Reopen</a> >+ [% ELSE %] >+ <a href="invoice.pl?op=close&invoiceid=[% result.invoiceid %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% supplier %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]">Close</a> >+ [% END %] >+ </td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ [% ELSE %] >+ <p>Sorry, but there is no results for your search.</p> >+ <p>Search was: >+ <ul> >+ [% IF ( invoicenumber ) %] >+ <li>Invoice no.: [% invoicenumber %]</li> >+ [% END %] >+ [% IF ( invoicenote ) %] >+ <li>Invoice note: [% invoicenote %]</li> >+ [% END %] >+ [% IF ( supplier ) %] >+ <li>Vendor: [% suppliername %]</li> >+ [% END %] >+ [% IF ( billingdatefrom ) %] >+ <li>Billing date: >+ [% IF ( billingdateto ) %] >+ From [% billingdatefrom %] >+ To [% billingdateto %] >+ [% ELSE %] >+ All since [% billingdatefrom %] >+ [% END %] >+ </li> >+ [% ELSE %] >+ [% IF ( billingdateto ) %] >+ <li>Billing date: >+ All until [% billingdateto %] >+ </li> >+ [% END %] >+ [% END %] >+ [% IF ( isbneanissn ) %] >+ <li>ISBN/EAN/ISSN: [% isbneanissn %]</li> >+ [% END %] >+ [% IF ( title ) %] >+ <li>Title: [% title %]</li> >+ [% END %] >+ [% IF ( author ) %] >+ <li>Author: [% author %]</li> >+ [% END %] >+ [% IF ( publisher ) %] >+ <li>Publisher: [% publisher %]</li> >+ [% END %] >+ [% IF ( publicationyear ) %] >+ <li>Publication year: [% publicationyear %]</li> >+ [% END %] >+ [% IF ( branch ) %] >+ <li>Branch: [% branchname %]</li> >+ [% END %] >+ </ul> >+ </p> >+ [% END %]<!-- results_loop --> >+ [% ELSE %] >+ <p>Please fill in the form to the left to make a search.</p> >+ [% END %]<!-- do_search --> >+ </div> >+ </div> >+ <div class="yui-b"> >+ <form action="" method="get"> >+ <fieldset class="brief"> >+ <h3>Search filters</h3> >+ <ol> >+ <li> >+ <label for="invoicenumber">Invoice no:</label> >+ <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" /> >+ </li> >+ <li> >+ <label for="invoicenote">Invoice note:</label> >+ <input type="text" id="invoicenote" name="invoicenote" value="[% invoicenote %]" /> >+ </li> >+ <li> >+ <label for="supplier">Supplier:</label> >+ <select id="supplier" name="supplier"> >+ <option value="">All</option> >+ [% FOREACH supplier IN suppliers_loop %] >+ [% IF ( supplier.selected ) %] >+ <option selected="selected" value="[% supplier.supplierid %]">[% supplier.suppliername %]</option> >+ [% ELSE %] >+ <option value="[% supplier.supplierid %]">[% supplier.suppliername %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ <li> >+ <fieldset class="brief"> >+ <legend>Billing date</legend> >+ <ol> >+ <li> >+ <label for="billingdatefrom">From:</label> >+ <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" /> >+ <img id="billingdatefromCalendar" alt="Show Calendar" style="cursor:pointer;" src="[% themelang %]/lib/calendar/cal.gif" /> >+ </li> >+ <li> >+ <label for="billingdateto">To:</label> >+ <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" /> >+ <img id="billingdatetoCalendar" alt="Show Calendar" style="cursor:pointer;" src="[% themelang %]/lib/calendar/cal.gif" /> >+ </li> >+ </ol> >+ </fieldset> >+ </li> >+ <li> >+ <label for="isbneanissn">ISBN / EAN / ISSN:</label> >+ <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn %]" /> >+ </li> >+ <li> >+ <label for="title">Title:</label> >+ <input type="text" id="title" name="title" value="[% title %]" /> >+ </li> >+ <li> >+ <label for="author">Author:</label> >+ <input type="text" id="author" name="author" value="[% author %]" /> >+ </li> >+ <li> >+ <label for="publisher">Publisher:</label> >+ <input type="text" id="publisher" name="publisher" value="[% publisher %]" /> >+ </li> >+ <li> >+ <label for="publicationyear">Publication year:</label> >+ <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" /> >+ </li> >+ <li> >+ <label for="branch">Branch:</label> >+ <select id="branch" name="branch"> >+ <option value="">All</option> >+ [% FOREACH branch IN branches_loop %] >+ [% IF ( branch.selected ) %] >+ <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]">[% branch.branchname %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ <fieldset class="action"> >+ <input type="submit" value="Search" /> >+ </fieldset> >+ </fieldset> >+ <input type="hidden" name="op" id="op" value="do_search" /> >+ </form> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index bb706ec..147b141 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -129,11 +129,11 @@ > </fieldset> > [% END %][%# IF (AcqCreateItemReceiving) %] > <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> >+ <input type="hidden" name="invoiceid" value="[% invoiceid %]" /> > <input type="hidden" name="ordernumber" value="[% ordernumber %]" /> > <input type="hidden" name="biblioitemnumber" value="[% biblioitemnumber %]" /> > <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> > <input type="hidden" name="datereceived" value="[% datereceived_iso %]" /> >- <input type="hidden" name="freight" value="[% freight %]" /> > <input type="hidden" name="gst" value="[% gst %]" /> > </div> > <div class="yui-u"> >@@ -185,13 +185,12 @@ > <input type="text" size="20" name="cost" id="cost" value="[% ecost %]" /> > [% END %]</li></ol> > <label for="note">Notes: </label><textarea name="note" width="40" rows="8" >[% notes %]</textarea> >- <input type="hidden" name="invoice" value="[% invoice %]" /> > </fieldset> > >-</div> >+ </div> > </div><div class="yui-g"><fieldset class="action"> > <input type="submit" value="Save" /> >- <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% supplierid %]&invoice=[% invoice %]&gst=[% gst %]&freight=[% freight %]">Cancel</a> >+ <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Cancel</a> > </fieldset></div> </form> > [% ELSE %] > <div id="acqui_acquire_orderlist"> >@@ -208,7 +207,7 @@ > <tr> > <td>[% loo.basketno %]</td> > <td>[% loo.isbn %]</td> >- <td><a href="orderreceive.pl?datereceived=[% loo.datereceived %]&receive=[% loo.ordernumber %]&biblio=[% loo.biblionumber %]&invoice=[% loo.invoice %]&freight=[% loo.freight %]&gst=[% loo.gst %]&id=[% loo.id %]">[% loo.title |html %]</a></td> >+ <td><a href="orderreceive.pl?ordernumber=[% loo.ordernumber %]&invoiceid=[% invoiceid %]">[% loo.title |html %]</a></td> > <td>[% loo.author %]</td> > <td>[% loo.quantity %]</td> > <td>[% loo.quantityreceived %]</td> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >index 4ddfc7d..ef08925 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt >@@ -152,123 +152,125 @@ > //]]> > </script> > >+ > </head> > <body id="acq_parcel" class="acq"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'acquisitions-search.inc' %] >- >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › [% IF ( datereceived ) %] >- Receipt Summary for <i>[% name %]</i> [% IF ( invoice ) %]<i>[ [% invoice %] ]</i>[% END %] on <i>[% formatteddatereceived %]</i> >- [% ELSE %] >- Receive orders from [% name %] >- [% END %]</div> >- >-<div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >+ [% INCLUDE 'header.inc' %] >+ [% INCLUDE 'acquisitions-search.inc' %] >+ >+ <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › [% IF ( datereceived ) %] >+ Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %]<i>[ [% invoice %] ]</i>[% END %] on <i>[% formatteddatereceived %]</i> >+ [% ELSE %] >+ Receive orders from [% name %] >+ [% END %]</div> >+ >+ <div id="doc3" class="yui-t2"> >+ >+ <div id="bd"> >+ <div id="yui-main"> > <div class="yui-b"> >- [% IF ( receive_error ) %] >- <div class="dialog alert"> >- <h3>Error adding items:</h3> >- <ul> >- [% FOREACH error_loo IN error_loop %] >- <li>[% error_loo.error_param %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li> >- [% END %] >- </ul> >- </div> >- [% END %] >- <h1> >- [% IF ( datereceived ) %] >- Receipt Summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% formatteddatereceived %]</i> >- [% ELSE %] >+ [% IF ( receive_error ) %] >+ <div class="dialog alert"> >+ <h3>Error adding items:</h3> >+ <ul> >+ [% FOREACH error_loo IN error_loop %] >+ <li>[% error_loo.error_param %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li> >+ [% END %] >+ </ul> >+ </div> >+ [% END %] >+ <h1> >+ [% IF ( datereceived ) %] >+ Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% formatteddatereceived %]</i> >+ [% ELSE %] > Receive orders from [% name %] >- [% END %] >- </h1> >- >- [% IF ( success_delorder ) %] >- <div class="dialog message">The order has been successfully canceled.</div> >- [% ELSE %] >- [% IF ( error_delitem ) %] >- <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div> >- [% END %] >- [% IF ( error_delbiblio ) %] >- <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div> >- [% END %] >- [% END %] >- >-<div id="acqui_receive_summary"> >-<p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p> >- <!-- TODO: Add date picker, change rcv date. --> >-</div> >-<div id="acqui_receive_search"> >- <h3>Pending Orders</h3> >- >- [% IF ( loop_orders ) %]<table id="pendingt"> >- <thead> >- <tr> >- <th>Basket</th> >- <th>Order Line</th> >- <th>Summary</th> >- <th>View Record</th> >- <th>Quantity</th> >- <th>Unit cost</th> >- <th>Order cost</th> >- <th> </th> >- <th> </th> >- </tr> >- </thead> >- <tfoot> >- <tr><td colspan="4" class="total">TOTAL</td> >- <td> [% totalPquantity %] </td> >- <td> </td> >- <td>[% ordergrandtotal %]</td> >- <td> </td> >- <td> </td> >- </tr> >- </tfoot> >- <tbody class="filterclass"> >- [% FOREACH loop_order IN loop_orders %] >- [% UNLESS ( loop.odd ) %] >- <tr class="highlight"> >- [% ELSE %] >- <tr> >- [% END %] >- <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a></td> >- <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td> >- <td class="summaryfilterclass"> >- <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a> >- [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %] >- [% IF ( loop_order.isbn ) %] – [% loop_order.isbn %][% END %] >- [% IF ( loop_order.publishercode ) %]<br />Publisher :[% loop_order.publishercode %][% END %] >- [% IF ( loop_order.suggestionid ) %] >+ [% END %] >+ </h1> >+ >+ [% IF ( success_delorder ) %] >+ <div class="dialog message">The order has been successfully canceled.</div> >+ [% ELSE %] >+ [% IF ( error_delitem ) %] >+ <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div> >+ [% END %] >+ [% IF ( error_delbiblio ) %] >+ <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div> >+ [% END %] >+ [% END %] >+ >+ <div id="acqui_receive_summary"> >+ <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% formatteddatereceived %]</p> >+ <p><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">Go to invoice details</a></p> >+ </div> >+ [% UNLESS (invoiceclosedate) %] >+ <div id="acqui_receive_search"> >+ <h3>Pending Orders</h3> >+ >+ [% IF ( loop_orders ) %]<table id="pendingt"> >+ <thead> >+ <tr> >+ <th>Basket</th> >+ <th>Order line</th> >+ <th>Summary</th> >+ <th>View record</th> >+ <th>Quantity</th> >+ <th>Unit cost</th> >+ <th>Order cost</th> >+ <th> </th> >+ <th> </th> >+ </tr> >+ </thead> >+ <tfoot> >+ <tr><td colspan="4" class="total">TOTAL</td> >+ <td> [% totalPquantity %] </td> >+ <td> </td> >+ <td>[% ordergrandtotal %]</td> >+ <td> </td> >+ <td> </td> >+ </tr> >+ </tfoot> >+ <tbody class="filterclass"> >+ [% FOREACH loop_order IN loop_orders %] >+ [% UNLESS ( loop.odd ) %] >+ <tr class="highlight"> >+ [% ELSE %] >+ <tr> >+ [% END %] >+ <td class="basketfilterclass"><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a></td> >+ <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td> >+ <td class="summaryfilterclass"> >+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a> >+ [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %] >+ [% IF ( loop_order.isbn ) %] – [% loop_order.isbn %][% END %] >+ [% IF ( loop_order.publishercode ) %]<br />Publisher :[% loop_order.publishercode %][% END %] >+ [% IF ( loop_order.suggestionid ) %] > <br/> > Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %] > (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&op=show">suggestion #[% loop_order.suggestionid %]</a>) >- [% END %] >- <br /> >- [% IF ( loop_order.notes ) %] >+ [% END %] >+ <br /> >+ [% IF ( loop_order.notes ) %] > <p class="ordernote"><strong>Note: </strong>[% loop_order.notes|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Fbooksellerid=[% loop_order.booksellerid %]&datereceived=[% loop_order.invoicedatereceived %]&invoice=[% loop_order.invoice %]">Change note</a>]</p> >- [% ELSE %] >+ [% ELSE %] > [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Fbooksellerid=[% loop_order.booksellerid %]&datereceived=[% loop_order.invoicedatereceived %]&invoice=[% loop_order.invoice %]">Add note</a>] >- [% END %] >- </td> >- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> >- <td>[% loop_order.quantity %]</td> >- <td>[% loop_order.ecost %]</td> >- <td>[% loop_order.ordertotal %]</td> >- <td> >- <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&datereceived=[% loop_order.invoicedatereceived %]&invoice=[% loop_order.invoice %]&gst=[% loop_order.gst %]&freight=[% loop_order.freight %]&booksellerid=[% loop_order.booksellerid %]">Receive</a> >- >- </td> >- <td> >- [% IF ( loop_order.left_holds_on_order ) %] >+ [% END %] >+ </td> >+ <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> >+ <td>[% loop_order.quantity %]</td> >+ <td>[% loop_order.ecost %]</td> >+ <td>[% loop_order.ordertotal %]</td> >+ <td> >+ <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&invoiceid=[% invoiceid %]">Receive</a> >+ >+ </td> >+ <td> >+ [% IF ( loop_order.left_holds_on_order ) %] > <span class="button" title="Can't delete order, ([% loop_order.holds_on_order %]) holds are linked with this order cancel holds first">Can't delete order</span><br> > [% ELSE %] >- <a href="javascript:confirm_delete_item([% loop_order.ordernumber %],[% loop_order.basketno %],[% loop_order.biblionumber %])" class="button">Delete order</a><br> >+ <a href="javascript:confirm_delete_item([% loop_order.ordernumber %],[% loop_order.biblionumber %])" class="button">Delete order</a><br> > [% END %] > [% IF ( loop_order.can_del_bib ) %] >- <a href="javascript:confirm_delete_biblio([% loop_order.ordernumber %],[% loop_order.basketno %],[% loop_order.biblionumber %])" class="button">Delete order and catalog record</a><br> >+ <a href="javascript:confirm_delete_biblio([% loop_order.ordernumber %],[% loop_order.biblionumber %])" class="button">Delete order and catalog record</a><br> > [% ELSE %] > <span class="button" title="Can't delete catalog record, see constraints below">Can't delete order and catalog record</span><br> > [% END %] >@@ -284,156 +286,163 @@ > [% IF ( loop_order.left_holds ) %] > <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b> > [% END %] >- </td> >- </tr> >- [% END %] >- </tbody> >- </table>[% ELSE %]There are no pending orders.[% END %] >- <div id="resultnumber"> >- <!-- Row of numbers corresponding to search result pages --> >- [% IF ( displayprev ) %] >- <a href="parcel.pl?type=intra&booksellerid=[% booksellerid %]&startfrom=[% prevstartfrom %][% IF ( datereceived ) %]&datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber"><< Previous</a> >- [% END %] >- [% FOREACH number IN numbers %] >- [% IF ( number.highlight ) %] >- <span class="current">[% number.number %]</span> >- [% ELSE %] >- <a href="parcel.pl?type=intra&booksellerid=[% booksellerid %]&startfrom=[% number.startfrom %][% IF ( datereceived ) %]&datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">[% number.number %]</a> >+ </td> >+ </tr> > [% END %] >- [% END %] >- [% IF ( displaynext ) %] >- <a href="parcel.pl?type=intra&booksellerid=[% booksellerid %]&startfrom=[% nextstartfrom %][% IF ( datereceived ) %]&datereceived=[% datereceived %][% END %][% IF ( invoice ) %]&invoice=[% invoice %][% END %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">Next >></a> >- [% END %] >+ </tbody> >+ </table> >+ [% ELSE %]There are no pending orders.[% END %] >+ <div id="resultnumber"> >+ <!-- Row of numbers corresponding to search result pages --> >+ [% IF ( displayprev ) %] >+ <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% prevstartfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber"><< Previous</a> >+ [% END %] >+ [% FOREACH number IN numbers %] >+ [% IF ( number.highlight ) %] >+ <span class="current">[% number.number %]</span> >+ [% ELSE %] >+ <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% number.startfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">[% number.number %]</a> >+ [% END %] >+ [% END %] >+ [% IF ( displaynext ) %] >+ <a href="parcel.pl?invoiceid=[% invoiceid %]&startfrom=[% nextstartfrom %][% IF ( resultsperpage ) %]&resultsperpage=[% resultsperpage %][% END %]#resultnumber">Next >></a> >+ [% END %] >+ </div> >+ </div> >+ [% ELSE %] >+ <p> >+ Invoice is close, so you can't receive orders. >+ <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Reopen it</a>. >+ </p> >+ [% END %] >+ <div id="acqui_receive_receivelist"> >+ <h3>Already received</h3> >+ >+ [% IF ( loop_received ) %] >+ <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform"> >+ <table id="receivedt"> >+ <thead> >+ <tr> >+ <th>Basket</th> >+ <th>Order line</th> >+ <th>Summary</th> >+ <th>View record</th> >+ <th>Quantity</th> >+ <th>Est cost</th> >+ <th>Actual cost</th> >+ <th>TOTAL</th> >+ </tr> >+ </thead> >+ <tfoot> >+ <tr> >+ <td colspan="4" class="total">SUBTOTAL</td> >+ <td colspan="2"> </td> >+ <td>[% totalprice %]</td> >+ <td>[% tototal %]</td> >+ </tr> >+ >+ [% IF ( totalfreight ) %] >+ <tr> >+ <td colspan="6"> >+ </td> >+ <td>Shipping</td> >+ <td>[% totalfreight %]</td> >+ </tr> >+ [% END %] >+ [% IF ( gst ) %] >+ <tr> >+ <td colspan="6"> >+ <p class="message"> >+ <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> >+ </td> >+ <td><b>Tax rate</b></td> >+ <td>[% gst %]</td> >+ </tr> >+ [% END %] >+ <tr> >+ <td colspan="4" class="total">TOTAL</td> >+ <td>[% totalquantity %]</td> >+ <td colspan="2"> </td> >+ <td>[% grandtot %]</td> >+ </tr> >+ </tfoot> >+ <tbody class="filterclass"> >+ [% FOREACH loop_receive IN loop_received %] >+ [% UNLESS ( loop.odd ) %] >+ <tr class="highlight"> >+ [% ELSE %] >+ <tr> >+ [% END %] >+ <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td> >+ <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td> >+ <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a> >+ [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %] >+ [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %] >+ [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %] >+ [% IF ( loop_receive.suggestionid ) %] >+ <br/> >+ Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %] >+ (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&op=show">suggestion #[% loop_receive.suggestionid %]</a>) >+ [% END %] >+ </td> >+ <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> >+ <td>[% loop_receive.quantityreceived %]</td> >+ <td>[% loop_receive.ecost %]</td> >+ <td>[% loop_receive.unitprice %]</td> >+ <td>[% loop_receive.total %]</td> >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </form> >+ [% ELSE %]There are no received orders.[% END %] >+ </div> >+ >+ <!--<form action="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid %]" method="post">--> >+ <form action="parcels.pl?booksellerid=[% booksellerid %]" method="post"> >+ <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >+ <fieldset class="action"> >+ <input type="submit" value="Finish receiving" /> >+ </fieldset> >+ </form> >+ > </div> >-</div> >-<div id="acqui_receive_receivelist"> >- <h3>Already Received</h3> >- >- [% IF ( loop_received ) %] >- <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform"> >- <table id="receivedt"> >- <thead> >- <tr> >- <th>Basket</th> >- <th>Order Line</th> >- <th>Summary</th> >- <th>View Record</th> >- <th>Quantity</th> >- <th>Est cost</th> >- <th>Actual cost</th> >- <th>TOTAL</th> >- </tr> >- </thead> >-<tfoot> >- <tr> >- <td colspan="4" class="total">SUBTOTAL</td> >- <td colspan="2"> </td> >- <td>[% totalprice %]</td> >- <td>[% tototal %]</td> >- </tr> >- >- [% IF ( totalfreight ) %] >- <tr> >- <td colspan="6"> >- </td> >- <td>Shipping</td> >- <td>[% totalfreight %]</td> >- </tr> >- [% END %] >- [% IF ( gst ) %] >- <tr> >- <td colspan="6"> >- <p class="message"> >- <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> >- </td> >- <td><b>Tax rate</b></td> >- <td>[% gst %]</td> >- </tr> >- [% END %] >- <tr> >- <td colspan="4" class="total">TOTAL</td> >- <td>[% totalquantity %]</td> >- <td colspan="2"> </td> >- <td>[% grandtot %]</td> >- </tr> >- </tfoot> >- <tbody class="filterclass"> >- [% FOREACH loop_receive IN loop_received %] >- [% UNLESS ( loop.odd ) %] >- <tr class="highlight"> >- [% ELSE %] >- <tr> >- [% END %] >- <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_receive.basketno %]">[% loop_receive.basketno %]</a></td> >- <td><a href="neworderempty.pl?ordernumber=[% loop_receive.ordernumber %]&booksellerid=[% booksellerid %]">[% loop_receive.ordernumber %]</a></td> >- <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_receive.biblionumber %]">[% loop_receive.title |html %]</a> >- [% IF ( loop_receive.author ) %] / [% loop_receive.author %][% END %] >- [% IF ( loop_receive.isbn ) %] - [% loop_receive.isbn %][% END %] >- [% IF ( loop_receive.publishercode ) %]<br />Publisher :[% loop_receive.publishercode %][% END %] >- [% IF ( loop_receive.suggestionid ) %] >- <br/> >- Suggested by: [% loop_receive.surnamesuggestedby %][% IF ( loop_receive.firstnamesuggestedby ) %], [% loop_receive.firstnamesuggestedby %] [% END %] >- (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_receive.suggestionid %]&op=show">suggestion #[% loop_receive.suggestionid %]</a>) >- [% END %] >- </td> >- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% loop_receive.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> >- <td>[% loop_receive.quantityreceived %]</td> >- <td>[% loop_receive.ecost %]</td> >- <td>[% loop_receive.unitprice %]</td> >- <td>[% loop_receive.total %]</td> >- </tr> >- [% END %] >- </tbody> >- </table> >- </form> >- [% ELSE %]There are no received orders.[% END %] >-</div> >- >-<!--<form action="/cgi-bin/koha/acqui/parcels.pl?booksellerid=[% booksellerid %]" method="post">--> >-<form action="parcels.pl?booksellerid=[% booksellerid %]" method="post"> >- <input type="hidden" name="booksellerid" value="[% booksellerid %]" /> >- <fieldset class="action"> >- <input type="submit" value="Finish receiving" /> >- </fieldset> >-</form> >- >-</div> >-</div> >-<div class="yui-b"> >-<form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" onsubmit="return filter();"> >- <fieldset class="brief"> >- >+ </div> >+ <div class="yui-b"> >+ <form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" onsubmit="return filter();"> >+ <fieldset class="brief"> >+ > <h4>Filter</h4> >- >+ > <ol> >- >- <li> >- <label for="summaryfilter">ISBN, author or title :</label> >- <input type="text" name="summaryfilter" id="summaryfilter" /> >- </li> >- >- <li> >- <label for="basketfilter">Basket :</label> >- <input type="text" name="basketfilter" id="basketfilter" /> >- </li> >- >- <li> >- <label for="orderfilter">Order Line :</label> >- <input type="text" name="orderfilter" id="orderfilter" /> >- </li> >+ >+ <li> >+ <label for="summaryfilter">ISBN, author or title :</label> >+ <input type="text" name="summaryfilter" id="summaryfilter" /> >+ </li> >+ >+ <li> >+ <label for="basketfilter">Basket :</label> >+ <input type="text" name="basketfilter" id="basketfilter" /> >+ </li> >+ >+ <li> >+ <label for="orderfilter">Order line :</label> >+ <input type="text" name="orderfilter" id="orderfilter" /> >+ </li> > </ol> >- <fieldset class="action"> >- <input type="submit" value="Filter" /> >- <a href="#" onclick="clearFilters();">Clear</a> >- </fieldset> >- >- >- </fieldset> >- </form> >-[% INCLUDE 'acquisitions-menu.inc' %] >-</div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >- >+ <fieldset class="action"> >+ <input type="submit" value="Filter" /> >+ <a href="#" onclick="clearFilters();">Clear</a> >+ </fieldset> >+ >+ >+ </fieldset> >+ </form> >+ [% INCLUDE 'acquisitions-menu.inc' %] >+ </div> >+ </div> >+ [% INCLUDE 'intranet-bottom.inc' %] >+ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >index 712c472..74c0a13 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcels.tt >@@ -2,6 +2,23 @@ > <title>Koha › Acquisitions › Receive shipment from vendor [% name %]</title> > [% INCLUDE 'doc-head-close.inc' %] > [% INCLUDE 'calendar.inc' %] >+<script language="JavaScript" type="text/javascript"> >+//<![CDATA[ >+ $(document).ready(function() { >+ Calendar.setup({ >+ inputField : "shipmentdate", >+ ifFormat : "[% DHTMLcalendar_dateformat %]", >+ button : "shipmentdate_button" >+ }); >+ Calendar.setup({ >+ inputField: "billingdate", >+ ifFormat: "[% DHTMLcalendar_dateformat %]", >+ button: "billingdateCalendar" >+ }); >+}); >+ //]]> >+</script> >+ > </head> > <body id="acq_parcels" class="acq"> > [% INCLUDE 'header.inc' %] >@@ -14,7 +31,12 @@ > <div id="bd"> > <div id="yui-main"> > <div class="yui-b"> >- >+ >+[% IF ( error_failed_to_create_invoice ) %] >+ <div id="error" class="dialog error"> >+ <p>An error has occured. Invoice cannot be created.</p> >+ </div> >+[% END %] > <h1>Receive shipment from vendor <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% name %]</a></h1> > > [% IF ( count ) %] >@@ -27,9 +49,11 @@ > <th>Line</th> > <th>Date Received</th> > <th>Invoice Number</th> >+ <th>Invoice Note</th> > <th>Item Count</th> > <th>Biblio count</th> > <th>Items expected</th> >+ <th>Actions</th> > </tr> > <!-- Actual Search Results --> > [% FOREACH searchresult IN searchresults %] >@@ -42,11 +66,19 @@ > [% searchresult.number %] > </td> > <td> >- <a href="/cgi-bin/koha/acqui/parcel.pl?type=intra&booksellerid=[% booksellerid |url %]&datereceived=[% searchresult.raw_datereceived |url %][% IF ( searchresult.code ) %]&invoice=[% searchresult.code |url %][% END %]"> >- [% searchresult.datereceived %]</a> >+ [% searchresult.datereceived %] >+ </td> >+ <td> >+ [% IF ( searchresult.code ) %] >+ <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% searchresult.invoiceid %]"> >+ [% searchresult.code %] >+ </a> >+ [% ELSE %] >+ <acronym title="not available">n/a</acronym> >+ [% END %] > </td> > <td> >- [% IF ( searchresult.code ) %][% searchresult.code %][% ELSE %]<acronym title="not available">n/a</acronym>[% END %] >+ [% searchresult.invoicenote %] > </td> > <td> > [% searchresult.reccount %] >@@ -57,6 +89,10 @@ > <td> > [% searchresult.itemcount %] > </td> >+ <td> >+ <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% searchresult.invoiceid %]">Edit</a> / >+ <a href="/cgi-bin/koha/acqui/parcels.pl?op=delete&invoiceid=[% searchresult.invoiceid %]&booksellerid=[% booksellerid %]">Delete</a> >+ </td> > </tr> > [% END %] > </table> >@@ -81,7 +117,7 @@ > [% END %] > > <div id="parcels_new_parcel"> >- <form method="get" action="parcel.pl"> >+ <form method="get" action="parcels.pl"> > <fieldset class="rows"> > <legend>Receive a new shipment</legend> > <ol> <li> >@@ -90,29 +126,21 @@ > <input type="hidden" name="op" value="new" /> > <input type="text" size="20" id="invoice" name="invoice" /> > </li> >- [% IF ( gst ) %] >- <li> >- <label for="gst">GST:</label> >- <input type="text" size="20" id="gst" name="gst" /> >- </li> >- [% END %] >- <!-- // Removing freight input until shipping can be proplerly handled . >- <li> >- <label for="freight">Shipping:</label> >- <input type="text" size="20" id="freight" name="freight" /> >- </li> --> >- <li><label for="datereceived">Shipment date: </label> >- <input type="text" id="datereceived" name="datereceived" maxlength="10" size="10" value="[% datereceived_today %]" /> >- <img src="[% themelang %]/lib/calendar/cal.gif" id="datereceived_button" alt="Show Calendar" /> >- <script language="JavaScript" type="text/javascript"> >- Calendar.setup( >- { >- inputField : "datereceived", >- ifFormat : "[% DHTMLcalendar_dateformat %]", >- button : "datereceived_button" } >- ); >- </script> >- <div class="hint">[% INCLUDE 'date-format.inc' %]</div> </li> >+ <li> >+ <label for="invoicenote">Invoice note</label> >+ <input type="text" size="20" id="invoicenote" name="invoicenote" /> >+ </li> >+ >+ <li><label for="billingdate">Billing date:</label> >+ <input type="text" size="10" id="billingdate" name="billingdate" value="[% today %]" readonly="readonly" /> >+ <img id="billingdateCalendar" alt="Show Calendar" style="cursor:pointer" src="[% themelang %]/lib/calendar/cal.gif" /> >+ </li> >+ >+ >+ <li><label for="shipmentdate">Shipment date: </label> >+ <input type="text" id="shipmentdate" name="shipmentdate" maxlength="10" size="10" value="[% today %]" /> >+ <img src="[% themelang %]/lib/calendar/cal.gif" id="shipmentdate_button" alt="Show Calendar" /> >+ <div class="hint">[% INCLUDE 'date-format.inc' %]</div> </li> > </ol> > </fieldset> > <fieldset class="action"><input type="submit" class="button" value="Next" /> <a class="cancel" href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">Cancel</a></fieldset> >@@ -127,6 +155,7 @@ > <ol> > <li> <input type="hidden" name="booksellerid" value="[% booksellerid %]" /></li> > <li><label for="filter">Invoice number:</label><input type="text" size="20" name="filter" value="[% filter %]" id="filter" /></li> >+ <li><label for="notefilter">Invoice note:</label><input type="text" size="20" name="notefilter" value="[% notefilter %]" id="notefilter" /></li> > <li><label for="datefrom">From:</label><input type="text" size="9" id="datefrom" name="datefrom" value="[% datefrom %]" /><br /> > <label for="dateto">To:</label><input type="text" size="9" id="dateto" name="dateto" value="[% dateto %]" /></li> > <li><label for="orderby">Sort by :</label><select name="orderby" id="orderby"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >index 622604b..323b2e8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/spent.tt >@@ -47,13 +47,13 @@ > [% order.title %] > </td> > <td class="cell"> >- <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&biblio=[% order.biblionumber %]&invoice=[% order.booksellerinvoicenumber %]&booksellerid=[% order.booksellerid %]&catview=yes">[% order.ordernumber %]</a> >+ <a href="/cgi-bin/koha/acqui/orderreceive.pl?ordernumber=[% order.ordernumber %]&biblio=[% order.biblionumber %]&invoiceid=[% order.invoiceid %]">[% order.ordernumber %]</a> > </td> > <td class="cell"> > <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% order.booksellerid %]">[% order.booksellerid %]</a> > </td> > <td class="cell"> >- <a href="/cgi-bin/koha/acqui/parcel.pl?invoice=[% order.booksellerinvoicenumber %]&booksellerid=[% order.booksellerid %]&datereceived=[% order.datereceived %]">[% order.booksellerinvoicenumber %]</a> >+ <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid %]">[% order.invoicenumber %]</a> > </td> > <td class="cell"> > [% order.itype %] >@@ -65,37 +65,35 @@ > [% order.unitprice %] > </td> > <td class="cell" align="right"> >- [% order.freight %] >- </td> >- <td class="cell" align="right"> > [% order.entrydate | $KohaDates %] > </td> > <td class="cell" align="right"> > [% order.datereceived | $KohaDates %] > </td> > <td class="cell" align="right"> >- [% order.subtotal %] >+ [% order.rowtotal %] > </td> > </tr> > [% END %] > <tfoot> >- <tr valign="top"> >- <td> Total </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td> </td> >- <td align="right"> >- [% total %] >- </td> >+ [% IF shipmentcosts.size %] >+ <tr valign="top"> >+ <td colspan="9"> Sub total </td> >+ <td align="right"> [% subtotal %] </td> >+ </tr> >+ [% FOREACH shipmentcost IN shipmentcosts %] >+ <tr> >+ <td></td> >+ <td colspan="8">Shipment cost for invoice [% shipmentcost.invoicenumber %]</td> >+ <td class="total">[% shipmentcost.shipmentcost %]</td> >+ </tr> >+ [% END %] >+ [% END %] >+ <tr> >+ <td colspan="9">TOTAL</td> >+ <td class="total">[% total %]</td> > </tr> > </tfoot> >- > </table> > > </div> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >index 5b9547f..24f11c5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt >@@ -168,16 +168,16 @@ > > [% IF ITEM_DAT.dateaccessioned %] > <li><span class="label">Accession date:</span> >- [% IF ( CAN_user_acquisition_order_receive && ITEM_DAT.booksellerinvoicenumber ) %] >- <a href="/cgi-bin/koha/acqui/parcel.pl?booksellerid=[% ITEM_DAT.booksellerid %]&invoice=[% ITEM_DAT.booksellerinvoicenumber %]&datereceived=[% ITEM_DAT.datereceived %]">[% ITEM_DAT.dateaccessioned | $KohaDates %]</a> >+ [% IF ( CAN_user_acquisition_order_receive && ITEM_DAT.invoiceid ) %] >+ <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% ITEM_DAT.invoiceid %]">[% ITEM_DAT.dateaccessioned | $KohaDates %]</a> > [% ELSE %] > [% ITEM_DAT.dateaccessioned | $KohaDates %] > [% END %] > </li> > [% END %] >- [% IF ( ITEM_DAT.booksellerinvoicenumber ) %] >+ [% IF ( ITEM_DAT.invoicenumber ) %] > <li><span class="label">Invoice number:</span> >- [% ITEM_DAT.booksellerinvoicenumber %] >+ [% ITEM_DAT.invoicenumber %] > </li> > [% END %] > >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 5339
:
7072
|
7073
|
7447
|
7448
|
7690
|
7691
|
7692
|
7693
|
7862
|
7863
|
7961
|
7962
|
8330
|
8331
|
8354
|
8355
|
8555
|
8556
|
8664
|
8665
|
8858
|
8948
|
8949
|
9382
|
10135
|
10137
|
10460
|
10934
|
11077
|
11535
|
11574
|
12266
|
12267
|
12352
|
12353
|
12369