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