6 [% PROCESS 'i18n.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
10 [% IF ( invoiceclosedate ) %]
11 Receipt summary for [% name | html %] [% IF ( invoice ) %]invoice [
12 % invoice | html %][% END %]
14 Receive orders from [% name | html %]
15 [% END %] › Acquisitions › Koha
17 [% INCLUDE 'doc-head-close.inc' %]
20 <body id="acq_parcel" class="acq">
21 [% WRAPPER 'header.inc' %]
22 [% INCLUDE 'acquisitions-search.inc' %]
25 [% WRAPPER 'sub-header.inc' %]
26 [% WRAPPER breadcrumbs %]
27 [% WRAPPER breadcrumb_item %]
28 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
30 [% IF invoiceclosedate %]
31 [% WRAPPER breadcrumb_item bc_active= 1 %]
33 <span>Receipt summary for <em>[% name | html %] [ [% invoice | html %] ]</em></span>
35 <span>Receipt summary for <em>[% name | html %]</em></span>
39 [% WRAPPER breadcrumb_item %]
40 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
42 [% WRAPPER breadcrumb_item bc_active= 1 %]
43 <span>Receive orders from [% name | html %]</span>
46 [% END #/ WRAPPER breadcrumbs %]
47 [% END #/ WRAPPER sub-header.inc %]
49 <div class="main container-fluid">
51 <div class="col-sm-10 col-sm-push-2">
54 [% IF ( receive_error ) %]
55 <div class="dialog alert">
56 <h3>Error adding items:</h3>
58 [% FOREACH error_loo IN error_loop %]
59 <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate barcode[% END %] <!-- todo: other error conditions come here. --></li>
65 [% IF ( invoiceclosedate ) %]
66 <span>Receipt summary for <em>[% name | html %]</em></span> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
68 <span>Receive orders from [% name | html %]</span>
72 [% IF ( success_delorder ) %]
73 <div class="dialog message">The order has been successfully canceled.</div>
75 [% IF ( error_delitem ) %]
76 <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
78 [% IF ( error_delbiblio ) %]
79 <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
83 [% IF (error_cancelling_receipt) %]
84 <div class="dialog alert">
85 <span>Cannot cancel receipt. Possible reasons:</span>
88 The order line you are trying to cancel was created from a partial receipt
89 of another order line which is already received. Try to cancel this
93 The order line you are trying to cancel was created from a partial receipt
94 of another order line which has been deleted. Cancellation is not
101 [% IF error_invoice_not_known %]
102 <div class="dialog alert">
103 The invoice referenced by this invoiceid does not exist.
107 [% UNLESS no_orders_to_display %]
108 <div id="acqui_receive_summary">
109 <p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
111 [% UNLESS (invoiceclosedate) %]
112 <div id="acqui_receive_search" class="page-section">
113 <h3>Pending orders</h3>
114 <table id="pending_orders" class="table table-bordered table-striped">
118 <th>Basket group</th>
122 <th>Replacement price</th>
135 <span>Invoice is closed, so you can't receive orders anymore.</span>
136 [% IF CAN_user_acquisition_reopen_closed_invoices %]
137 <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>.
142 <div id="acqui_receive_receivelist" class="page-section">
143 <h3>Already received</h3>
145 [% IF ( loop_received ) %]
146 <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
147 <table id="receivedt">
151 <th>Basket group</th>
153 <th title="Item holds / Total holds">Holds</th>
156 <th>Replacement price</th>
166 [% FOREACH key IN subtotal_for_funds.keys.sort %]
168 [% IF invoiceincgst %]
169 <td colspan="6" class="total">(Tax inc.)</td>
171 <td colspan="6" class="total">(Tax exc.)</td>
173 <td colspan="3"><em>Subtotal for</em> [% key | html %]</td>
174 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
175 <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
181 <th colspan="11" class="total">Total tax exc.</th>
182 <th>[% total_tax_excluded | $Price %]</th>
185 [% FOREACH book_foot IN book_foot_loop %]
187 <th colspan="11">Total (GST [% book_foot.tax_rate * 100 | html %]%)</th>
188 <th>[% book_foot.tax_value | $Price %]</th>
193 <th colspan="11" class="total">Total tax inc.</th>
194 <th>[% total_tax_included | $Price %]</th>
198 <tbody class="filterclass">
199 [% FOREACH order IN loop_received %]
201 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
203 [% IF order.basketgroupid %]
204 <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
210 <a href="neworderempty.pl?ordernumber=[% order.ordernumber | uri %]&booksellerid=[% booksellerid | uri %]">[% order.ordernumber | html %]</a>
211 [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
212 (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber | uri %]&booksellerid=[% booksellerid | uri %]" title="Original order line">[% order.parent_ordernumber | html %]</a>)
216 [% IF order.total_holds > 0 %]
217 [% IF order.item_holds > 0 %]
218 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.item_holds | html %]</a></span>
223 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.total_holds | html %]</a></span>
229 [% INCLUDE 'biblio-title.inc' biblio=order link = 1 %]
230 [% IF ( order.author ) %] / [% order.author | html %][% END %]
231 [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
232 [% IF ( order.publishercode ) %]
233 <br />Publisher: [% order.publishercode | html %]
234 [%- IF ( order.publicationyear > 0) -%], [% order.publicationyear | html %]
235 [%- ELSIF ( order.copyrightdate > 0) -%] [% order.copyrightdate | html %]
238 [% IF ( order.suggestionid ) %]
240 Suggested by: [% order.surnamesuggestedby | html %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby | html %] [% END %]
241 (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid | uri %]&op=show">suggestion #[% order.suggestionid | html %]</a>)
244 [% IF ( order.order_internalnote ) %]
245 <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>
247 [<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>]
249 [% IF ( order.order_vendornote ) %]
250 <p class="ordernote"><strong>Vendor note: </strong>[% order.order_vendornote | html %]</p>
252 [<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>]
256 <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
257 <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber | uri %]" class="previewData">MARC</a><br>
258 <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber | uri %]" class="previewData">Card</a>
260 <td>[% order.replacementprice | $Price %]</td>
261 <td>[% order.quantityreceived | html %]</td>
262 <td>[% order.budget.budget_name | html %]</td>
263 <td>[% order.ecost | $Price %]</td>
264 <td>[% order.unitprice | $Price %]</td>
265 <td>[% order.total | $Price %]</td>
267 [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
268 [% IF loop_receive.cannot_cancel %]
269 [% span_title = BLOCK %]
270 <span>Cannot cancel receipt of this order line because it
271 was created from a partial receipt of order line no.
272 [% order.parent_ordernumber | html %], which is
273 already received. Try cancelling this one first and
277 [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
278 [%# Some additional checks should be added in the pl file %]
279 [% span_title = BLOCK %]
280 <span>Cannot cancel receipt of this order line because at least one hold exists on the records.</span>
283 <span title="[% span_title | collapse | html %]">
287 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]&op=cancelreceipt&ordernumber=[% order.ordernumber | uri %]">Cancel receipt</a>
296 [% ELSE %]There are no received orders.[% END %]
299 <div class="modal" id="dataPreview" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel">
300 <div class="modal-dialog modal-wide" role="document">
301 <div class="modal-content">
302 <div class="modal-header">
303 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
304 <h3 id="dataPreviewLabel">MARC previews</h3>
306 <div class="modal-body">
307 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
309 <div class="modal-footer">
310 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
312 </div> <!-- /.modal-content -->
313 </div> <!-- /.modal-dialog -->
314 </div> <!-- /.modal -->
316 [% IF (invoiceclosedate) %]
317 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | uri %]">View invoice</a>
319 <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
320 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
321 <fieldset class="action">
322 <input type="submit" class="btn btn-primary" value="Finish receiving" />
330 </div> <!-- /.col-sm-10.col-sm-push-2 -->
332 <div class="col-sm-2 col-sm-pull-10">
335 [% INCLUDE 'acquisitions-menu.inc' %]
337 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
338 </div> <!-- /.row -->
340 [% MACRO jsinclude BLOCK %]
341 [% Asset.js("js/acquisitions-menu.js") | $raw %]
342 [% INCLUDE 'datatables.inc' %]
343 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
345 dt_overwrite_html_sorting_localeCompare();
346 var columns_filter = {};
348 $(document).ready(function(){
350 if ( $("#receivedt").length ) {
351 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
353 "iDisplayLength": 10,
354 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
356 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
362 { "sType": "num-html" },
363 { "sType": "anti-the" },
373 "sPaginationType": "full"
377 var pending_orders_table = $("#pending_orders").kohaTable({
379 "url": '/api/v1/acquisitions/orders?only_active=1'
382 "basket.basket_group",
383 "biblio.active_orders+count",
384 "biblio.holds+count",
385 "biblio.items+count",
386 "biblio.suggestions.suggester",
388 "current_item_level_holds+count",
391 "stateSave": true, // remember state on page reload
392 "drawCallback": function (settings) {
393 $(".previewData").on("click", function(e){
395 var ltitle = $(this).text();
396 var page = $(this).attr("href");
397 $("#dataPreviewLabel").text(ltitle);
398 $("#dataPreview .modal-body").load(page + " div");
399 $('#dataPreview').modal({show:true});
403 { "data": "basket.name",
406 "render": function(data, type, row, meta) {
407 if (type != 'display') return escape_str(data);
408 return "<a href=\"/cgi-bin/koha/acqui/basket.pl?basketno=" + encodeURIComponent(row.basket.basket_id) + "\">" + escape_str(data) + " (" + escape_str(row.basket.basket_id) + ")</a>";
411 { "data": "basket.basket_group.name",
413 "render": function(data, type, row, meta) {
414 if ( type != 'display' ) {
415 return escape_str(data);
417 if ( row.basket.basket_group_id == null ) {
418 return _("No basket group");
421 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
422 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
423 + encodeURIComponent(row.basket.basket_group_id) + "\">"
424 + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>";
430 "render": function(data, type, row, meta) {
431 if (type != 'display') return escape_str(data);
432 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>";
436 [% SET summary_fields = "biblio.title:biblio.author:biblio.isbn:biblio.publisher:me.internal_note:me.vendor_note" %]
437 [% IF Koha.Preference('marcflavour')=='UNIMARC' %][% SET summary_fields = summary_fields _ ":biblio.ean" %][% END %]
438 "data": "[% summary_fields | html %]",
439 "render": function(data, type, row, meta) {
441 if ( row && row.biblio_id != null ) {
442 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>";
443 if ( row.biblio.author != null )
444 result += _(" by ") + escape_str(row.biblio.author);
445 if ( row.biblio.isbn != null )
446 result += " – " + escape_str(row.biblio.isbn);
447 [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
448 if ( row.biblio.ean != null )
449 result += " – EAN:" + escape_str(row.biblio.ean);
451 if ( row.biblio.publisher != null ) {
452 result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher);
453 if ( row.biblio.publication_year != null ) {
454 result += ", " + escape_str(row.biblio.publication_year);
456 else if ( row.biblio.copyright_date != null ) {
457 result += escape_str(row.biblio.copyright_date);
460 var suggestions = row.biblio.suggestions;
461 if ( suggestions != null && suggestions.length > 0 ) {
462 var suggestion = suggestions[0];
463 if ( suggestion.suggester != null ) {
464 var suggester = suggestion.suggester;
465 var suggested_by = [];
466 if ( suggester.surname != null ) {
467 suggested_by.push(escape_str(suggester.surname));
469 if ( suggester.firstname != null ) {
470 suggested_by.push(escape_str(suggester.firstname));
473 result += "<br/>" + _("Suggested by: ") +
474 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
475 + encodeURIComponent(suggestion.suggestionid)
477 + suggested_by.join(", ")
478 + " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
484 var internal_note = row.internal_note;
485 if ( internal_note != null && internal_note != '' ) {
486 result += '<p class="ordernote"><strong>'
487 + _("Internal note: ")
488 + '</strong>' + escape_str(internal_note)
489 + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
490 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
491 + '&type=internal">' + _("Change internal note") + '</a>]</p>';
494 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
495 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
496 + '&type=internal">' + _("Add internal note") + '</a>]';
499 var vendor_note = row.vendor_note;
500 if ( vendor_note != null && vendor_note != '' ) {
501 result += '<p class="ordernote"><strong>'
503 + '</strong>' + escape_str(vendor_note) + '</p>';
506 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
507 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
508 + '&type=vendor">' + _("Add vendor note") + '</a>]';
517 "render": function(data, type, row, meta) {
518 var result = '<div class="btn-group dropup">';
519 result += '<button id="view' + row.order_id + '" type="button" class="btn btn-default btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
520 result += ' <i class="fa fa-eye" aria-hidden="true"></i> ' + _("View");
521 result += ' <span class="caret"></span> ';
522 result += '</button>';
523 result += '<ul class="dropdown-menu" aria-labelledby="view' + row.order_id + '">';
524 result += '<li><a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a></li>';
525 result += '<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a></li>';
526 result += '<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a></li>';
535 "data": "replacement_price",
536 "render": function(data, type, row, meta) {
537 return escape_price(row.replacement_price);
546 "render": function(data, type, row, meta) {
547 return escape_price(row.ecost);
552 "render": function(data, type, row, meta) {
553 return escape_price(row.quantity * row.ecost);
555 "orderable": false, // FIXME: How can we do it in DBIC?
560 "render": function(data, type, row, meta) {
561 if (type != 'display') return escape_str(data);
562 return escape_str(row.fund.name);
567 "render": function(data, type, row, meta) {
568 return '<a href="orderreceive.pl?ordernumber='
569 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
570 + _("Receive") + '</a><br/>'
571 + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
572 + _("Transfer") + '</a>';
579 "render": function(data, type, row, meta) {
582 if ( row.current_holds_count > 0 ) {
583 result += '<span class="button" title="'
584 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">'
585 + _("Can't cancel order") + '</span><br/>';
588 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
589 + encodeURIComponent(row.order_id)
590 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
591 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
592 + _("Cancel order") + '</a><br/>';
595 if ( row.biblio != null ) {
596 if ( row.biblio.items_count - row.items.length > 0 ||
597 row.biblio.active_orders_count > 1 ||
598 row.biblio.subscriptions_count > 0 ||
599 row.biblio.holds_count > 0 ) { // biblio can be deleted
600 result += '<span class="button" title="'
601 + _("Can't delete catalog record, see constraints below") + '">'
602 + _("Can't cancel order and delete catalog record") + '</span><br>';
605 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
606 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
607 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
608 + _("Cancel order and catalog record") + '</a><br/>';
611 if ( row.biblio.items_count - row.items.length > 0 ) {
612 result += '<strong title="'
613 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
614 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
617 if ( row.biblio.active_orders_count > 1 ) {
618 result += '<strong title="'
619 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
620 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
623 if ( row.biblio.subscriptions_count > 0 ) {
624 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
625 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
629 if ( row.biblio.holds_count > 0 ) {
630 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
631 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
641 }, null, 1, {"basket.vendor_id": [% booksellerid | html %]});
643 $(".previewData").on("click", function(e){
645 var ltitle = $(this).text();
646 var page = $(this).attr("href");
647 $("#dataPreviewLabel").text(ltitle);
648 $("#dataPreview .modal-body").load(page + " div");
649 $('#dataPreview').modal("show");
652 $("#dataPreview").on("hidden.bs.modal", function(){
653 $("#dataPreviewLabel").html("");
654 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
658 // Case-insensitive version of jquery's contains function
659 jQuery.extend(jQuery.expr[':'], {
660 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
663 // Contains exactly function
664 jQuery.extend(jQuery.expr[':'], {
665 containsExactly: "$(a).text() == m[3]"
668 function transfer_order_popup(ordernumber) {
669 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
670 + "ordernumber=" + ordernumber
671 window.open(url, 'TransferOrder');
676 [% INCLUDE 'intranet-bottom.inc' %]