Bug 25867: Label "Current location" as "Current library" and "Permanent location...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / orderreceive.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Branches %]
5 [% USE AuthorisedValues %]
6 [% USE Price %]
7 [% SET footerjs = 1 %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha &rsaquo; Acquisitions &rsaquo; Receipt summary for : [% name | html %] [% IF ( invoice ) %]invoice, [% invoice | html %][% END %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
11 </head>
12
13 <body id="acq_orderreceive" class="acq">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
16
17 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> &rsaquo; <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% name | html %]</a> &rsaquo; Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]][% END %] (order #[% ordernumber | html %])</div>
18
19 <div class="main container-fluid">
20     <div class="row">
21         <div class="col-sm-10 col-sm-push-2">
22             <main>
23
24 <h1>Receive items from : [% name | html %] [% IF ( invoice ) %][[% invoice | html %]] [% END %] (order #[% ordernumber | html %])</h1>
25
26 [% IF ( count ) %]
27     <form action="/cgi-bin/koha/acqui/finishreceive.pl" class="noEnterSubmit" method="post" onsubmit="return Check(this);">
28 <div class="row">
29 <div class="col-sm-6">
30     <div class="dialog alert order_error" style="display:none"></div>
31
32     <fieldset class="rows">
33     <legend>Catalog details</legend>
34     <ol><li><span class="label">Title: </span><span class="title">[% title | html %]</span></li>
35     <li> <span class="label">Author: </span>
36         [% author | html %]</li>
37     <li><span class="label">Copyright: </span>
38         [% copyrightdate | html %]</li>
39     <li> <span class="label">ISBN: </span>
40         [% isbn | html %]</li>
41     <li> <span class="label">Series: </span>
42         [% seriestitle | html %]</li>
43     </ol>
44         </fieldset>
45
46     [% IF suggestion %]
47         <fieldset class="rows">
48         <legend>Suggestion</legend>
49         <ol>
50           <li>
51             <span class="label">Suggested by: </span>
52             [% suggestion.surnamesuggestedby | html %][% IF suggestion.firstnamesuggestedby %], [% suggestion.firstnamesuggestedby | html %][% END %] (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% suggestion.suggestionid | uri %]&amp;op=show">suggestion #[% suggestion.suggestionid | html %]</a>)
53             [% IF suggestion.reason %]
54                 <li>
55                     <span class="label">Reason:</span>
56                     [% SET suggestion_reasons = AuthorisedValues.GetAuthValueDropbox( 'SUGGEST' ) %]
57                     [% SET other_reason = 1 %]
58                     <select class="select-reason" id="reason" name="reason">
59                         <option value=""> -- Choose a reason -- </option>
60                         [% FOREACH reason IN suggestion_reasons %]
61                             [% IF reason.lib == suggestion.reason %]
62                                 <option value="[% reason.lib | html %]" selected="selected">[% reason.lib | html %]</option>
63                                 [% SET other_reason = 0 %]
64                             [% ELSE %]
65                                 <option value="[% reason.lib | html %]">[% reason.lib | html %]</option>
66                             [% END %]
67                         [% END %]
68                         <option value="other">Others...</option>
69                     </select>
70
71                     <span id="other_reason" name="other_reason">
72                         [% IF other_reason %]
73                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." value="[% suggestion.reason | html %]"/>
74                         [% ELSE %]
75                             <input type="text" size="31" id="select-other_reason" name="other_reason" placeholder="please note your reason here..." />
76                         [% END %]
77                         <a href="#back">Cancel</a>
78                     </span>
79
80                     <input type="hidden" name="suggestionid" value="[% suggestion.suggestionid | html %]" />
81                 </li>
82             [% END %]
83           </li>
84         </ol>
85         </fieldset>
86     [% END %]
87
88     [% IF subscriptionid and orders.count %]
89         <fieldset class="rows">
90             <legend>Receipt history for this subscription</legend>
91             <table id="orders">
92                 <thead>
93                     <tr>
94                         <th>Invoice</th>
95                         <th>Order number</th>
96                         <th class="title-string">Creation date</th>
97                         <th class="title-string">Receive date</th>
98                         <th>Quantity received</th>
99                         <th class="title-string">Status</th>
100                         <th title="Actual cost tax exc. / Actual cost tax inc.">Spent</th>
101                         <th>Internal note</th>
102                     </tr>
103                 </thead>
104                 <tbody>
105                 [% FOR order IN orders %]
106                     <tr>
107                         <td>
108                         [% IF order.invoice %]
109                             [% IF CAN_user_acquisition %]
110                                 <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% order.invoiceid | uri %]" title="Invoice detail page">
111                                    [% order.invoice.invoicenumber | html %]</a>
112                             [% ELSE %]
113                                 [% order.invoice.invoicenumber | html %]
114                             [% END %]
115                         [% END %]
116                         </td>
117                         <td>[% order.ordernumber | html %]</td>
118                         <td><span title="[% order.basket.creationdate | uri %]">[% order.basket.creationdate | $KohaDates%]</span></td>
119                         <td>[% IF order.datereceived %]<span title="[% order.datereceived | uri %]">[% order.datereceived | $KohaDates %]</span>[% END %]</td>
120                         <td>[% order.quantityreceived | html %]</td>
121                         <td>
122                           [% SWITCH order.orderstatus %]
123                           [%# FIXME We should only see/display Complete here, right? %]
124                             [% CASE 'new' %]<span title="status_1">New</span>
125                             [% CASE 'ordered' %]<span title="status_2">Ordered</span>
126                             [% CASE 'partial' %]<span title="status_3">Partial</span>
127                             [% CASE 'complete' %]<span title="status_4">Complete</span>
128                             [% CASE 'cancelled' %]<span title="status_5">Cancelled</span>
129                           [% END %]
130                         </td>
131                         <td>
132                             [% IF order.datereceived %][%# FIXME Should only be true, right? %]
133                                 [%# FIXME What if unitprice has not been filled? %]
134                                 [% order.unitprice_tax_excluded * order.quantity | $Price %] / [% order.unitprice_tax_included * order.quantity | $Price %]
135                             [% END %]
136                         </td>
137                         <td>[% order.order_internalnote | html %]</td>
138                     </tr>
139                 [% END %]
140                 </tbody>
141             </table>
142         </fieldset>
143     [% ELSIF (AcqCreateItemReceiving) %]
144         <div id="items_list" style="display:none">
145             <p><b>Items list</b></p>
146             <div style="width:100%;overflow:auto;">
147                 <table>
148                     <thead>
149                         <tr>
150                             <th>Actions</th>
151                             <th>Barcode</th>
152                             <th>Home library</th>
153                             <th>Holding library</th>
154                             <th>Not for loan</th>
155                             <th>Restricted</th>
156                             <th>Location</th>
157                             <th>Call number</th>
158                             <th>Copy number</th>
159                             <th>Inventory number</th>
160                             <th>Collection</th>
161                             <th>Item type</th>
162                             <th>Materials</th>
163                             <th>Notes</th>
164                         </tr>
165                     </thead>
166                     <tbody>
167                     </tbody>
168                 </table>
169             </div>
170         </div>
171
172         [% UNLESS subscriptionid %]
173           <fieldset class="rows" id="itemfieldset">
174               <legend>Item</legend>
175               [% IF ( NoACQframework ) %]
176                   <p class="required">
177                       No ACQ framework, using default. You should create a
178                       framework with code ACQ, the items framework would be
179                       used
180                   </p>
181               [% END %]
182               <div id="outeritemblock"></div>
183           </fieldset>
184         [% END %]
185     [% ELSIF (AcqCreateItem == 'ordering') %]
186         [% IF (items.size) %]
187             <h5>Items</h5>
188             <div style="width:100%;overflow:auto">
189                 <table>
190                     <thead>
191                         <tr>
192                             <th>Receive?</th>
193                             <th>&nbsp;</th>
194                             <th>Barcode</th>
195                             <th>Home library</th>
196                             <th>Current library</th>
197                             <th>Not for loan</th>
198                             <th>Restricted</th>
199                             <th>Location</th>
200                             <th>Call number</th>
201                             <th>Copy number</th>
202                             <th>Inventory number</th>
203                             <th>Collection</th>
204                             <th>Item type</th>
205                             <th>Materials</th>
206                             <th>Notes</th>
207                         </tr>
208                     </thead>
209                     <tbody>
210                         [% FOREACH item IN items %]
211                             <tr id="item_[% item.itemnumber | html %]">
212                                 <td style="text-align:center"><input type="checkbox" name="items_to_receive" value="[% item.itemnumber | html %]" /></td>
213                                 <td><a style="cursor:pointer" onclick="PopupEditPage([% item.biblionumber | html %],[% item.itemnumber | html %]);">Edit</a></td>
214                                 <td>[% item.barcode | html %]</td>
215                                 <td>[% Branches.GetName( item.homebranch ) | html %]</td>
216                                 <td>[% Branches.GetName( item.holdingbranch ) | html %]</td>
217                                 <td>[% item.notforloan | html %]</td>
218                                 <td>[% item.restricted | html %]</td>
219                                 <td><span class="shelvingloc">[% item.location | html %]</span></td>
220                                 <td>[% item.itemcallnumber | html %]</td>
221                                 <td>[% item.copynumber | html %]</td>
222                                 <td>[% item.stocknumber | html %]</td>
223                                 <td>[% item.collection | html %]</td>
224                                 <td>[% item.itemtype | html %]</td>
225                                 <td>[% item.materials | html %]</td>
226                                 <td>[% item.itemnotes | html %]</td>
227                             </tr>
228                         [% END %]
229                     </tbody>
230                 </table>
231             </div>
232         [% END %]
233     [% END %]
234     <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
235     <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
236     <input type="hidden" name="ordernumber" value="[% ordernumber | html %]" />
237     <input type="hidden" name="booksellerid" value="[% booksellerid | html %]" />
238         </div>
239     <div class="col-sm-6">
240     <fieldset class="rows">
241     <legend>Accounting details</legend>
242         <ol>
243             <li>
244                 <label for="datereceived">Date received: </label>
245                 <input type="text" size="10" id="datereceived" name="datereceived" value="[% datereceived | $KohaDates %]" class="datepicker" />
246             </li>
247        <li><label for="bookfund">Fund: </label><select id="bookfund" name="bookfund">
248             <option value="">Keep current ([% budget_period_description | html %] - [% bookfund | html %])</option>
249             [% FOREACH period IN budget_loop %]
250                 <optgroup label="[% period.description | html %]">
251                 [% FOREACH fund IN period.funds %]
252                     [% IF ( fund.b_sel ) %]
253                         <option value="[% fund.b_id | html %]" selected="selected">[% fund.b_txt | html %]</option>
254                     [% ELSE %]
255                         <option value="[% fund.b_id | html %]">[% fund.b_txt | html %]</option>
256                     [% END %]
257                 [% END %]
258                 </optgroup>
259             [% END %]
260        </select></li>
261        <li><label>&nbsp;</label><span>(Current: [% budget_period_description | html %] - [% bookfund | html %])</span></li>
262        <li>
263         <label for="creator">Ordered by: </label>
264         <span>
265             [% INCLUDE 'patron-title.inc' patron = creator %]
266         </span>
267        </li>
268        <li><label for="quantity_to_receive">Quantity ordered: </label><span class="label">
269            [% IF edit or subscriptionid %]
270                <input type="text" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
271            [% ELSE%]
272                <input type="text" readonly="readonly" id="quantity_to_receive" name="quantity" value="[% quantity | html %]" />
273            [% END %]
274            </span></li>
275         <li><label for="quantity">Quantity received: </label>
276           [% IF subscriptionid %]
277               <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantity | html %]" />
278               <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
279           [% ELSIF AcqCreateItemReceiving %]
280               <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="0" />
281           [% ELSE %]
282             [% IF ( quantityreceived ) %]
283                 [% IF ( edit ) %]
284                     <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceived | html %]" />
285                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
286                 [% ELSE %]
287                     [% IF ( items ) %]
288                         <input readonly="readonly" type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
289                     [% ELSE %]
290                         <input type="text" size="20" name="quantityrec" id="quantity" value="[% quantityreceivedplus1 | html %]" />
291                     [% END %]
292                     <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="[% quantityreceived | html %]" />
293                 [% END %]
294             [% ELSE %]
295                 <input type="text" id="quantity" size="20" name="quantityrec" value="1" />
296                 <input id="origquantityrec" readonly="readonly" type="hidden" name="origquantityrec" value="0" />
297             [% END %]
298             <div id="qtyrecerror" style="display:none">
299                 <p class="error">Warning, you have entered more items than expected.
300                 Items will not be created.</p>
301             </div>
302           [% END %][%# IF (subscriptionid) ELSIF (AcqCreateItemReceiving) %]
303                 </li>
304
305         [% IF ( gst_values ) %]
306             <li>
307                 <label for="tax_rate">Tax rate: </label>
308                 <select name="tax_rate" id="tax_rate">
309                 [% FOREACH gst IN gst_values %]
310                     [% IF gst.option == tax_rate %]
311                         <option value="[% gst.option | html %]" selected="selected">[% gst.option * 100 | html %]%</option>
312                     [% ELSE %]
313                         <option value="[% gst.option | html %]">[% gst.option * 100 | html %]%</option>
314                     [% END %]
315                 [% END %]
316                 </select>
317             </li>
318         [% ELSE %]
319             <input type="hidden" name="tax_rate" value="0" />
320         [% END %]
321
322         <li><label for="rrp">Retail price: </label>[% rrp | $Price %] <span class="hint">(adjusted for [% active_currency.currency | html %], [% IF (invoiceincgst == 1) %]tax inclusive[% ELSE %]tax exclusive[% END %])</span></li>
323         <li>
324             <label for="replacementprice">Replacement price:</label>
325             <input type="text" size="20" name="replacementprice" id="replacementprice" value="[% replacementprice | $Price on_editing => 1 %]" />
326         </li>
327         <li><label for="ecost">Budgeted cost: </label>[% ecost | $Price %] <span class="hint">[% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]</span></li>
328         <li>
329             <label for="unitprice">Actual cost:</label>
330             <input type="text" size="20" name="unitprice" id="unitprice" value="[% unitprice | $Price on_editing => 1 %]" />
331             <span class="hint">[% IF (invoiceincgst == 1) %](tax inclusive)[% ELSE %](tax exclusive)[% END %]</span>
332             <label style="font-weight: inherit; float:none;"><input type="checkbox" name="change_currency">Change currency</label>
333         </li>
334         <li id="select_currency">
335             <label for="unitprice_currency"></label>
336             <input type="text" size="20" name="unitprice" id="unitprice_currency" value="" />
337             [% IF currencies.count %]
338                 <select name="currency">
339                     <option value="[% active_currency.rate | html %]" selected="selected">[% active_currency.currency | html %] ([% active_currency.symbol | html %])</option>
340                     [% FOR currency IN currencies %]
341                         <option value="[% currency.rate | html %]">[% currency.currency | html %] ([% currency.symbol | html %])</option>
342                     [% END %]
343                 </select>
344             [% END %]
345         </li>
346         <li><label for="order_internalnote">Internal note: </label><textarea name="order_internalnote" width="40" rows="8" >[% order_internalnote | html %]</textarea></li>
347         [% IF order_vendornote %]
348             <li><label for="order_vendornote">Vendor note: </label><span>[% order_vendornote | html %]</span></li>
349         [% END %]
350         </ol>
351     </fieldset>
352
353 </div>
354 </div><div class="row"><fieldset class="action">
355         <input type="submit"  value="Save" class="button" accesskey="w" />
356         <a class="cancel" href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]&sticky_filters=1">Cancel</a>
357 </fieldset></div>    </form>
358 [% ELSE %]
359     This ordernumber does not exist.
360 [% END %]
361
362 </main>
363 </div> <!-- /.col-sm-10.col-sm-push-2 -->
364
365 <div class="col-sm-2 col-sm-pull-10">
366     <aside>
367         [% INCLUDE 'acquisitions-menu.inc' %]
368     </aside>
369 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
370 </div> <!-- /.row -->
371 [% MACRO jsinclude BLOCK %]
372     [% Asset.js("js/acquisitions-menu.js") | $raw %]
373 [% INCLUDE 'calendar.inc' %]
374     [% INCLUDE 'additem.js.inc' %]
375     [% Asset.js("js/additem.js") | $raw %]
376     [% Asset.js("js/cataloging.js") | $raw %]
377     <script>
378         function Check(form) {
379             [% IF (AcqCreateItemReceiving) %]
380                 var total_errors = CheckMandatorySubfields(form);
381                 if (total_errors != 0) {
382                     var alertString = _("Form not submitted because of the following problem(s)");
383                     alertString += "\n------------------------------------------------------------------------------------\n";
384                     alertString += "\n- " + _("%s mandatory fields empty (highlighted)").format(total_errors);
385                     alert(alertString);
386                     return false;
387                 }
388
389                 if(check_additem('[% UniqueItemFields | html %]') == false){
390                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
391                     return false;
392                 };
393
394                 // Remove last itemblock if it is not in items_list
395                 var lastitemblock = $("#outeritemblock > div:last");
396                 var tobedeleted = true;
397                 var listitems = $("#items_list tr");
398                 $(listitems).each(function(){
399                     if($(this).attr('idblock') == $(lastitemblock).attr('id')){
400                         tobedeleted = false;
401                     }
402                 });
403                 if(tobedeleted){
404                     $(lastitemblock).remove();
405                 }
406
407                 if(check_additem('[% UniqueItemFields | html %]') == false){
408                     alert(_("Duplicate values detected. Please correct the errors and resubmit.") );
409                     if(tobedeleted) {
410                         $(lastitemblock).appendTo("#outeritemblock");
411                     }
412                     return false;
413                 };
414             [% END %]
415
416             return true;
417         }
418
419         [% IF (AcqCreateItem == 'ordering') %]
420             var items_columns = [null, null, 'barcode', 'homebranchname',
421                 'holdingbranchname', 'notforloan', 'restricted', 'location',
422                 'itemcallnumber', 'copynumber', 'stocknumber', 'collection',
423                 'itemtype', 'materials', 'itemnotes'];
424
425             function PopupEditPage(biblionumber, itemnumber) {
426                 var url = "/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber="
427                     + biblionumber + "&itemnumber=" + itemnumber + "&popup=1#edititem";
428                 var w = window.open(url);
429                 var watchClose = setInterval(function() {
430                     if (w.closed) {
431                         clearTimeout(watchClose);
432                         $.getJSON('/cgi-bin/koha/catalogue/getitem-ajax.pl',
433                             {
434                                 'itemnumber': itemnumber
435                             },
436                             function(item) {
437                                 var tds = $("#item_"+itemnumber+" td");
438                                 for(var i=2; i<tds.length; i++) {
439                                     var column = items_columns[i];
440                                     var text = item[column];
441                                     if ( text == null ) text = '';
442                                     $(tds[i]).text(text);
443                                 }
444                             }
445                         );
446                     }
447                 }, 500);
448             }
449
450             function CalcQtyToReceive() {
451                 var qty = $("input[name='items_to_receive']:checked").length;
452                 $("#quantity").val(qty);
453             }
454
455             function CheckNItems(n) {
456                 $("input[name='items_to_receive']").each(function() {
457                     $(this).prop('checked', false);
458                 });
459                 $("input[name='items_to_receive']:lt("+n+")").each(function () {
460                     $(this).prop('checked', true);
461                 });
462             }
463         [% END %]
464
465         $(document).ready(function() {
466             [% IF (AcqCreateItemReceiving) %]
467                 cloneItemBlock(0, '[% UniqueItemFields | html %]');
468             [% ELSIF (AcqCreateItem == 'ordering') && not subscriptionid %]
469                 $("input[name='items_to_receive']").change(function() {
470                     CalcQtyToReceive();
471                 });
472                 CalcQtyToReceive();
473                 $("#quantity").keyup(function() {
474                     var qty = parseInt($("#quantity").val());
475                     var qtyto = parseInt($("#quantity_to_receive").val());
476                     if(qty > qtyto) {
477                         $("#qtyrecerror").show();
478                     } else {
479                         $("#qtyrecerror").hide();
480                     }
481                     CheckNItems($(this).val());
482                 });
483             [% END %]
484
485             $("input[name='change_currency']").on("change", function(){
486                 if ( $(this).is(":checked") ) {
487                     $("#select_currency").show();
488                     $("#unitprice").prop("readonly", "true");
489                 } else {
490                     $("#select_currency").hide();
491                     $("#unitprice").prop("readonly", "");
492                 }
493             }).change();
494
495             function update_unitprice() {
496                 var rate = Number($("select[name='currency'] option:selected").val());
497                 var unitprice = $("#unitprice_currency").val();
498                 var new_unitprice = Number( unitprice * rate ).toFixed(2);
499                 $("#unitprice").val(new_unitprice);
500             }
501             $("select[name='currency']").on("change", function(){update_unitprice()} );
502             $("#unitprice_currency").on("change", function(){update_unitprice()} );
503
504             [% IF other_reason %]
505                 $(".select-reason").hide();
506                 $(".select-reason").find("option[value='other']").attr("selected","selected");
507                 $("#other_reason").show();
508             [% ELSE %]
509                 $("#other_reason").hide();
510             [% END %]
511             $(".select-reason").change(function(){
512                 if($(this).val() == "other"){
513                     $(this).hide();
514                     $("#other_reason").show();
515                 }
516             });
517             $("a[href*=back]").click(function(){
518                 $(".select-reason").show().find("option[value='']").attr("selected","selected");
519                 $("#other_reason").hide();
520             });
521
522         });
523     </script>
524 [% END %]
525
526 [% INCLUDE 'intranet-bottom.inc' %]