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