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 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a> › 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 <style>#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }</style>
333 dt_overwrite_html_sorting_localeCompare();
334 var columns_filter = {};
336 $(document).ready(function(){
338 if ( $("#receivedt").length ) {
339 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
341 "iDisplayLength": 10,
342 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
344 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
350 { "sType": "num-html" },
351 { "sType": "anti-the" },
361 "sPaginationType": "full"
365 var pending_orders_table = $("#pending_orders").api({
367 "url": '/api/v1/acquisitions/orders?only_active=1'
369 "header_filter": true,
371 "basket.basket_group",
372 "biblio.active_orders+count",
373 "biblio.holds+count",
374 "biblio.items+count",
375 "biblio.suggestions.suggester",
377 "current_item_level_holds+count",
380 "stateSave": true, // remember state on page reload
381 "drawCallback": function (settings) {
382 $(".previewData").on("click", function(e){
384 var ltitle = $(this).text();
385 var page = $(this).attr("href");
386 $("#dataPreviewLabel").text(ltitle);
387 $("#dataPreview .modal-body").load(page + " div");
388 $('#dataPreview').modal({show:true});
392 { "data": "basket.name",
395 "render": function(data, type, row, meta) {
396 if (type != 'display') return escape_str(data);
397 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>";
400 { "data": "basket.basket_group.name",
402 "render": function(data, type, row, meta) {
403 if ( type != 'display' ) {
404 return escape_str(data);
406 if ( row.basket.basket_group_id == null ) {
407 return _("No basket group");
410 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
411 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
412 + encodeURIComponent(row.basket.basket_group_id) + "\">"
413 + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>";
419 "render": function(data, type, row, meta) {
420 if (type != 'display') return escape_str(data);
421 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>";
425 [% SET summary_fields = "biblio.author:biblio.title:biblio.isbn:biblio.publisher:me.internal_note:me.vendor_note" %]
426 [% IF Koha.Preference('marcflavour')=='UNIMARC' %][% SET summary_fields = summary_fields _ ":biblio.ean" %][% END %]
427 "data": "[% summary_fields | html %]",
428 "render": function(data, type, row, meta) {
430 if ( row && row.biblio_id != null ) {
431 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>";
432 if ( row.biblio.author != null )
433 result += _(" by ") + escape_str(row.biblio.author);
434 if ( row.biblio.isbn != null )
435 result += " – " + escape_str(row.biblio.isbn);
436 [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
437 if ( row.biblio.ean != null )
438 result += " – EAN:" + escape_str(row.biblio.ean);
440 if ( row.biblio.publisher != null ) {
441 result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher);
442 if ( row.biblio.publication_year != null ) {
443 result += ", " + escape_str(row.biblio.publication_year);
445 else if ( row.biblio.copyright_date != null ) {
446 result += escape_str(row.biblio.copyright_date);
449 var suggestions = row.biblio.suggestions;
450 if ( suggestions != null && suggestions.length > 0 ) {
451 var suggestion = suggestions[0];
452 if ( suggestion.suggester != null ) {
453 var suggester = suggestion.suggester;
454 var suggested_by = [];
455 if ( suggester.surname != null ) {
456 suggested_by.push(escape_str(suggester.surname));
458 if ( suggester.firstname != null ) {
459 suggested_by.push(escape_str(suggester.firstname));
462 result += "<br/>" + _("Suggested by: ") +
463 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
464 + encodeURIComponent(suggestion.suggestionid)
466 + suggested_by.join(", ")
467 + " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
473 var internal_note = row.internal_note;
474 if ( internal_note != null && internal_note != '' ) {
475 result += '<p class="ordernote"><strong>'
476 + _("Internal note: ")
477 + '</strong>' + escape_str(internal_note)
478 + ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
479 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
480 + '&type=internal">' + _("Change internal note") + '</a>]</p>';
483 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
484 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
485 + '&type=internal">' + _("Add internal note") + '</a>]';
488 var vendor_note = row.vendor_note;
489 if ( vendor_note != null && vendor_note != '' ) {
490 result += '<p class="ordernote"><strong>'
492 + '</strong>' + escape_str(vendor_note) + '</p>';
495 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
496 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
497 + '&type=vendor">' + _("Add vendor note") + '</a>]';
506 "render": function(data, type, row, meta) {
507 var result = '<a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a><br>'
508 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a><br>'
509 + '<a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a>';
516 "data": "replacement_price",
517 "render": function(data, type, row, meta) {
518 return escape_price(row.replacement_price);
527 "render": function(data, type, row, meta) {
528 return escape_price(row.ecost);
533 "render": function(data, type, row, meta) {
534 return escape_price(row.quantity * row.ecost);
536 "orderable": false, // FIXME: How can we do it in DBIC?
541 "render": function(data, type, row, meta) {
542 if (type != 'display') return escape_str(data);
543 return escape_str(row.fund.name);
548 "render": function(data, type, row, meta) {
549 return '<a href="orderreceive.pl?ordernumber='
550 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
551 + _("Receive") + '</a><br/>'
552 + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
553 + _("Transfer") + '</a>';
560 "render": function(data, type, row, meta) {
563 if ( row.current_holds_count > 0 ) {
564 result += '<span class="button" title="'
565 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">'
566 + _("Can't cancel order") + '</span><br/>';
569 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
570 + encodeURIComponent(row.order_id)
571 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
572 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
573 + _("Cancel order") + '</a><br/>';
576 if ( row.biblio != null ) {
577 if ( row.biblio.items_count - row.items.length > 0 ||
578 row.biblio.active_orders_count > 1 ||
579 row.biblio.subscriptions_count > 0 ||
580 row.biblio.holds_count > 0 ) { // biblio can be deleted
581 result += '<span class="button" title="'
582 + _("Can't delete catalog record, see constraints below") + '">'
583 + _("Can't cancel order and delete catalog record") + '</span><br>';
586 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
587 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
588 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
589 + _("Cancel order and catalog record") + '</a><br/>';
592 if ( row.biblio.items_count - row.items.length > 0 ) {
593 result += '<strong title="'
594 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
595 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
598 if ( row.biblio.active_orders_count > 1 ) {
599 result += '<strong title="'
600 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
601 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
604 if ( row.biblio.subscriptions_count > 0 ) {
605 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
606 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
610 if ( row.biblio.holds_count > 0 ) {
611 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
612 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
622 }, {}, 1, {"basket.vendor_id": [% booksellerid | html %]});
624 $(".previewData").on("click", function(e){
626 var ltitle = $(this).text();
627 var page = $(this).attr("href");
628 $("#dataPreviewLabel").text(ltitle);
629 $("#dataPreview .modal-body").load(page + " div");
630 $('#dataPreview').modal({show:true});
633 $("#dataPreview").on("hidden.bs.modal", function(){
634 $("#dataPreviewLabel").html("");
635 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
639 // Case-insensitive version of jquery's contains function
640 jQuery.extend(jQuery.expr[':'], {
641 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
644 // Contains exactly function
645 jQuery.extend(jQuery.expr[':'], {
646 containsExactly: "$(a).text() == m[3]"
649 function transfer_order_popup(ordernumber) {
650 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
651 + "ordernumber=" + ordernumber
652 window.open(url, 'TransferOrder');
657 [% INCLUDE 'intranet-bottom.inc' %]