Bug 10904: Limit patron update request management by branch
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / invoices.tt
1 [% USE KohaDates %]
2
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Acquisitions &rsaquo; Invoices</title>
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% INCLUDE 'datatables.inc' %]
8 [% INCLUDE 'calendar.inc' %]
9 <script type="text/javascript">
10 //<![CDATA[
11 $(document).ready(function() {
12     var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
13         bPaginate: false,
14         aoColumnDefs: [
15             { "bSortable": false, "aTargets": [1, -1] },
16             { "bVisible": false, "aTargets": [0] },
17             { "sType": "title-string", "aTargets" : [ "title-string" ] }
18         ]
19     }));
20
21     $("#show_only_subscription").attr("checked", false);
22
23     $("#show_only_subscription").click(function(){
24         if ( $(this).attr("checked") ) {
25             resultst.fnFilter( "1", 0, true );
26         } else {
27             resultst.fnFilter( '', 0 );
28         }
29     });
30
31     $('#merge').click(function (ev) {
32         var booksellerid;
33         var mismatch;
34         var invoices = [ ];
35         if ($('.select-invoice:checked').size() < 2) {
36             alert(_("You must select at least two invoices to merge."));
37             return false;
38         }
39         $('.select-invoice:checked').each(function () {
40             var row = $(this).parents('tr');
41             booksellerid = booksellerid || $(row).attr('data-booksellerid');
42             if (booksellerid !== $(row).attr('data-booksellerid')) {
43                 mismatch = true;
44             }
45             invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
46                             'invoicenumber': $(row).find('td:nth-child(2) a').text(),
47                             'shipmentdate': $(row).attr('data-shipmentdate'),
48                             'billingdate': $(row).attr('data-billingdate'),
49                             'shipmentcost': $(row).attr('data-shipmentcost'),
50                             'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
51                             'closedate': $(row).attr('data-closedate'), });
52             $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
53         });
54         if (mismatch) {
55             alert(_("All invoices for merging must be from the same vendor"));
56         } else {
57             $('#merge_table tbody').empty();
58             $.each(invoices, function (idx, invoice) {
59                 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
60                 $(row).appendTo('#merge_table tbody');
61                 $(row).click(function () {
62                     $('#merge_table tbody tr').removeClass('active');
63                     $(this).addClass('active');
64                     $('#merge_invoicenumber').text(invoice.invoicenumber);
65                     $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid'], function (idx, prop) {
66                         $('#merge_' + prop).val(invoice[prop]);
67                     });
68                     if (invoice.closedate) {
69                         $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
70                     } else {
71                         $('#merge_status').text(_("Open"));
72                     }
73                 });
74             });
75             $('#merge_table tbody tr:first').click();
76             $('#merge_invoices').show();
77         }
78     });
79 });
80 //]]>
81 </script>
82 </head>
83
84 <body id="acq_invoices" class="acq">
85 [% INCLUDE 'header.inc' %]
86 [% INCLUDE 'acquisitions-search.inc' %]
87
88 <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; Invoices</div>
89
90 <div id="doc3" class="yui-t2">
91
92 <div id="bd">
93   <div id="yui-main">
94     <div class="yui-b">
95       <h1>Invoices</h1>
96       [% IF ( do_search ) %]
97         [% IF invoices %]
98           <label for="show_only_subscription">
99             <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
100             Show only subscriptions
101           </label>
102           <table id="resultst">
103             <thead>
104               <tr>
105                 <th>&nbsp;</th>
106                 <th>&nbsp;</th>
107                 <th>Invoice no.</th>
108                 <th>Vendor</th>
109                 <th class="title-string">Shipment date</th>
110                 <th class="title-string">Billing date</th>
111                 <th>Received biblios</th>
112                 <th>Received items</th>
113                 <th>Status</th>
114                 <th>&nbsp;</th>
115               </tr>
116             </thead>
117             <tbody>
118               [% FOREACH invoice IN invoices %]
119                 <tr data-invoiceid="[% invoice.invoiceid %]" data-booksellerid="[% invoice.booksellerid %]" data-shipmentdate="[% invoice.shipmentdate | $KohaDates %]" data-billingdate="[% invoice.billingdate | $KohaDates %]" data-shipmentcost="[% invoice.shipmentcost %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid %]" data-closedate="[% invoice.closedate | $KohaDates %]">
120                   <td>[% invoice.is_linked_to_subscriptions %]</td>
121                   <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]" /></td>
122                   <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">[% invoice.invoicenumber %]</a></td>
123                   <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid %]">[% invoice.suppliername %]</a></td>
124                   <td>
125                     [% IF invoice.shipmentdate %]
126                       <span title="[% invoice.shipmentdate %]">[% invoice.shipmentdate | $KohaDates %]</span>
127                     [% ELSE %]
128                       <span title="0000-00-00"></span>
129                     [% END %]
130                   </td>
131                   <td>
132                     [% IF invoice.billingdate %]
133                       <span title="[% invoice.billingdate %]">[% invoice.billingdate | $KohaDates %]</span>
134                     [% ELSE %]
135                       <span title="0000-00-00"></span>
136                     [% END %]
137                   </td>
138                   <td>[% invoice.receivedbiblios %]</td>
139                   <td>[% invoice.receiveditems %]</td>
140                   <td>
141                     [% IF invoice.closedate %]
142                       Closed on [% invoice.closedate | $KohaDates %]
143                     [% ELSE %]
144                       Open
145                     [% END %]
146                   </td>
147                   <td>
148
149                       <div class="dropdown dropup">
150                           <a class="btn btn-mini dropdown-toggle" id="invoiceactions[% invoice.invoiceid %]" role="button" data-toggle="dropdown" href="#">
151                              Actions <b class="caret"></b>
152                           </a>
153                           <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid %]">
154                               <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]"><i class="fa fa-search"></i> Details</a></li>
155                             [% IF invoice.closedate %]
156                                 <li><a href="invoice.pl?op=reopen&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-refresh"></i> Reopen</a></li>
157                             [% ELSE %]
158                                 <li><a href="invoice.pl?op=close&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-times-circle"></i> Close</a></li>
159                             [% END %]
160                             [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
161                                 <li><a href="invoice.pl?op=delete&amp;invoiceid=[% invoice.invoiceid %]&amp;referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber %]%26supplier=[% booksellerid %]%26billingdatefrom=[% billingdatefrom %]%26billingdateto=[% billingdateto %]%26isbneanissn=[% isbneanissn %]%26title=[% title %]%26author=[% author %]%26publisher=[% publisher %]%26publicationyear=[% publicationyear %]%26branch=[% branch %]"><i class="fa fa-remove"></i> Delete</a></li>
162                             [% END %]
163                           </ul>
164                       </div>
165                   </td>
166                 </tr>
167               [% END %]
168             </tbody>
169           </table>
170           <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
171             <div id="merge_invoices">
172                 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
173                 <fieldset class="rows">
174                     <ol>
175                     <li><h2>Merge invoices</h2></li>
176                     <li><table id="merge_table">
177                         <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
178                         <tbody>
179                         </tbody>
180                     </table></li>
181                     <li><label for="merge_invoicenumber">Invoice number:</label><span id="merge_invoicenumber"></span></li>
182                     <li><label for="merge_shipmentdate">Shipment date:</label>
183                             <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" readonly="readonly" class="datepicker" /></li>
184
185                     <li><label for="merge_billingdate">Billing date:</label>
186                             <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" readonly="readonly" class="datepicker" /></li>
187
188                     <li><label for="merge_shipmentcost">Shipment cost:</label>
189                             <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
190                     <li><label for="merge_shipment_budgetid">Fund:</label>
191                             <select id="merge_shipment_budgetid" name="shipment_budget_id">
192                                 <option value="">No fund</option>
193                               [% FOREACH budget IN budgets_loop %]
194                                   <option value="[% budget.budget_id %]">[% budget.budget_name %]
195                                   </option>
196                               [% END %]
197                             </select></li>
198
199                     <li><span class="label">Status:</span> <span id="merge_status"></span></li>
200                     <li><input type="submit" value="Merge" /></li>
201                     </ol>
202                     <input type="hidden" name="op" value="mod" />
203                     <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
204                 </fieldset>
205                 </form>
206             </div>
207         [% ELSE %]
208           <p>Sorry, but there is no results for your search.</p>
209           <p>Search was:
210             <ul>
211               [% IF ( invoicenumber ) %]
212                 <li>Invoice no.: [% invoicenumber %]</li>
213               [% END %]
214               [% IF booksellerid %]
215                 <li>Vendor: [% suppliername %]</li>
216               [% END %]
217               [% IF ( billingdatefrom ) %]
218                 <li>Billing date:
219                 [% IF ( billingdateto ) %]
220                   From [% billingdatefrom %]
221                   To [% billingdateto %]
222                 [% ELSE %]
223                   All since [% billingdatefrom %]
224                 [% END %]
225                 </li>
226               [% ELSE %]
227                 [% IF ( billingdateto ) %]
228                   <li>Billing date:
229                     All until [% billingdateto %]
230                   </li>
231                 [% END %]
232               [% END %]
233               [% IF ( isbneanissn ) %]
234                 <li>ISBN/EAN/ISSN: [% isbneanissn %]</li>
235               [% END %]
236               [% IF ( title ) %]
237                 <li>Title: [% title %]</li>
238               [% END %]
239               [% IF ( author ) %]
240                 <li>Author: [% author %]</li>
241               [% END %]
242               [% IF ( publisher ) %]
243                 <li>Publisher: [% publisher %]</li>
244               [% END %]
245               [% IF ( publicationyear ) %]
246                 <li>Publication year: [% publicationyear %]</li>
247               [% END %]
248               [% IF ( branch ) %]
249                 <li>Library: [% branchname %]</li>
250               [% END %]
251             </ul>
252           </p>
253         [% END %]<!-- invoices -->
254       [% ELSE %]
255         <p>Use the search form on the left to find invoices.</p>
256       [% END %]<!-- do_search -->
257     </div>
258   </div>
259   <div class="yui-b">
260     <form action="" method="get">
261       <fieldset class="brief">
262         <h3>Search filters</h3>
263         <ol>
264           <li>
265             <label for="invoicenumber">Invoice no:</label>
266             <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" class="focus" />
267           </li>
268           <li>
269             <label for="supplier">Vendor:</label>
270             <select id="supplier" name="supplierid">
271               <option value="">All</option>
272               [% FOREACH supplier IN suppliers_loop %]
273                 [% IF ( supplier.selected ) %]
274                   <option selected="selected" value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
275                 [% ELSE %]
276                   <option value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
277                 [% END %]
278               [% END %]
279             </select>
280           </li>
281           <li>
282             <fieldset class="brief">
283               <legend>Shipment date</legend>
284               <ol>
285                 <li>
286                   <label for="shipmentdatefrom">From:</label>
287                   <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom %]" class="datepicker" />
288                 </li>
289                 <li>
290                   <label for="shipmentdateto">To:</label>
291                   <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto %]" class="datepicker" />
292                 </li>
293               </ol>
294             </fieldset>
295           </li>
296           <li>
297             <fieldset class="brief">
298               <legend>Billing date</legend>
299               <ol>
300                 <li>
301                   <label for="billingdatefrom">From:</label>
302                   <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" class="datepicker" />
303                 </li>
304                 <li>
305                   <label for="billingdateto">To:</label>
306                   <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" class="datepicker" />
307                 </li>
308               </ol>
309             </fieldset>
310           </li>
311           <li>
312             <label for="isbneanissn">ISBN / EAN / ISSN:</label>
313             <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn %]" />
314           </li>
315           <li>
316             <label for="title">Title:</label>
317             <input type="text" id="title" name="title" value="[% title %]" />
318           </li>
319           <li>
320             <label for="author">Author:</label>
321             <input type="text" id="author" name="author" value="[% author %]" />
322           </li>
323           <li>
324             <label for="publisher">Publisher:</label>
325             <input type="text" id="publisher" name="publisher" value="[% publisher %]" />
326           </li>
327           <li>
328             <label for="publicationyear">Publication year:</label>
329             <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" />
330           </li>
331           <li>
332             <label for="branch">Library:</label>
333             <select id="branch" name="branch">
334               <option value="">All</option>
335               [% FOREACH branch IN branches_loop %]
336                 [% IF ( branch.selected ) %]
337                   <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
338                 [% ELSE %]
339                   <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
340                 [% END %]
341               [% END %]
342             </select>
343           </li>
344         </ol>
345         <fieldset class="action">
346           <input type="submit" value="Search" />
347         </fieldset>
348       </fieldset>
349       <input type="hidden" name="op" id="op" value="do_search" />
350     </form>
351     [% INCLUDE 'acquisitions-menu.inc' %]
352   </div>
353 </div>
354 [% INCLUDE 'intranet-bottom.inc' %]