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