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