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