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