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