Bug 10051: Separate first name and surname with comma in overdues report
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / acqui / invoices.tt
blob456a231d17a267552e718a9fb534d43d09db9038
1 [% USE KohaDates %]
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, 8] },
16             { "bVisible": false, "aTargets": [0] },
17             { "sType": "title-string", "aTargets" : [ "title-string" ] }
18         ]
19     }));
21     $("#show_only_subscription").attr("checked", false);
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     });
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>
84 <body>
85 [% INCLUDE 'header.inc' %]
86 [% INCLUDE 'acquisitions-search.inc' %]
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>
90 <div id="doc3" class="yui-t2">
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">Billing date</th>
110                 <th>Received biblios</th>
111                 <th>Received items</th>
112                 <th>Status</th>
113                 <th>&nbsp;</th>
114               </tr>
115             </thead>
116             <tbody>
117               [% FOREACH invoice IN invoices %]
118                 <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 %]">
119                   <td>[% invoice.is_linked_to_subscriptions %]</td>
120                   <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]" /></td>
121                   <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">[% invoice.invoicenumber %]</a></td>
122                   <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid %]">[% invoice.suppliername %]</a></td>
123                   <td>
124                     [% IF invoice.billingdate %]
125                       <span title="[% invoice.billingdate %]">[% invoice.billingdate | $KohaDates %]</span>
126                     [% ELSE %]
127                       <span title="0000-00-00"></span>
128                     [% END %]
129                   </td>
130                   <td>[% invoice.receivedbiblios %]</td>
131                   <td>[% invoice.receiveditems %]</td>
132                   <td>
133                     [% IF invoice.closedate %]
134                       Closed on [% invoice.closedate | $KohaDates %]
135                     [% ELSE %]
136                       Open
137                     [% END %]
138                   </td>
139                   <td>
141                       <div class="dropdown dropup">
142                           <a class="btn btn-mini dropdown-toggle" id="invoiceactions[% invoice.invoiceid %]" role="button" data-toggle="dropdown" href="#">
143                              Actions <b class="caret"></b>
144                           </a>
145                           <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid %]">
146                               <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]"><i class="icon-search"></i> Details</a></li>
147                             [% IF invoice.closedate %]
148                                 <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="icon-refresh"></i> Reopen</a></li>
149                             [% ELSE %]
150                                 <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="icon-remove-sign"></i> Close</a></li>
151                             [% END %]
152                             [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
153                                 <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="icon-remove"></i> Delete</a></li>
154                             [% END %]
155                           </ul>
156                       </div>
157                   </td>
158                 </tr>
159               [% END %]
160             </tbody>
161           </table>
162           <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
163             <div id="merge_invoices">
164                 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
165                 <fieldset class="rows">
166                     <ol>
167                     <li><h2>Merge invoices</h2></li>
168                     <li><table id="merge_table">
169                         <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
170                         <tbody>
171                         </tbody>
172                     </table></li>
173                     <li><label for="merge_invoicenumber">Invoice number:</label><span id="merge_invoicenumber"></span></li>
174                     <li><label for="merge_shipmentdate">Shipment date:</label>
175                             <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" readonly="readonly" class="datepicker" /></li>
177                     <li><label for="merge_billingdate">Billing date:</label>
178                             <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" readonly="readonly" class="datepicker" /></li>
180                     <li><label for="merge_shipmentcost">Shipment cost:</label>
181                             <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
182                     <li><label for="merge_shipment_budgetid">Fund:</label>
183                             <select id="merge_shipment_budgetid" name="shipment_budget_id">
184                                 <option value="">No fund</option>
185                               [% FOREACH budget IN budgets_loop %]
186                                   <option value="[% budget.budget_id %]">[% budget.budget_name %]
187                                   </option>
188                               [% END %]
189                             </select></li>
191                     <li><span class="label">Status:</span> <span id="merge_status"></span></li>
192                     <li><input type="submit" value="Merge" /></li>
193                     </ol>
194                     <input type="hidden" name="op" value="mod" />
195                     <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
196                 </fieldset>
197                 </form>
198             </div>
199         [% ELSE %]
200           <p>Sorry, but there is no results for your search.</p>
201           <p>Search was:
202             <ul>
203               [% IF ( invoicenumber ) %]
204                 <li>Invoice no.: [% invoicenumber %]</li>
205               [% END %]
206               [% IF booksellerid %]
207                 <li>Vendor: [% suppliername %]</li>
208               [% END %]
209               [% IF ( billingdatefrom ) %]
210                 <li>Billing date:
211                 [% IF ( billingdateto ) %]
212                   From [% billingdatefrom %]
213                   To [% billingdateto %]
214                 [% ELSE %]
215                   All since [% billingdatefrom %]
216                 [% END %]
217                 </li>
218               [% ELSE %]
219                 [% IF ( billingdateto ) %]
220                   <li>Billing date:
221                     All until [% billingdateto %]
222                   </li>
223                 [% END %]
224               [% END %]
225               [% IF ( isbneanissn ) %]
226                 <li>ISBN/EAN/ISSN: [% isbneanissn %]</li>
227               [% END %]
228               [% IF ( title ) %]
229                 <li>Title: [% title %]</li>
230               [% END %]
231               [% IF ( author ) %]
232                 <li>Author: [% author %]</li>
233               [% END %]
234               [% IF ( publisher ) %]
235                 <li>Publisher: [% publisher %]</li>
236               [% END %]
237               [% IF ( publicationyear ) %]
238                 <li>Publication year: [% publicationyear %]</li>
239               [% END %]
240               [% IF ( branch ) %]
241                 <li>Library: [% branchname %]</li>
242               [% END %]
243             </ul>
244           </p>
245         [% END %]<!-- invoices -->
246       [% ELSE %]
247         <p>Use the search form on the left to find invoices.</p>
248       [% END %]<!-- do_search -->
249     </div>
250   </div>
251   <div class="yui-b">
252     <form action="" method="get">
253       <fieldset class="brief">
254         <h3>Search filters</h3>
255         <ol>
256           <li>
257             <label for="invoicenumber">Invoice no:</label>
258             <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber %]" class="focus" />
259           </li>
260           <li>
261             <label for="supplier">Vendor:</label>
262             <select id="supplier" name="supplierid">
263               <option value="">All</option>
264               [% FOREACH supplier IN suppliers_loop %]
265                 [% IF ( supplier.selected ) %]
266                   <option selected="selected" value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
267                 [% ELSE %]
268                   <option value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
269                 [% END %]
270               [% END %]
271             </select>
272           </li>
273           <li>
274             <fieldset class="brief">
275               <legend>Shipment date</legend>
276               <ol>
277                 <li>
278                   <label for="shipmentdatefrom">From:</label>
279                   <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom %]" class="datepicker" />
280                 </li>
281                 <li>
282                   <label for="shipmentdateto">To:</label>
283                   <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto %]" class="datepicker" />
284                 </li>
285               </ol>
286             </fieldset>
287           </li>
288           <li>
289             <fieldset class="brief">
290               <legend>Billing date</legend>
291               <ol>
292                 <li>
293                   <label for="billingdatefrom">From:</label>
294                   <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom %]" class="datepicker" />
295                 </li>
296                 <li>
297                   <label for="billingdateto">To:</label>
298                   <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto %]" class="datepicker" />
299                 </li>
300               </ol>
301             </fieldset>
302           </li>
303           <li>
304             <label for="isbneanissn">ISBN / EAN / ISSN:</label>
305             <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn %]" />
306           </li>
307           <li>
308             <label for="title">Title:</label>
309             <input type="text" id="title" name="title" value="[% title %]" />
310           </li>
311           <li>
312             <label for="author">Author:</label>
313             <input type="text" id="author" name="author" value="[% author %]" />
314           </li>
315           <li>
316             <label for="publisher">Publisher:</label>
317             <input type="text" id="publisher" name="publisher" value="[% publisher %]" />
318           </li>
319           <li>
320             <label for="publicationyear">Publication year:</label>
321             <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear %]" />
322           </li>
323           <li>
324             <label for="branch">Library:</label>
325             <select id="branch" name="branch">
326               <option value="">All</option>
327               [% FOREACH branch IN branches_loop %]
328                 [% IF ( branch.selected ) %]
329                   <option selected="selected" value="[% branch.branchcode %]">[% branch.branchname %]</option>
330                 [% ELSE %]
331                   <option value="[% branch.branchcode %]">[% branch.branchname %]</option>
332                 [% END %]
333               [% END %]
334             </select>
335           </li>
336         </ol>
337         <fieldset class="action">
338           <input type="submit" value="Search" />
339         </fieldset>
340       </fieldset>
341       <input type="hidden" name="op" id="op" value="do_search" />
342     </form>
343     [% INCLUDE 'acquisitions-menu.inc' %]
344   </div>
345 </div>
346 [% INCLUDE 'intranet-bottom.inc' %]