05006375c6906c0b4d7f0dab8e4a951ad8971184
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / parcel.tt
1 [% USE Koha %]
2 [% USE KohaDates %]
3 [% USE Price %]
4 [% USE currency = format('%.2f') -%]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Acquisitions &rsaquo; [% IF ( date ) %]
7             Receipt summary for [% name %] [% IF ( invoice ) %]invoice [% invoice %][% END %] on [% datereceived | $KohaDates %][% ELSE %]Receive orders from [% name %][% END %]</title>
8 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
9 [% INCLUDE 'doc-head-close.inc' %]
10 [% INCLUDE 'datatables.inc' %]
11 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.dataTables.columnFilter.js"></script>
12 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
13 [% INCLUDE 'greybox.inc' %]
14 <script type="text/javascript">
15 //<![CDATA[
16
17     dt_overwrite_html_sorting_localeCompare();
18
19     var sticky_filters = [% sticky_filters %];
20
21     $(document).ready(function(){
22       if ( $("#pendingt").length ) {
23         var pendingt = $("#pendingt").dataTable($.extend(true, {}, dataTablesDefaults, {
24             "bStateSave": true,
25             "iCookieDuration": 60*60*24*1000, // 1000 days
26             "iDisplayLength": 10,
27             "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
28             "aoColumnDefs": [
29                 { "aTargets": [ 4, 9, 10 ], "bSortable": false, "bSearchable": false },
30             ],
31             "aoColumns": [
32                 { "sType": "html" },
33                 { "sType": "html" },
34                 { "sType": "num-html" },
35                 { "sType": "anti-the" },
36                 null,
37                 null,
38                 null,
39                 null,
40                 null,
41                 null,
42                 null,
43             ],
44             'bAutoWidth': false,
45             "sPaginationType": "four_button"
46         } )
47         ).columnFilter({
48             sPlaceHolder: "head:after",
49             aoColumns: [
50                 { type: "text" },
51                 { type: "text" },
52                 { type: "text" },
53                 { type: "text" },
54                 null,
55                 { type: "text" },
56                 { type: "text" },
57                 { type: "text" },
58                 { type: "text" },
59                 null,
60                 null
61             ]
62         });
63       }
64
65       if ( $("#receivedt").length ) {
66         var receivedt = $("#receivedt").dataTable($.extend(true, {}, dataTablesDefaults, {
67             "bStateSave": true,
68             "iCookieDuration": 60*60*24*1000, // 1000 days
69             "iDisplayLength": 10,
70             "aLengthMenu": [[5, 10, 20, 50, 100, -1], [5, 10, 20, 50, 100, _("All")]],
71             "aoColumnDefs": [
72                 { "aTargets": [ 5, -1 ], "bSortable": false, "bSearchable": false },
73             ],
74             "aoColumns": [
75                 { "sType": "html" },
76                 { "sType": "html" },
77                 { "sType": "html" },
78                 { "sType": "num-html" },
79                 { "sType": "anti-the" },
80                 null,
81                 null,
82                 null,
83                 null,
84                 null,
85                 null,
86                 null
87             ],
88             "sPaginationType": "four_button"
89         } ) );
90       }
91
92       // Keep filters from finishreceive.pl to parcel.pl
93       $.cookie("filter_parcel_summary", $("#summaryfilter").val());
94       $.cookie("filter_parcel_basketname", $("#basketfilter").val());
95       $.cookie("filter_parcel_orderno", $("#orderfilter").val());
96       $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
97       $.cookie("filter_parcel_ean", $("#eanfilter").val());
98
99       $("#filterform").on('submit', function(){
100         $.cookie("filter_parcel_summary", $("#summaryfilter").val());
101         $.cookie("filter_parcel_basketname", $("#basketfilter").val());
102         $.cookie("filter_parcel_orderno", $("#orderfilter").val());
103         $.cookie("filter_parcel_basketgroupname", $("#basketgroupnamefilter").val());
104         $.cookie("filter_parcel_ean", $("#eanfilter").val());
105       });
106
107     });
108
109      // Case-insensitive version of jquery's contains function
110      jQuery.extend(jQuery.expr[':'], {
111             icontains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0"
112      });
113
114      // Contains exactly function
115      jQuery.extend(jQuery.expr[':'], {
116           containsExactly: "$(a).text() == m[3]"
117      });
118
119 //]]>
120 </script>
121 <script type="text/javascript">
122 //<![CDATA[
123             function transfer_order_popup(ordernumber) {
124                 var url = "/cgi-bin/koha/acqui/transferorder.pl?"
125                     + "ordernumber=" + ordernumber
126                 window.open(url, 'TransferOrder');
127             }
128
129 //]]>
130 </script>
131 </head>
132 <body id="acq_parcel" class="acq">
133 [% INCLUDE 'header.inc' %]
134 [% INCLUDE 'acquisitions-search.inc' %]
135
136 <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;
137     [% IF datereceived %]
138         Receipt summary for <i>[% name %]</i>
139         [% IF ( invoice ) %]
140             <i>[ [% invoice %] ]</i>
141         [% END %]
142         on <i>[% datereceived | $KohaDates %]</i>
143     [% ELSE %]
144         Receive orders from [% name %]
145     [% END %]
146 </div>
147
148 <div id="doc3" class="yui-t2">
149
150    <div id="bd">
151         <div id="yui-main">
152         <div class="yui-b">
153         [% IF ( receive_error ) %]
154         <div class="dialog alert">
155         <h3>Error adding items:</h3>
156         <ul>
157         [% FOREACH error_loo IN error_loop %]
158                 <li>[% error_loo.error_param %][% IF ( error_loo.error_duplicate_barcode ) %]Duplicate Barcode[% END %] <!-- todo: other error conditions come here. --></li>
159         [% END %]
160         </ul>
161         </div>
162         [% END %]
163     <h1>
164         [% IF datereceived %]
165             Receipt summary for <i>[% name %]</i> [% IF ( invoice ) %] <i> [ [% invoice %] ] </i>[% END %] on <i>[% datereceived | $KohaDates %]</i>
166         [% ELSE %]
167             Receive orders from [% name %]
168         [% END %]
169     </h1>
170
171     [% IF ( success_delorder ) %]
172     <div class="dialog message">The order has been successfully canceled.</div>
173     [% ELSE %]
174         [% IF ( error_delitem ) %]
175             <div class="dialog alert">The order has been canceled, although one or more items could not have been deleted.</div>
176         [% END %]
177         [% IF ( error_delbiblio ) %]
178             <div class="dialog alert">The order has been canceled, although the record has not been deleted.</div>
179         [% END %]
180     [% END %]
181
182     [% IF (error_cancelling_receipt) %]
183       <div class="dialog error">
184       Cannot cancel receipt. Possible reasons :
185       <ul>
186         <li>
187           The order line you trying to cancel was created from a partial receipt
188           of another order line which is already received. Try to cancel this
189           one first and retry.
190         </li>
191         <li>
192           The order line you trying to cancel was created from a partial receipt
193           of another order line which has been deleted. Cancellation is not
194           possible.
195         </li>
196       </ul>
197       </div>
198     [% END %]
199
200     [% IF error_invoice_not_known %]
201         <div class="dialog error">
202             The invoice referenced by this invoiceid does not exist.
203         </div>
204     [% END %]
205
206 [% UNLESS no_orders_to_display %]
207 <div id="acqui_receive_summary">
208 <p><strong>Invoice number:</strong> [% invoice %] <strong>Received by:</strong> [% loggedinusername %] <strong>On:</strong> [% datereceived | $KohaDates %]</p>
209 </div>
210 [% UNLESS (invoiceclosedate) %]
211   <div id="acqui_receive_search">
212     <h3>Pending orders</h3>
213
214     [% IF ( loop_orders ) %]
215       <table id="pendingt">
216         <thead>
217           <tr>
218             <th>Basket search</th>
219             <th>Basket group search</th>
220             <th>Order line search</th>
221             <th>Summary search</th>
222             <th>&nbsp;</th>
223             <th>Quantity search</th>
224             <th>Unit cost search</th>
225             <th>Order cost search</th>
226             <th>Fund search</th>
227             <th>&nbsp;</th>
228             <th>&nbsp;</th>
229           </tr>
230           <tr>
231             <th>Basket</th>
232             <th>Basket group</th>
233             <th>Order line</th>
234             <th>Summary</th>
235             <th>View record</th>
236             <th>Quantity</th>
237             <th>Unit cost</th>
238             <th>Order cost</th>
239             <th>Fund</th>
240             <th>&nbsp;</th>
241             <th>&nbsp;</th>
242           </tr>
243         </thead>
244         <tbody class="filterclass">
245         [% FOREACH loop_order IN loop_orders %]
246             <tr>
247                 <td class="basketfilterclass">[% loop_order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% loop_order.basketno %]">[% loop_order.basketno %]</a>)</td>
248                 <td>
249                   [% IF loop_order.basketgroupid %]
250                     [% loop_order.basketgroupname %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% loop_order.booksellerid %]">[% loop_order.basketgroupid %]</a>)
251                   [% ELSE %]
252                     No basket group
253                   [% END %]
254                 </td>
255                 <td class="orderfilterclass"><a href="neworderempty.pl?ordernumber=[% loop_order.ordernumber %]&amp;booksellerid=[% loop_order.booksellerid %]">[% loop_order.ordernumber %]</a></td>
256                 <td class="summaryfilterclass">
257                   <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% loop_order.biblionumber %]">[% loop_order.title |html %]</a>
258                 [% IF ( loop_order.author ) %] by [% loop_order.author %][% END %]
259                 [% IF ( loop_order.isbn ) %] &ndash; [% loop_order.isbn %][% END %]
260                 [% IF ( loop_order.publishercode ) %]<br />Publisher:[% loop_order.publishercode %][% END %]
261                 [% IF ( loop_order.suggestionid ) %]
262                     <br/>
263                     Suggested by: [% loop_order.surnamesuggestedby %][% IF ( loop_order.firstnamesuggestedby ) %], [% loop_order.firstnamesuggestedby %] [% END %]
264                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% loop_order.suggestionid %]&amp;op=show">suggestion #[% loop_order.suggestionid %]</a>)
265                 [% END %]
266                 <br />
267                 [% IF ( loop_order.order_internalnote ) %]
268                     <p class="ordernote"><strong>Internal note: </strong>[% loop_order.order_internalnote|html %] [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=internal">Change internal note</a>]</p>
269                 [% ELSE %]
270                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=internal">Add internal note</a>]
271                 [% END %]
272                 [% IF ( loop_order.order_vendornote ) %]
273                     <p class="ordernote"><strong>Vendor note: </strong>[% loop_order.order_vendornote|html %]</p>
274                 [% ELSE %]
275                     [<a href="/cgi-bin/koha/acqui/modordernotes.pl?ordernumber=[% loop_order.ordernumber %]&amp;referrer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]&type=vendor">Add vendor note</a>]
276                 [% END %]
277                 </td>
278                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% loop_order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
279                 <td>[% loop_order.quantity %]</td>
280                 <td>[% loop_order.ecost | $Price %]</td>
281                 <td>[% loop_order.total | $Price %]</td>
282                 <td>[% loop_order.budget_name %]</td>
283                                 <td>
284                               <a href="orderreceive.pl?ordernumber=[% loop_order.ordernumber %]&amp;invoiceid=[% invoiceid %]">Receive</a>
285                     <br />
286                     <a href="#" onclick="transfer_order_popup([% loop_order.ordernumber %]); return false;">Transfer</a>
287                                 </td>
288                                 <td>
289                         [% IF ( loop_order.left_holds_on_order ) %]
290                         <span class="button" title="Can't cancel order, ([% loop_order.holds_on_order %]) holds are linked with this order cancel holds first">Can't cancel order</span><br>
291                         [% ELSE %]
292                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber %]&biblionumber=[% loop_order.biblionumber %]&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order</a><br />
293                         [% END %]
294                         [% IF ( loop_order.can_del_bib ) %]
295                         <a href="/cgi-bin/koha/acqui/cancelorder.pl?ordernumber=[% loop_order.ordernumber %]&biblionumber=[% loop_order.biblionumber %]&del_biblio=1&referrer=[% "/cgi-bin/koha/acqui/parcel.pl?invoiceid=$invoiceid" | uri %]">Cancel order and catalog record</a><br />
296                         [% ELSE %]
297                         <span class="button" title="Can't delete catalog record, see constraints below">Can't cancel order and delete catalog record</span><br>
298                         [% END %]
299                         [% IF ( loop_order.left_item ) %]
300                         <b title="Can't delete catalog record, because of [% loop_order.items %] existing item(s)" >[% loop_order.items %] item(s) left</b><br>
301                         [% END %]
302                         [% IF ( loop_order.left_biblio ) %]
303                         <b title="Can't delete catalog record, delete other orders linked to it first">[% loop_order.biblios %] order(s) left</b><br>
304                         [% END %]
305                         [% IF ( loop_order.left_subscription ) %]
306                         <b title="Can't delete catalog record, delete subscriptions first">[% loop_order.subscriptions %] subscription(s) left</b><br>
307                         [% END %]
308                         [% IF ( loop_order.left_holds ) %]
309                         <b title="Can't delete catalog record or order, cancel holds first">[% loop_order.holds %] hold(s) left</b>
310                         [% END %]
311                     </td>
312                 </tr>
313         [% END %]
314         </tbody>
315       </table>
316     [% ELSE %]There are no pending orders.[% END %]
317   </div>
318 [% ELSE %]
319     <p>
320         Invoice is closed, so you can't receive orders anymore.
321         <a href="/cgi-bin/koha/acqui/invoice.pl?op=reopen&invoiceid=[% invoiceid %]&referer=/cgi-bin/koha/acqui/parcel.pl%3Finvoiceid=[% invoiceid %]">Reopen it</a>.
322     </p>
323 [% END %]
324
325 <div id="acqui_receive_receivelist">
326     <h3>Already received</h3>
327
328    [% IF ( loop_received ) %]
329    <form action="/cgi-bin/koha/acqui/parcel.pl" method="get" name="orderform">
330     <table id="receivedt">
331       <thead>
332         <tr>
333           <th>Basket</th>
334           <th>Basket group</th>
335           <th>Order line</th>
336           <th>Holds</th>
337           <th>Summary</th>
338           <th>View record</th>
339           <th>Quantity</th>
340           <th>Fund</th>
341           <th>Est cost</th>
342           <th>Actual cost</th>
343           <th>TOTAL</th>
344           <th></th>
345         </tr>
346       </thead>
347     <tfoot>
348         [% FOREACH key IN subtotal_for_funds.keys.sort %]
349             <tr>
350                 [% IF invoiceincgst %]
351                     <td colspan="6" class="total">(Tax inc.)</td>
352                 [% ELSE %]
353                     <td colspan="6" class="total">(Tax exc.)</td>
354                 [% END %]
355                 <td colspan="2"><i>Subtotal for</i> [% funds.$key.budget_name %]</td>
356                 <td>[% subtotal_for_funds.$key.ecost | $Price %]</td>
357                 <td>[% subtotal_for_funds.$key.unitprice | $Price  %]</td>
358                 <td>&nbsp;</td>
359                 <td>&nbsp;</td>
360             </tr>
361         [% END %]
362         <tr>
363             <th colspan="10" class="total">Total tax exc.</th>
364             <th>[% total_gste | $Price %]</th>
365             <th></th>
366         </tr>
367         [% FOREACH book_foot IN book_foot_loop %]
368             <tr>
369                 <th colspan="10">Total (GST [% book_foot.gstrate * 100 | $Price %]%)</th>
370                 <th>[% book_foot.gstvalue | $Price %]</th>
371                 <th></th>
372             </tr>
373         [% END %]
374         <tr>
375             <th colspan="10" class="total">Total tax inc.</th>
376             <th>[% total_gsti | $Price %]</th>
377             <th></th>
378         </tr>
379     </tfoot>
380     <tbody class="filterclass">
381         [% FOREACH order IN loop_received %]
382             <tr>
383                 <td>[% order.basketname %] (<a href="/cgi-bin/koha/acqui/basket.pl?basketno=[% order.basketno %]">[% order.basketno %]</a>)</td>
384                 <td>
385                   [% IF order.basketgroupid %]
386                     [% order.basketgroupname %] (<a href="/cgi-bin/koha/acqui/basketgroup.pl?booksellerid=[% order.booksellerid %]">[% order.basketgroupid %]</a>)
387                   [% ELSE %]
388                     No basket group
389                   [% END %]
390                 </td>
391                 <td>
392                   <a href="neworderempty.pl?ordernumber=[% order.ordernumber %]&amp;booksellerid=[% booksellerid %]">[% order.ordernumber %]</a>
393                   [% IF (order.parent_ordernumber && (order.parent_ordernumber != order.ordernumber)) %]
394                     (<a href="neworderempty.pl?ordernumber=[% order.parent_ordernumber %]&amp;booksellerid=[% booksellerid %]" title="Original order line">[% order.parent_ordernumber %]</a>)
395                   [% END %]
396                 </td>
397                 <td>
398                   [% IF order.holds > 0 %]
399                     <span class="error"><a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% order.biblionumber %]">[% order.holds %]</a></span>
400                   [% ELSE %]
401                     0
402                   [% END %]
403                 </td>
404                 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title |html %]</a>
405                 [% IF ( order.author ) %] / [% order.author %][% END %]
406                 [% IF ( order.isbn ) %] - [% order.isbn %][% END %]
407                 [% IF ( order.publishercode ) %]<br />Publisher :[% order.publishercode %][% END %]
408                 [% IF ( order.suggestionid ) %]
409                     <br/>
410                     Suggested by: [% order.surnamesuggestedby %][% IF ( order.firstnamesuggestedby ) %], [% order.firstnamesuggestedby %] [% END %]
411                     (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid=[% order.suggestionid %]&amp;op=show">suggestion #[% order.suggestionid %]</a>)
412                 [% END %]
413                 </td>
414                 <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">MARC</a> | <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;id=[% order.biblionumber %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td>
415                 <td>[% order.quantityreceived %]</td>
416                 <td>[% order.budget.budget_name %]</td>
417                 <td>[% order.ecost | $Price %]</td>
418                 <td>[% order.unitprice | $Price %]</td>
419                 <td>[% order.total | $Price %]</td>
420                 <td>
421                     [% IF loop_receive.cannot_cancel or ( Koha.Preference("AcqCreateItem") == "receiving" and loop_receive.holds > 0 ) %]
422                       [% IF loop_receive.cannot_cancel %]
423                         [% span_title = BLOCK %]
424                             Cannot cancel receipt of this order line because it
425                             was created from a partial receipt of order line no.
426                             [% order.parent_ordernumber %], which is
427                             already received. Try cancelling this one first and
428                             retry.
429                         [% END %]
430                       [% ELSE %]
431                         [%# FIXME Here we block the cancellation if holds exist. Actually it could be possible if items will be exist after the deletion %]
432                         [%# Some additional checks should be added in the pl file %]
433                         [% span_title = BLOCK %]
434                           Cannot cancel receipt of this order line because at least one reservation exists on the records.
435                         [% END %]
436                       [% END %]
437                       <span title="[% span_title | collapse %]">
438                           Can't cancel receipt
439                       </span>
440                     [% ELSE %]
441                         <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]&op=cancelreceipt&ordernumber=[% order.ordernumber %]">Cancel receipt</a>
442                     [% END %]
443                 </td>
444             </tr>
445             [% END %]
446         </tbody>
447     </table>
448     </form>
449         [% ELSE %]There are no received orders.[% END %]
450 </div>
451
452 [% IF (invoiceclosedate) %]
453     <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">View invoice</a>
454 [% ELSE %]
455     <form action="/cgi-bin/koha/acqui/invoice.pl" method="get">
456         <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
457         <fieldset class="action">
458             <input type="submit" value="Finish receiving" />
459         </fieldset>
460     </form>
461 [% END %]
462
463 [% END %]
464
465 </div>
466 </div>
467
468
469 <div class="yui-b">
470 <form action="/cgi-bin/koha/acqui/parcel.pl" id="filterform" method="post">
471   <fieldset class="brief">
472     <h4>Filter</h4>
473     <ol>
474       <li>
475         <label for="summaryfilter">ISBN, author or title :</label>
476         <input type="text" name="summaryfilter" id="summaryfilter" value="[% summaryfilter %]"/>
477       </li>
478       <li>
479         <label for="basketfilter">Basket :</label>
480         <input type="text" name="basketfilter" id="basketfilter" value="[% basketfilter %]"/>
481       </li>
482       <li>
483           <label for="basketgroupnamefilter">Basket group name :</label>
484           <input type="text" name="basketgroupnamefilter" id="basketgroupnamefilter" value="[% basketgroupnamefilter %]" />
485       </li>
486       <li>
487         <label for="orderfilter">Order line :</label>
488         <input type="text" name="orderfilter" id="orderfilter" value="[% orderfilter %]"/>
489       </li>
490       [% IF (UNIMARC) %]
491         <li>
492           <label for="eanfilter">EAN :</label>
493           <input type="text" name="eanfilter" id="eanfilter" value="[% eanfilter %]"/>
494         </li>
495       [% END %]
496     </ol>
497     <fieldset class="action">
498       <input type="hidden" value="search" name="op" />
499       <input type="hidden" value="[% invoiceid %]" name="invoiceid" />
500       <input type="submit" value="Filter" />
501       <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Clear</a>
502     </fieldset>
503   </fieldset>
504 </form>
505 [% INCLUDE 'acquisitions-menu.inc' %]
506 </div>
507 </div>
508 [% INCLUDE 'intranet-bottom.inc' %]