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