6 [% USE currency = format('%.2f') -%]
7 [% PROCESS 'i18n.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
11 Koha › Acquisitions ›
12 [% IF ( invoiceclosedate ) %]
13 Receipt summary for [% name | html %] [% IF ( invoice ) %]invoice [% invoice | html %][% END %]
15 Receive orders from [% name | html %]
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="acq_parcel" class="acq">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'acquisitions-search.inc' %]
25 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> ›
26 [% IF invoiceclosedate %]
27 Receipt summary for <em>[% name | html %]</em>
29 <em>[ [% invoice | html %] ]</em>
32 Receive orders from [% name | html %]
37 <div class="main container-fluid">
39 <div class="col-sm-10 col-sm-push-2">
42 [% IF ( receive_error ) %]
43 <div class="dialog alert">
44 <h3>Error adding items:</h3>
46 [% FOREACH error_loo IN error_loop %]
47 <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
53 [% IF ( invoiceclosedate ) %]
54 Receipt summary for <em>[% name | html %]</em> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
56 Receive orders from [% name | html %]
60 [% IF ( success_delorder ) %]
61 <div class="dialog message">The order has been successfully canceled.</div>
63 [% IF ( error_delitem ) %]
64 <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
66 [% IF ( error_delbiblio ) %]
67 <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
71 [% IF (error_cancelling_receipt) %]
72 <div class="dialog alert">
73 Cannot cancel receipt. Possible reasons :
76 The order line you are trying to cancel was created from a partial receipt
77 of another order line which is already received. Try to cancel this
81 The order line you are trying to cancel was created from a partial receipt
82 of another order line which has been deleted. Cancellation is not
89 [% IF error_invoice_not_known %]
90 <div class="dialog alert">
91 The invoice referenced by this invoiceid does not exist.
95 [% UNLESS no_orders_to_display %]
96 <div id="acqui_receive_summary">
97 <p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
99 [% UNLESS (invoiceclosedate) %]
100 <div id="acqui_receive_search">
101 <h3>Pending orders</h3>
102 <table id="pending_orders" class="table table-bordered table-striped">
106 <th>Basket group</th>
110 <th>Replacement price</th>
123 Invoice is closed, so you can't receive orders anymore.
124 [% IF CAN_user_acquisition_reopen_closed_invoices %]
125 <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid | uri %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]">Reopen it</a>.
130 <div id="acqui_receive_receivelist">
131 <h3>Already received</h3>
133 [% IF ( loop_received ) %]
134 <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
135 <table id="receivedt">
139 <th>Basket group</th>
141 <th title="Item holds / Total holds">Holds</th>
144 <th>Replacement price</th>
154 [% FOREACH key IN subtotal_for_funds.keys.sort %]
156 [% IF invoiceincgst %]
157 <td colspan="6" class="total">(Tax inc.)</td>
159 <td colspan="6" class="total">(Tax exc.)</td>
161 <td colspan="3"><em>Subtotal for</em> [% key | html %]</td>
162 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
163 <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
169 <th colspan="11" class="total">Total tax exc.</th>
170 <th>[% total_tax_excluded | $Price %]</th>
173 [% FOREACH book_foot IN book_foot_loop %]
175 <th colspan="11">Total (GST [% book_foot.tax_rate * 100 | html %]%)</th>
176 <th>[% book_foot.tax_value | $Price %]</th>
181 <th colspan="11" class="total">Total tax inc.</th>
182 <th>[% total_tax_included | $Price %]</th>
186 <tbody class="filterclass">
187 [% FOREACH order IN loop_received %]
189 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
191 [% IF order.basketgroupid %]
192 <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
198 <a href="neworderempty.pl?ordernumber=[% order.ordernumber | uri %]&booksellerid=[% booksellerid | uri %]">[% order.ordernumber | html %]</a>
199 [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
200 (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber | uri %]&booksellerid=[% booksellerid | uri %]" title="Original order line">[% order.parent_ordernumber | html %]</a>)
204 [% IF order.total_holds > 0 %]
205 [% IF order.item_holds > 0 %]
206 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.item_holds | html %]</a></span>
211 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.total_holds | html %]</a></span>
216 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title | html %]</a>
217 [% IF ( order.author ) %] / [% order.author | html %][% END %]
218 [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
219 [% IF ( order.publishercode ) %]
220 <br />Publisher: [% order.publishercode | html %]
221 [%- IF ( order.publicationyear > 0) -%], [% order.publicationyear | html %]
222 [%- ELSIF ( order.copyrightdate > 0) -%] [% order.copyrightdate | html %]
225 [% IF ( order.suggestionid ) %]
227 Suggested by: [% order.surnamesuggestedby | html %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby | html %] [% END %]
228 (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid | uri %]&op=show">suggestion #[% order.suggestionid | html %]</a>)
231 [% IF ( order.order_internalnote ) %]
232 <p class="ordernote"><strong>Internal note: </strong>[% order.order_internalnote | html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Change internal note</a>]</p>
234 [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=internal">Add internal note</a>]
236 [% IF ( order.order_vendornote ) %]
237 <p class="ordernote"><strong>Vendor note: </strong>[% order.order_vendornote | html %]</p>
239 [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% order.ordernumber | uri %]&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]&type=vendor">Add vendor note</a>]
243 <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
244 <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber | uri %]" class="previewData">MARC</a><br>
245 <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber | uri %]" class="previewData">Card</a>
247 <td>[% order.replacementprice | $Price %]</td>
248 <td>[% order.quantityreceived | html %]</td>
249 <td>[% order.budget.budget_name | html %]</td>
250 <td>[% order.ecost | $Price %]</td>
251 <td>[% order.unitprice | $Price %]</td>
252 <td>[% order.total | $Price %]</td>
254 [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
255 [% IF loop_receive.cannot_cancel %]
256 [% span_title = BLOCK %]
257 Cannot cancel receipt of this order line because it
258 was created from a partial receipt of order line no.
259 [% order.parent_ordernumber | html %], which is
260 already received. Try cancelling this one first and
264 [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
265 [%# Some additional checks should be added in the pl file %]
266 [% span_title = BLOCK %]
267 Cannot cancel receipt of this order line because at least one reservation exists on the records.
270 <span title="[% span_title | collapse | html %]">
274 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]&op=cancelreceipt&ordernumber=[% order.ordernumber | uri %]">Cancel receipt</a>
283 [% ELSE %]There are no received orders.[% END %]
286 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
287 <div class="modal-dialog">
288 <div class="modal-content">
289 <div class="modal-header">
290 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
291 <h3 id="dataPreviewLabel">MARC preview</h3>
293 <div class="modal-body">
294 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
296 <div class="modal-footer">
297 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
303 [% IF (invoiceclosedate) %]
304 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | uri %]">View invoice</a>
306 <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
307 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
308 <fieldset class="action">
309 <input type="submit" value="Finish receiving" />
317 </div> <!-- /.col-sm-10.col-sm-push-2 -->
319 <div class="col-sm-2 col-sm-pull-10">
322 [% INCLUDE 'acquisitions-menu.inc' %]
324 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
325 </div> <!-- /.row -->
327 [% MACRO jsinclude BLOCK %]
328 [% Asset.js("js/acquisitions-menu.js") | $raw %]
329 [% INCLUDE 'datatables.inc' %]
330 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
331 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
332 <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
334 dt_overwrite_html_sorting_localeCompare();
335 var columns_filter = {};
337 function _escape_str(s){
338 return s != null ? s.escapeHtml() : "";
340 function _escape_price(p){
341 return p != null ? p.escapeHtml().format_price() : "";
344 $(document).ready(function(){
346 if ( $("#receivedt").length ) {
347 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
349 "iDisplayLength": 10,
350 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
352 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
358 { "sType": "num-html" },
359 { "sType": "anti-the" },
369 "sPaginationType": "full"
373 var pending_orders_table = $("#pending_orders").api({
375 "url": '/api/v1/acquisitions/orders?only_active=1'
377 "header_filter": true,
379 "basket.basket_group",
380 "biblio.active_orders+count",
381 "biblio.holds+count",
382 "biblio.items+count",
383 "biblio.suggestions.suggester",
385 "current_item_level_holds+count",
388 "stateSave": true, // remember state on page reload
389 "drawCallback": function (settings) {
390 $(".previewData").on("click", function(e){
392 var ltitle = $(this).text();
393 var page = $(this).attr("href");
394 $("#dataPreviewLabel").text(ltitle);
395 $("#dataPreview .modal-body").load(page + " div");
396 $('#dataPreview').modal({show:true});
400 { "data": "basket.name",
403 "render": function(data, type, row, meta) {
404 if (type != 'display') return _escape_str(data);
405 return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + encodeURIComponent(row.basket.basket_id) + "\">" + data.escapeHtml() + " (" + row.basket.basket_id.escapeHtml() + ")</a>";
408 { "data": "basket.basket_group.name",
410 "render": function(data, type, row, meta) {
411 if ( type != 'display' ) {
412 return _escape_str(data);
414 if ( row.basket.basket_group_id == null ) {
415 return _("No basket group");
418 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
419 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
420 + encodeURIComponent(row.basket.basket_group_id) + "\">"
421 + row.basket.basket_group.name.escapeHtml() + " (" + row.basket.basket_group_id.escapeHtml() + ")</a>";
427 "render": function(data, type, row, meta) {
428 if (type != 'display') return _escape_str(data);
429 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+data.escapeHtml()+"</a>";
433 "data": "biblio.author:biblio.title:biblio.isbn",
434 "render": function(data, type, row, meta) {
436 if ( row && row.biblio_id != null ) {
437 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+row.biblio.title.escapeHtml()+"</a>";
438 if ( row.biblio.author != null )
439 result += _(" by ") + row.biblio.author.escapeHtml();
440 if ( row.biblio.isbn != null )
441 result += " – " + row.biblio.isbn.escapeHtml();
442 if ( row.biblio.publisher != null ) {
443 result += "<br/>" + _("Publisher: ") + row.biblio.publisher.escapeHtml();
444 if ( row.biblio.publication_year != null ) {
445 result += ", " + row.biblio.publication_year.escapeHtml();
447 else if ( row.biblio.copyright_date != null ) {
448 result += row.biblio.copyright_date.escapeHtml();
451 var suggestions = row.biblio.suggestions;
452 if ( suggestions != null && suggestions.length > 0 ) {
453 var suggestion = suggestions[0];
454 if ( suggestion.suggester != null ) {
455 var suggester = suggestion.suggester;
456 var suggested_by = [];
457 if ( suggester.surname != null ) {
458 suggested_by.push(suggester.surname.escapeHtml());
460 if ( suggester.firstname != null ) {
461 suggested_by.push(suggester.firstname.escapeHtml());
464 result += "<br/>" + _("Suggested by: ") +
465 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
466 + encodeURIComponent(suggestion.suggestionid)
468 + suggested_by.join(", ")
469 + " (#" + suggestions[0].suggestionid.escapeHtml() + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
475 var internal_note = row.internal_note;
476 if ( internal_note != null && internal_note != '' ) {
477 result += '<p class="ordernote"><strong>'
478 + _("Internal note: ")
479 + '</strong>' + internal_note.escapeHtml()
480 + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
481 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
482 + '&type=internal">' + _("Change internal note") + '</a>]</p>';
485 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
486 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
487 + '&type=internal">' + _("Add internal note") + '</a>]';
490 var vendor_note = row.vendor_note;
491 if ( vendor_note != null && vendor_note != '' ) {
492 result += '<p class="ordernote"><strong>'
494 + '</strong>' + vendor_note.escapeHtml() + '</p>';
497 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
498 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
499 + '&type=vendor">' + _("Add vendor note") + '</a>]';
508 "render": function(data, type, row, meta) {
509 var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a><br>'
510 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a><br>'
511 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a>';
518 "data": "replacement_price"
529 "render": function(data, type, row, meta) {
530 return (row.quantity * row.ecost).format_price();
532 "orderable": false, // FIXME: How can we do it in DBIC?
537 "render": function(data, type, row, meta) {
538 if (type != 'display') return data.escapeHtml();
539 return row.fund.name.escapeHtml();
544 "render": function(data, type, row, meta) {
545 return '<a href="orderreceive.pl?ordernumber='
546 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
547 + _("Receive") + '</a><br/>'
548 + '<a href="#" onclick="transfer_order_popup(' + row.order_id.escapeHtml() + '); return false;">'
549 + _("Transfer") + '</a>';
556 "render": function(data, type, row, meta) {
559 if ( row.current_holds_count > 0 ) {
560 result += '<span class="button" title="'
561 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( row.holds_count.escapeHtml() ) + '">'
562 + _("Can't cancel order") + '</span><br/>';
565 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
566 + encodeURIComponent(row.order_id)
567 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
568 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
569 + _("Cancel order") + '</a><br/>';
572 if ( row.biblio != null ) {
573 if ( row.biblio.items_count - row.items.length > 0 ||
574 row.biblio.active_orders_count > 1 ||
575 row.biblio.subscriptions_count > 0 ||
576 row.biblio.holds_count > 0 ) { // biblio can be deleted
577 result += '<span class="button" title="'
578 + _("Can't delete catalog record, see constraints below") + '">'
579 + _("Can't cancel order and delete catalog record") + '</span><br>';
582 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
583 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
584 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
585 + _("Cancel order and catalog record") + '</a><br/>';
588 if ( row.biblio.items_count - row.items.length > 0 ) {
589 result += '<strong title="'
590 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
591 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
594 if ( row.biblio.active_orders_count > 1 ) {
595 result += '<strong title="'
596 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
597 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
600 if ( row.biblio.subscriptions_count > 0 ) {
601 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
602 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
606 if ( row.biblio.holds_count > 0 ) {
607 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
608 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
618 }, {}, 1, {"basket.vendor_id": [% booksellerid | html %]});
620 $(".previewData").on("click", function(e){
622 var ltitle = $(this).text();
623 var page = $(this).attr("href");
624 $("#dataPreviewLabel").text(ltitle);
625 $("#dataPreview .modal-body").load(page + " div");
626 $('#dataPreview').modal({show:true});
629 $("#dataPreview").on("hidden.bs.modal", function(){
630 $("#dataPreviewLabel").html("");
631 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
635 // Case-insensitive version of jquery's contains function
636 jQuery.extend(jQuery.expr[':'], {
637 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
640 // Contains exactly function
641 jQuery.extend(jQuery.expr[':'], {
642 containsExactly: "$(a).text() == m[3]"
645 function transfer_order_popup(ordernumber) {
646 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
647 + "ordernumber=" + ordernumber
648 window.open(url, 'TransferOrder');
653 [% INCLUDE 'intranet-bottom.inc' %]