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