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