6 [% USE currency = format('%.2f') -%]
7 [% PROCESS 'i18n.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
11 [% IF ( invoiceclosedate ) %]
12 Receipt summary for [% name | html %] [% IF ( invoice ) %]invoice [
13 % invoice | html %][% END %]
15 Receive orders from [% name | html %]
16 [% END %] › Acquisitions › Koha
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="acq_parcel" class="acq">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'acquisitions-search.inc' %]
25 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
28 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
31 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
33 [% IF invoiceclosedate %]
35 Receipt summary for <em>[% name | html %]</em>
37 <em>[ [% invoice | html %] ]</em>
42 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
45 Receive orders from [% name | html %]
52 <div class="main container-fluid">
54 <div class="col-sm-10 col-sm-push-2">
57 [% IF ( receive_error ) %]
58 <div class="dialog alert">
59 <h3>Error adding items:</h3>
61 [% FOREACH error_loo IN error_loop %]
62 <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate barcode[% END %] <!-- todo: other error conditions come here. --></li>
68 [% IF ( invoiceclosedate ) %]
69 Receipt summary for <em>[% name | html %]</em> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
71 Receive orders from [% name | html %]
75 [% IF ( success_delorder ) %]
76 <div class="dialog message">The order has been successfully canceled.</div>
78 [% IF ( error_delitem ) %]
79 <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
81 [% IF ( error_delbiblio ) %]
82 <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
86 [% IF (error_cancelling_receipt) %]
87 <div class="dialog alert">
88 Cannot cancel receipt. Possible reasons :
91 The order line you are trying to cancel was created from a partial receipt
92 of another order line which is already received. Try to cancel this
96 The order line you are trying to cancel was created from a partial receipt
97 of another order line which has been deleted. Cancellation is not
104 [% IF error_invoice_not_known %]
105 <div class="dialog alert">
106 The invoice referenced by this invoiceid does not exist.
110 [% UNLESS no_orders_to_display %]
111 <div id="acqui_receive_summary">
112 <p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
114 [% UNLESS (invoiceclosedate) %]
115 <div id="acqui_receive_search">
116 <h3>Pending orders</h3>
117 <table id="pending_orders" class="table table-bordered table-striped">
121 <th>Basket group</th>
125 <th>Replacement price</th>
138 Invoice is closed, so you can't receive orders anymore.
139 [% IF CAN_user_acquisition_reopen_closed_invoices %]
140 <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>.
145 <div id="acqui_receive_receivelist">
146 <h3>Already received</h3>
148 [% IF ( loop_received ) %]
149 <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
150 <table id="receivedt">
154 <th>Basket group</th>
156 <th title="Item holds / Total holds">Holds</th>
159 <th>Replacement price</th>
169 [% FOREACH key IN subtotal_for_funds.keys.sort %]
171 [% IF invoiceincgst %]
172 <td colspan="6" class="total">(Tax inc.)</td>
174 <td colspan="6" class="total">(Tax exc.)</td>
176 <td colspan="3"><em>Subtotal for</em> [% key | html %]</td>
177 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
178 <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
184 <th colspan="11" class="total">Total tax exc.</th>
185 <th>[% total_tax_excluded | $Price %]</th>
188 [% FOREACH book_foot IN book_foot_loop %]
190 <th colspan="11">Total (GST [% book_foot.tax_rate * 100 | html %]%)</th>
191 <th>[% book_foot.tax_value | $Price %]</th>
196 <th colspan="11" class="total">Total tax inc.</th>
197 <th>[% total_tax_included | $Price %]</th>
201 <tbody class="filterclass">
202 [% FOREACH order IN loop_received %]
204 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
206 [% IF order.basketgroupid %]
207 <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
213 <a href="neworderempty.pl?ordernumber=[% order.ordernumber | uri %]&booksellerid=[% booksellerid | uri %]">[% order.ordernumber | html %]</a>
214 [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
215 (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber | uri %]&booksellerid=[% booksellerid | uri %]" title="Original order line">[% order.parent_ordernumber | html %]</a>)
219 [% IF order.total_holds > 0 %]
220 [% IF order.item_holds > 0 %]
221 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.item_holds | html %]</a></span>
226 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.total_holds | html %]</a></span>
231 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | uri %]">[% order.title | html %]</a>
232 [% IF ( order.author ) %] / [% order.author | html %][% END %]
233 [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
234 [% IF ( order.publishercode ) %]
235 <br />Publisher: [% order.publishercode | html %]
236 [%- IF ( order.publicationyear > 0) -%], [% order.publicationyear | html %]
237 [%- ELSIF ( order.copyrightdate > 0) -%] [% order.copyrightdate | html %]
240 [% IF ( order.suggestionid ) %]
242 Suggested by: [% order.surnamesuggestedby | html %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby | html %] [% END %]
243 (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid | uri %]&op=show">suggestion #[% order.suggestionid | html %]</a>)
246 [% IF ( order.order_internalnote ) %]
247 <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>
249 [<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>]
251 [% IF ( order.order_vendornote ) %]
252 <p class="ordernote"><strong>Vendor note: </strong>[% order.order_vendornote | html %]</p>
254 [<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>]
258 <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
259 <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber | uri %]" class="previewData">MARC</a><br>
260 <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber | uri %]" class="previewData">Card</a>
262 <td>[% order.replacementprice | $Price %]</td>
263 <td>[% order.quantityreceived | html %]</td>
264 <td>[% order.budget.budget_name | html %]</td>
265 <td>[% order.ecost | $Price %]</td>
266 <td>[% order.unitprice | $Price %]</td>
267 <td>[% order.total | $Price %]</td>
269 [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
270 [% IF loop_receive.cannot_cancel %]
271 [% span_title = BLOCK %]
272 Cannot cancel receipt of this order line because it
273 was created from a partial receipt of order line no.
274 [% order.parent_ordernumber | html %], which is
275 already received. Try cancelling this one first and
279 [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
280 [%# Some additional checks should be added in the pl file %]
281 [% span_title = BLOCK %]
282 Cannot cancel receipt of this order line because at least one reservation exists on the records.
285 <span title="[% span_title | collapse | html %]">
289 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]&op=cancelreceipt&ordernumber=[% order.ordernumber | uri %]">Cancel receipt</a>
298 [% ELSE %]There are no received orders.[% END %]
301 <div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
302 <div class="modal-dialog">
303 <div class="modal-content">
304 <div class="modal-header">
305 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
306 <h3 id="dataPreviewLabel">MARC preview</h3>
308 <div class="modal-body">
309 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
311 <div class="modal-footer">
312 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
318 [% IF (invoiceclosedate) %]
319 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | uri %]">View invoice</a>
321 <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
322 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
323 <fieldset class="action">
324 <input type="submit" value="Finish receiving" />
332 </div> <!-- /.col-sm-10.col-sm-push-2 -->
334 <div class="col-sm-2 col-sm-pull-10">
337 [% INCLUDE 'acquisitions-menu.inc' %]
339 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
340 </div> <!-- /.row -->
342 [% MACRO jsinclude BLOCK %]
343 [% Asset.js("js/acquisitions-menu.js") | $raw %]
344 [% INCLUDE 'datatables.inc' %]
345 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
346 <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
348 dt_overwrite_html_sorting_localeCompare();
349 var columns_filter = {};
351 $(document).ready(function(){
353 if ( $("#receivedt").length ) {
354 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
356 "iDisplayLength": 10,
357 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
359 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
365 { "sType": "num-html" },
366 { "sType": "anti-the" },
376 "sPaginationType": "full"
380 var pending_orders_table = $("#pending_orders").api({
382 "url": '/api/v1/acquisitions/orders?only_active=1'
384 "header_filter": true,
386 "basket.basket_group",
387 "biblio.active_orders+count",
388 "biblio.holds+count",
389 "biblio.items+count",
390 "biblio.suggestions.suggester",
392 "current_item_level_holds+count",
395 "stateSave": true, // remember state on page reload
396 "drawCallback": function (settings) {
397 $(".previewData").on("click", function(e){
399 var ltitle = $(this).text();
400 var page = $(this).attr("href");
401 $("#dataPreviewLabel").text(ltitle);
402 $("#dataPreview .modal-body").load(page + " div");
403 $('#dataPreview').modal({show:true});
407 { "data": "basket.name",
410 "render": function(data, type, row, meta) {
411 if (type != 'display') return escape_str(data);
412 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>";
415 { "data": "basket.basket_group.name",
417 "render": function(data, type, row, meta) {
418 if ( type != 'display' ) {
419 return escape_str(data);
421 if ( row.basket.basket_group_id == null ) {
422 return _("No basket group");
425 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
426 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
427 + encodeURIComponent(row.basket.basket_group_id) + "\">"
428 + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>";
434 "render": function(data, type, row, meta) {
435 if (type != 'display') return escape_str(data);
436 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>";
440 [% SET summary_fields = "biblio.author:biblio.title:biblio.isbn:biblio.publisher:me.internal_note:me.vendor_note" %]
441 [% IF Koha.Preference('marcflavour')=='UNIMARC' %][% SET summary_fields = summary_fields _ ":biblio.ean" %][% END %]
442 "data": "[% summary_fields | html %]",
443 "render": function(data, type, row, meta) {
445 if ( row && row.biblio_id != null ) {
446 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>";
447 if ( row.biblio.author != null )
448 result += _(" by ") + escape_str(row.biblio.author);
449 if ( row.biblio.isbn != null )
450 result += " – " + escape_str(row.biblio.isbn);
451 [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
452 if ( row.biblio.ean != null )
453 result += " – EAN:" + escape_str(row.biblio.ean);
455 if ( row.biblio.publisher != null ) {
456 result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher);
457 if ( row.biblio.publication_year != null ) {
458 result += ", " + escape_str(row.biblio.publication_year);
460 else if ( row.biblio.copyright_date != null ) {
461 result += escape_str(row.biblio.copyright_date);
464 var suggestions = row.biblio.suggestions;
465 if ( suggestions != null && suggestions.length > 0 ) {
466 var suggestion = suggestions[0];
467 if ( suggestion.suggester != null ) {
468 var suggester = suggestion.suggester;
469 var suggested_by = [];
470 if ( suggester.surname != null ) {
471 suggested_by.push(escape_str(suggester.surname));
473 if ( suggester.firstname != null ) {
474 suggested_by.push(escape_str(suggester.firstname));
477 result += "<br/>" + _("Suggested by: ") +
478 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
479 + encodeURIComponent(suggestion.suggestionid)
481 + suggested_by.join(", ")
482 + " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
488 var internal_note = row.internal_note;
489 if ( internal_note != null && internal_note != '' ) {
490 result += '<p class="ordernote"><strong>'
491 + _("Internal note: ")
492 + '</strong>' + escape_str(internal_note)
493 + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
494 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
495 + '&type=internal">' + _("Change internal note") + '</a>]</p>';
498 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
499 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
500 + '&type=internal">' + _("Add internal note") + '</a>]';
503 var vendor_note = row.vendor_note;
504 if ( vendor_note != null && vendor_note != '' ) {
505 result += '<p class="ordernote"><strong>'
507 + '</strong>' + escape_str(vendor_note) + '</p>';
510 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
511 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
512 + '&type=vendor">' + _("Add vendor note") + '</a>]';
521 "render": function(data, type, row, meta) {
522 var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a><br>'
523 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a><br>'
524 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a>';
531 "data": "replacement_price",
532 "render": function(data, type, row, meta) {
533 return escape_price(row.replacement_price);
542 "render": function(data, type, row, meta) {
543 return escape_price(row.ecost);
548 "render": function(data, type, row, meta) {
549 return escape_price(row.quantity * row.ecost);
551 "orderable": false, // FIXME: How can we do it in DBIC?
556 "render": function(data, type, row, meta) {
557 if (type != 'display') return escape_str(data);
558 return escape_str(row.fund.name);
563 "render": function(data, type, row, meta) {
564 return '<a href="orderreceive.pl?ordernumber='
565 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
566 + _("Receive") + '</a><br/>'
567 + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
568 + _("Transfer") + '</a>';
575 "render": function(data, type, row, meta) {
578 if ( row.current_holds_count > 0 ) {
579 result += '<span class="button" title="'
580 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">'
581 + _("Can't cancel order") + '</span><br/>';
584 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
585 + encodeURIComponent(row.order_id)
586 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
587 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
588 + _("Cancel order") + '</a><br/>';
591 if ( row.biblio != null ) {
592 if ( row.biblio.items_count - row.items.length > 0 ||
593 row.biblio.active_orders_count > 1 ||
594 row.biblio.subscriptions_count > 0 ||
595 row.biblio.holds_count > 0 ) { // biblio can be deleted
596 result += '<span class="button" title="'
597 + _("Can't delete catalog record, see constraints below") + '">'
598 + _("Can't cancel order and delete catalog record") + '</span><br>';
601 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
602 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
603 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
604 + _("Cancel order and catalog record") + '</a><br/>';
607 if ( row.biblio.items_count - row.items.length > 0 ) {
608 result += '<strong title="'
609 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
610 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
613 if ( row.biblio.active_orders_count > 1 ) {
614 result += '<strong title="'
615 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
616 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
619 if ( row.biblio.subscriptions_count > 0 ) {
620 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
621 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
625 if ( row.biblio.holds_count > 0 ) {
626 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
627 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
637 }, {}, 1, {"basket.vendor_id": [% booksellerid | html %]});
639 $(".previewData").on("click", function(e){
641 var ltitle = $(this).text();
642 var page = $(this).attr("href");
643 $("#dataPreviewLabel").text(ltitle);
644 $("#dataPreview .modal-body").load(page + " div");
645 $('#dataPreview').modal({show:true});
648 $("#dataPreview").on("hidden.bs.modal", function(){
649 $("#dataPreviewLabel").html("");
650 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
654 // Case-insensitive version of jquery's contains function
655 jQuery.extend(jQuery.expr[':'], {
656 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
659 // Contains exactly function
660 jQuery.extend(jQuery.expr[':'], {
661 containsExactly: "$(a).text() == m[3]"
664 function transfer_order_popup(ordernumber) {
665 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
666 + "ordernumber=" + ordernumber
667 window.open(url, 'TransferOrder');
672 [% INCLUDE 'intranet-bottom.inc' %]