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