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