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