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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
29 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
32 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
34 [% IF invoiceclosedate %]
36 Receipt summary for <em>[% name | html %]</em>
38 <em>[ [% invoice | html %] ]</em>
43 <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% name | html %]</a>
46 Receive orders from [% name | html %]
54 <div class="main container-fluid">
56 <div class="col-sm-10 col-sm-push-2">
59 [% IF ( receive_error ) %]
60 <div class="dialog alert">
61 <h3>Error adding items:</h3>
63 [% FOREACH error_loo IN error_loop %]
64 <li>[% error_loo.error_param | html %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate barcode[% END %] <!-- todo: other error conditions come here. --></li>
70 [% IF ( invoiceclosedate ) %]
71 <span>Receipt summary for <em>[% name | html %]</em></span> [% IF ( invoice ) %] <em> [ [% invoice | html %] ] </em>[% END %]
73 <span>Receive orders from [% name | html %]</span>
77 [% IF ( success_delorder ) %]
78 <div class="dialog message">The order has been successfully canceled.</div>
80 [% IF ( error_delitem ) %]
81 <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
83 [% IF ( error_delbiblio ) %]
84 <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
88 [% IF (error_cancelling_receipt) %]
89 <div class="dialog alert">
90 <span>Cannot cancel receipt. Possible reasons:</span>
93 The order line you are trying to cancel was created from a partial receipt
94 of another order line which is already received. Try to cancel this
98 The order line you are trying to cancel was created from a partial receipt
99 of another order line which has been deleted. Cancellation is not
106 [% IF error_invoice_not_known %]
107 <div class="dialog alert">
108 The invoice referenced by this invoiceid does not exist.
112 [% UNLESS no_orders_to_display %]
113 <div id="acqui_receive_summary">
114 <p><strong>Invoice number:</strong> [% invoice | html %] <strong>Shipment date:</strong> [% shipmentdate | $KohaDates %]</p>
116 [% UNLESS (invoiceclosedate) %]
117 <div id="acqui_receive_search">
118 <h3>Pending orders</h3>
119 <table id="pending_orders" class="table table-bordered table-striped">
123 <th>Basket group</th>
127 <th>Replacement price</th>
140 <span>Invoice is closed, so you can't receive orders anymore.</span>
141 [% IF CAN_user_acquisition_reopen_closed_invoices %]
142 <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>.
147 <div id="acqui_receive_receivelist">
148 <h3>Already received</h3>
150 [% IF ( loop_received ) %]
151 <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
152 <table id="receivedt">
156 <th>Basket group</th>
158 <th title="Item holds / Total holds">Holds</th>
161 <th>Replacement price</th>
171 [% FOREACH key IN subtotal_for_funds.keys.sort %]
173 [% IF invoiceincgst %]
174 <td colspan="6" class="total">(Tax inc.)</td>
176 <td colspan="6" class="total">(Tax exc.)</td>
178 <td colspan="3"><em>Subtotal for</em> [% key | html %]</td>
179 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
180 <td>[% subtotal_for_funds.$key.unitprice | $Price %]</td>
186 <th colspan="11" class="total">Total tax exc.</th>
187 <th>[% total_tax_excluded | $Price %]</th>
190 [% FOREACH book_foot IN book_foot_loop %]
192 <th colspan="11">Total (GST [% book_foot.tax_rate * 100 | html %]%)</th>
193 <th>[% book_foot.tax_value | $Price %]</th>
198 <th colspan="11" class="total">Total tax inc.</th>
199 <th>[% total_tax_included | $Price %]</th>
203 <tbody class="filterclass">
204 [% FOREACH order IN loop_received %]
206 <td><a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno | uri %]"> [% order.basketname | html %] ([% order.basketno | html %])</a></td>
208 [% IF order.basketgroupid %]
209 <a href="/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid=[% booksellerid | uri %]">[% order.basketgroupname | html %] ([% order.basketgroupid | html %])</a>
215 <a href="neworderempty.pl?ordernumber=[% order.ordernumber | uri %]&booksellerid=[% booksellerid | uri %]">[% order.ordernumber | html %]</a>
216 [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
217 (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber | uri %]&booksellerid=[% booksellerid | uri %]" title="Original order line">[% order.parent_ordernumber | html %]</a>)
221 [% IF order.total_holds > 0 %]
222 [% IF order.item_holds > 0 %]
223 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.item_holds | html %]</a></span>
228 <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber | uri %]">[% order.total_holds | html %]</a></span>
234 [% INCLUDE 'biblio-title.inc' biblio=order link = 1 %]
235 [% IF ( order.author ) %] / [% order.author | html %][% END %]
236 [% IF ( order.isbn ) %] - [% order.isbn | html %][% END %]
237 [% IF ( order.publishercode ) %]
238 <br />Publisher: [% order.publishercode | html %]
239 [%- IF ( order.publicationyear > 0) -%], [% order.publicationyear | html %]
240 [%- ELSIF ( order.copyrightdate > 0) -%] [% order.copyrightdate | html %]
243 [% IF ( order.suggestionid ) %]
245 Suggested by: [% order.surnamesuggestedby | html %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby | html %] [% END %]
246 (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid | uri %]&op=show">suggestion #[% order.suggestionid | html %]</a>)
249 [% IF ( order.order_internalnote ) %]
250 <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>
252 [<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>]
254 [% IF ( order.order_vendornote ) %]
255 <p class="ordernote"><strong>Vendor note: </strong>[% order.order_vendornote | html %]</p>
257 [<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>]
261 <a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=[% order.ordernumber | uri %]" class="previewData">[% tp('noun', 'Order') | html %]</a><br>
262 <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber | uri %]" class="previewData">MARC</a><br>
263 <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% order.biblionumber | uri %]" class="previewData">Card</a>
265 <td>[% order.replacementprice | $Price %]</td>
266 <td>[% order.quantityreceived | html %]</td>
267 <td>[% order.budget.budget_name | html %]</td>
268 <td>[% order.ecost | $Price %]</td>
269 <td>[% order.unitprice | $Price %]</td>
270 <td>[% order.total | $Price %]</td>
272 [% IF loop_receive.cannot_cancel or ( order.basket.effective_create_items == "receiving" and loop_receive.holds > 0 ) %]
273 [% IF loop_receive.cannot_cancel %]
274 [% span_title = BLOCK %]
275 <span>Cannot cancel receipt of this order line because it
276 was created from a partial receipt of order line no.
277 [% order.parent_ordernumber | html %], which is
278 already received. Try cancelling this one first and
282 [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
283 [%# Some additional checks should be added in the pl file %]
284 [% span_title = BLOCK %]
285 <span>Cannot cancel receipt of this order line because at least one hold exists on the records.</span>
288 <span title="[% span_title | collapse | html %]">
292 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]&op=cancelreceipt&ordernumber=[% order.ordernumber | uri %]">Cancel receipt</a>
301 [% ELSE %]There are no received orders.[% END %]
304 <div class="modal" id="dataPreview" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel">
305 <div class="modal-dialog modal-wide" role="document">
306 <div class="modal-content">
307 <div class="modal-header">
308 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
309 <h3 id="dataPreviewLabel">MARC previews</h3>
311 <div class="modal-body">
312 <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
314 <div class="modal-footer">
315 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
317 </div> <!-- /.modal-content -->
318 </div> <!-- /.modal-dialog -->
319 </div> <!-- /.modal -->
321 [% IF (invoiceclosedate) %]
322 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | uri %]">View invoice</a>
324 <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
325 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
326 <fieldset class="action">
327 <input type="submit" value="Finish receiving" />
335 </div> <!-- /.col-sm-10.col-sm-push-2 -->
337 <div class="col-sm-2 col-sm-pull-10">
340 [% INCLUDE 'acquisitions-menu.inc' %]
342 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
343 </div> <!-- /.row -->
345 [% MACRO jsinclude BLOCK %]
346 [% Asset.js("js/acquisitions-menu.js") | $raw %]
347 [% INCLUDE 'datatables.inc' %]
348 [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
350 dt_overwrite_html_sorting_localeCompare();
351 var columns_filter = {};
353 $(document).ready(function(){
355 if ( $("#receivedt").length ) {
356 var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
358 "iDisplayLength": 10,
359 "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
361 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
367 { "sType": "num-html" },
368 { "sType": "anti-the" },
378 "sPaginationType": "full"
382 var pending_orders_table = $("#pending_orders").kohaTable({
384 "url": '/api/v1/acquisitions/orders?only_active=1'
386 "header_filter": true,
388 "basket.basket_group",
389 "biblio.active_orders+count",
390 "biblio.holds+count",
391 "biblio.items+count",
392 "biblio.suggestions.suggester",
394 "current_item_level_holds+count",
397 "stateSave": true, // remember state on page reload
398 "drawCallback": function (settings) {
399 $(".previewData").on("click", function(e){
401 var ltitle = $(this).text();
402 var page = $(this).attr("href");
403 $("#dataPreviewLabel").text(ltitle);
404 $("#dataPreview .modal-body").load(page + " div");
405 $('#dataPreview').modal({show:true});
409 { "data": "basket.name",
412 "render": function(data, type, row, meta) {
413 if (type != 'display') return escape_str(data);
414 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>";
417 { "data": "basket.basket_group.name",
419 "render": function(data, type, row, meta) {
420 if ( type != 'display' ) {
421 return escape_str(data);
423 if ( row.basket.basket_group_id == null ) {
424 return _("No basket group");
427 return "<a href=\"/cgi-bin/koha/acqui/basketgroup.pl?op=add&booksellerid="
428 + encodeURIComponent(row.basket.vendor_id) + "&basketgroupid="
429 + encodeURIComponent(row.basket.basket_group_id) + "\">"
430 + escape_str(row.basket.basket_group.name) + " (" + escape_str(row.basket.basket_group_id) + ")</a>";
436 "render": function(data, type, row, meta) {
437 if (type != 'display') return escape_str(data);
438 return "<a href=\"neworderempty.pl?ordernumber="+encodeURIComponent(data)+"&booksellerid="+encodeURIComponent(row.basket.vendor_id)+"\">"+escape_str(data)+"</a>";
442 [% SET summary_fields = "biblio.title:biblio.author:biblio.isbn:biblio.publisher:me.internal_note:me.vendor_note" %]
443 [% IF Koha.Preference('marcflavour')=='UNIMARC' %][% SET summary_fields = summary_fields _ ":biblio.ean" %][% END %]
444 "data": "[% summary_fields | html %]",
445 "render": function(data, type, row, meta) {
447 if ( row && row.biblio_id != null ) {
448 result = "<p><a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber="+encodeURIComponent(row.biblio_id)+"\">"+escape_str(row.biblio.title)+"</a>";
449 if ( row.biblio.author != null )
450 result += _(" by ") + escape_str(row.biblio.author);
451 if ( row.biblio.isbn != null )
452 result += " – " + escape_str(row.biblio.isbn);
453 [% IF Koha.Preference('marcflavour')=='UNIMARC' %]
454 if ( row.biblio.ean != null )
455 result += " – EAN:" + escape_str(row.biblio.ean);
457 if ( row.biblio.publisher != null ) {
458 result += "<br/>" + _("Publisher: ") + escape_str(row.biblio.publisher);
459 if ( row.biblio.publication_year != null ) {
460 result += ", " + escape_str(row.biblio.publication_year);
462 else if ( row.biblio.copyright_date != null ) {
463 result += escape_str(row.biblio.copyright_date);
466 var suggestions = row.biblio.suggestions;
467 if ( suggestions != null && suggestions.length > 0 ) {
468 var suggestion = suggestions[0];
469 if ( suggestion.suggester != null ) {
470 var suggester = suggestion.suggester;
471 var suggested_by = [];
472 if ( suggester.surname != null ) {
473 suggested_by.push(escape_str(suggester.surname));
475 if ( suggester.firstname != null ) {
476 suggested_by.push(escape_str(suggester.firstname));
479 result += "<br/>" + _("Suggested by: ") +
480 '<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='
481 + encodeURIComponent(suggestion.suggestionid)
483 + suggested_by.join(", ")
484 + " (#" + escape_str(suggestions[0].suggestionid) + ")</a>"; // FIXME: could be changed if we allow matching multiple suggestions
490 var internal_note = row.internal_note;
491 if ( internal_note != null && internal_note != '' ) {
492 result += '<p class="ordernote"><strong>'
493 + _("Internal note: ")
494 + '</strong>' + escape_str(internal_note)
495 + ' [<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=internal">' + _("Change internal note") + '</a>]</p>';
500 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
501 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
502 + '&type=internal">' + _("Add internal note") + '</a>]';
505 var vendor_note = row.vendor_note;
506 if ( vendor_note != null && vendor_note != '' ) {
507 result += '<p class="ordernote"><strong>'
509 + '</strong>' + escape_str(vendor_note) + '</p>';
512 result += ' [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber='
513 + encodeURIComponent(row.order_id) + '&referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid | uri %]'
514 + '&type=vendor">' + _("Add vendor note") + '</a>]';
523 "render": function(data, type, row, meta) {
524 var result = '<div class="btn-group dropup">';
525 result += '<button id="view' + row.order_id + '" type="button" class="btn btn-default btn-xs" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">';
526 result += ' <i class="fa fa-eye" aria-hidden="true"></i> ' + _("View");
527 result += ' <span class="caret"></span> ';
528 result += '</button>';
529 result += '<ul class="dropdown-menu" aria-labelledby="view' + row.order_id + '">';
530 result += '<li><a href="/cgi-bin/koha/acqui/showorder.pl?ordernumber=' + encodeURIComponent(row.order_id) + '" class="previewData">' + _("Order") + '</a></li>';
531 result += '<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("MARC") + '</a></li>';
532 result += '<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=' + encodeURIComponent(row.biblio_id) + '" class="previewData">' + _("Card") + '</a></li>';
541 "data": "replacement_price",
542 "render": function(data, type, row, meta) {
543 return escape_price(row.replacement_price);
552 "render": function(data, type, row, meta) {
553 return escape_price(row.ecost);
558 "render": function(data, type, row, meta) {
559 return escape_price(row.quantity * row.ecost);
561 "orderable": false, // FIXME: How can we do it in DBIC?
566 "render": function(data, type, row, meta) {
567 if (type != 'display') return escape_str(data);
568 return escape_str(row.fund.name);
573 "render": function(data, type, row, meta) {
574 return '<a href="orderreceive.pl?ordernumber='
575 + encodeURIComponent(row.order_id) + '&invoiceid=[% invoiceid | uri %]' + '">'
576 + _("Receive") + '</a><br/>'
577 + '<a href="#" onclick="transfer_order_popup(' + escape_str(row.order_id) + '); return false;">'
578 + _("Transfer") + '</a>';
585 "render": function(data, type, row, meta) {
588 if ( row.current_holds_count > 0 ) {
589 result += '<span class="button" title="'
590 + _("Can't cancel order, (%s) holds are linked with this order. Cancel holds first").format( escape_str(row.holds_count) ) + '">'
591 + _("Can't cancel order") + '</span><br/>';
594 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
595 + encodeURIComponent(row.order_id)
596 + '&biblionumber=' + encodeURIComponent(row.biblio_id)
597 + '&referrer=/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">'
598 + _("Cancel order") + '</a><br/>';
601 if ( row.biblio != null ) {
602 if ( row.biblio.items_count - row.items.length > 0 ||
603 row.biblio.active_orders_count > 1 ||
604 row.biblio.subscriptions_count > 0 ||
605 row.biblio.holds_count > 0 ) { // biblio can be deleted
606 result += '<span class="button" title="'
607 + _("Can't delete catalog record, see constraints below") + '">'
608 + _("Can't cancel order and delete catalog record") + '</span><br>';
611 result += '<a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber='
612 + encodeURIComponent(row.order_id) + '&biblionumber=' + encodeURIComponent(row.biblio_id)
613 + '&del_biblio=1&referrer="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[$ invoiceid | uri ]">'
614 + _("Cancel order and catalog record") + '</a><br/>';
617 if ( row.biblio.items_count - row.items.length > 0 ) {
618 result += '<strong title="'
619 + _("Can't delete catalog record, because of %s existing item(s)").format(row.items.length)
620 +'">' + (row.biblio.items_count - row.items.length) + _(" item(s) left") + '</strong><br/>';
623 if ( row.biblio.active_orders_count > 1 ) {
624 result += '<strong title="'
625 + _("Can't delete catalog record, delete other orders linked to it first") + '">'
626 + (row.biblio.active_orders_count - 1) + _(" order(s) left") + '</strong><br/>';
629 if ( row.biblio.subscriptions_count > 0 ) {
630 result += '<strong title="' + _("Can't delete catalog record, delete subscriptions first") + '">'
631 + _("%s subscription(s) left").format(row.biblio.subscriptions_count)
635 if ( row.biblio.holds_count > 0 ) {
636 result += '<strong title="' + _("Can't delete catalog record or order, cancel holds first") + '">'
637 + _("%s hold(s) left").format(row.biblio.holds_count) + '</strong>';
647 }, null, 1, {"basket.vendor_id": [% booksellerid | html %]});
649 $(".previewData").on("click", function(e){
651 var ltitle = $(this).text();
652 var page = $(this).attr("href");
653 $("#dataPreviewLabel").text(ltitle);
654 $("#dataPreview .modal-body").load(page + " div");
655 $('#dataPreview').modal("show");
658 $("#dataPreview").on("hidden.bs.modal", function(){
659 $("#dataPreviewLabel").html("");
660 $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
664 // Case-insensitive version of jquery's contains function
665 jQuery.extend(jQuery.expr[':'], {
666 icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
669 // Contains exactly function
670 jQuery.extend(jQuery.expr[':'], {
671 containsExactly: "$(a).text() == m[3]"
674 function transfer_order_popup(ordernumber) {
675 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
676 + "ordernumber=" + ordernumber
677 window.open(url, 'TransferOrder');
682 [% INCLUDE 'intranet-bottom.inc' %]