6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Acquisitions › Invoices</title>
8 [% Asset.css("css/datatables.css") | $raw %]
9 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="acq_invoices" class="acq">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'acquisitions-search.inc' %]
17 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › Invoices</div>
19 <div class="main container-fluid">
21 <div class="col-sm-10 col-sm-push-2">
25 [% IF ( do_search ) %]
27 <label for="show_only_subscription">
28 <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
29 Show only subscriptions
38 <th class="title-string">Shipment date</th>
39 <th class="title-string">Billing date</th>
40 <th>Received bibliographic records</th>
41 <th>Received items</th>
47 [% FOREACH invoice IN invoices %]
48 <tr data-invoiceid="[% invoice.invoiceid | html %]" data-booksellerid="[% invoice.booksellerid | html %]" data-shipmentdate="[% invoice.shipmentdate | $KohaDates %]" data-billingdate="[% invoice.billingdate | $KohaDates %]" data-shipmentcost="[% invoice.shipmentcost | html %]" data-shipment_budgetid="[% invoice.shipmentcost_budgetid | html %]" data-closedate="[% invoice.closedate | $KohaDates %]">
49 <td>[% invoice.is_linked_to_subscriptions | html %]</td>
50 <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid | html %]" /></td>
51 <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | html %]">[% invoice.invoicenumber | html %]</a></td>
52 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid | html %]">[% invoice.suppliername | html %]</a></td>
54 [% IF invoice.shipmentdate %]
55 <span title="[% invoice.shipmentdate | html %]">[% invoice.shipmentdate | $KohaDates %]</span>
57 <span title="0000-00-00"></span>
61 [% IF invoice.billingdate %]
62 <span title="[% invoice.billingdate | html %]">[% invoice.billingdate | $KohaDates %]</span>
64 <span title="0000-00-00"></span>
67 <td>[% invoice.receivedbiblios | html %]</td>
68 <td>[% invoice.receiveditems | html %]</td>
70 [% IF invoice.closedate %]
71 Closed on [% invoice.closedate | $KohaDates %]
78 <div class="dropdown dropup">
79 <a class="btn btn-default btn-xs dropdown-toggle" id="invoiceactions[% invoice.invoiceid | html %]" role="button" data-toggle="dropdown" href="#">
80 Actions <b class="caret"></b>
82 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid | html %]">
83 <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | html %]"><i class="fa fa-search"></i> Details</a></li>
84 [% IF invoice.closedate %]
85 <li><a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid | html %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | html %]%26supplier=[% booksellerid | html %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | html %]%26title=[% title | html %]%26author=[% author | html %]%26publisher=[% publisher | html %]%26publicationyear=[% publicationyear | html %]%26branch=[% branch | html %]"><i class="fa fa-refresh"></i> Reopen</a></li>
87 <li><a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid | html %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | html %]%26supplier=[% booksellerid | html %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | html %]%26title=[% title | html %]%26author=[% author | html %]%26publisher=[% publisher | html %]%26publicationyear=[% publicationyear | html %]%26branch=[% branch | html %]"><i class="fa fa-times-circle"></i> Close</a></li>
89 [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
90 <li><a href="invoice.pl?op=delete&invoiceid=[% invoice.invoiceid | html %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | html %]%26supplier=[% booksellerid | html %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | html %]%26title=[% title | html %]%26author=[% author | html %]%26publisher=[% publisher | html %]%26publicationyear=[% publicationyear | html %]%26branch=[% branch | html %]" class="delete_invoice"><i class="fa fa-trash"></i> Delete</a></li>
99 <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
100 <div id="merge_invoices">
101 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
102 <fieldset class="rows">
104 <li><h2>Merge invoices</h2></li>
105 <li><table id="merge_table">
106 <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
110 <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
111 <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
112 <span class="required">Required</span>
114 <li><label for="merge_shipmentdate">Shipment date:</label>
115 <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
117 <li><label for="merge_billingdate">Billing date:</label>
118 <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
120 <li><label for="merge_shipmentcost">Shipment cost:</label>
121 <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
122 <li><label for="merge_shipment_budgetid">Fund:</label>
123 <select id="merge_shipment_budgetid" name="shipment_budget_id">
124 <option value="">No fund</option>
125 [% FOREACH budget IN budgets_loop %]
126 <option value="[% budget.budget_id | html %]">[% budget.budget_name | html %]
131 <li><span class="label">Status:</span> <span id="merge_status"></span></li>
132 <li><input type="submit" value="Merge" /></li>
134 <input type="hidden" name="op" value="mod" />
135 <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
140 <p>Sorry, but there are no results for your search.</p>
143 [% IF ( invoicenumber ) %]
144 <li>Invoice no.: [% invoicenumber | html %]</li>
146 [% IF booksellerid %]
147 <li>Vendor: [% suppliername | html %]</li>
149 [% IF shipmentdatefrom %]
151 [% IF shipmentdateto %]
152 From [% shipmentdatefrom | $KohaDates %]
153 To [% shipmentdateto | $KohaDates %]
155 All since [% shipmentdatefrom | $KohaDates %]
159 [% IF shipmentdateto %]
161 All until [% shipmentdateto | $KohaDates %]
165 [% IF billingdatefrom %]
167 [% IF billingdateto %]
168 From [% billingdatefrom | $KohaDates %]
169 To [% billingdateto | $KohaDates %]
171 All since [% billingdatefrom | $KohaDates %]
175 [% IF billingdateto %]
177 All until [% billingdateto | $KohaDates %]
181 [% IF ( isbneanissn ) %]
182 <li>ISBN/EAN/ISSN: [% isbneanissn | html %]</li>
185 <li>Title: [% title | html %]</li>
188 <li>Author: [% author | html %]</li>
190 [% IF ( publisher ) %]
191 <li>Publisher: [% publisher | html %]</li>
193 [% IF ( publicationyear ) %]
194 <li>Publication year: [% publicationyear | html %]</li>
197 <li>Library: [% Branches.GetName( branch ) | html %]</li>
201 [% END %]<!-- invoices -->
203 <p>Use the search form on the left to find invoices.</p>
204 [% END %]<!-- do_search -->
206 </div> <!-- /.col-sm-10.col-sm-push-2 -->
208 <div class="col-sm-2 col-sm-pull-10">
210 <form action="" method="get">
211 <fieldset class="sidebar brief">
212 <h3>Search filters</h3>
215 <label for="invoicenumber">Invoice no:</label>
216 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="focus" />
219 <label for="supplier">Vendor:</label>
220 <select id="supplier" name="supplierid">
221 <option value="">All</option>
222 [% FOREACH supplier IN suppliers_loop %]
223 [% IF ( supplier.selected ) %]
224 <option selected="selected" value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
226 <option value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
232 <fieldset class="brief">
233 <legend>Shipment date</legend>
236 <label for="shipmentdatefrom">From:</label>
237 <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
240 <label for="shipmentdateto">To:</label>
241 <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
247 <fieldset class="brief">
248 <legend>Billing date</legend>
251 <label for="billingdatefrom">From:</label>
252 <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
255 <label for="billingdateto">To:</label>
256 <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
262 <label for="isbneanissn">ISBN / EAN / ISSN:</label>
263 <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn | html %]" />
266 <label for="title">Title:</label>
267 <input type="text" id="title" name="title" value="[% title | html %]" />
270 <label for="author">Author:</label>
271 <input type="text" id="author" name="author" value="[% author | html %]" />
274 <label for="publisher">Publisher:</label>
275 <input type="text" id="publisher" name="publisher" value="[% publisher | html %]" />
278 <label for="publicationyear">Publication year:</label>
279 <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear | html %]" />
282 <label for="branch">Library:</label>
283 <select id="branch" name="branch">
284 <option value="">All</option>
285 [%# FIXME Should not we filter the libraries %]
286 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
290 <fieldset class="action">
291 <input type="submit" value="Search" />
294 <input type="hidden" name="op" id="op" value="do_search" />
296 [% INCLUDE 'acquisitions-menu.inc' %]
298 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
299 </div> <!-- /.row -->
301 [% MACRO jsinclude BLOCK %]
302 [% Asset.js("js/acquisitions-menu.js") | $raw %]
303 [% INCLUDE 'datatables.inc' %]
304 [% INCLUDE 'calendar.inc' %]
306 $(document).ready(function() {
307 $(".delete_invoice").click(function(){
308 return confirmDelete(_("Are you sure you want to delete this invoice?"));
310 var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
313 { "bSortable": false, "aTargets": [1, -1] },
314 { "bVisible": false, "aTargets": [0] },
315 { "sType": "title-string", "aTargets" : [ "title-string" ] }
319 $("#show_only_subscription").prop("checked", false);
321 $("#show_only_subscription").click(function(){
322 if ( $(this).prop("checked") ) {
323 resultst.fnFilter( "1", 0, true );
325 resultst.fnFilter( '', 0 );
329 $('#merge').click(function (ev) {
333 if ($('.select-invoice:checked').size() < 2) {
334 alert(_("You must select at least two invoices to merge."));
337 $('.select-invoice:checked').each(function () {
338 var row = $(this).parents('tr');
339 booksellerid = booksellerid || $(row).attr('data-booksellerid');
340 if (booksellerid !== $(row).attr('data-booksellerid')) {
343 invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
344 'invoicenumber': $(row).find('td:nth-child(2) a').text(),
345 'shipmentdate': $(row).attr('data-shipmentdate'),
346 'billingdate': $(row).attr('data-billingdate'),
347 'shipmentcost': $(row).attr('data-shipmentcost'),
348 'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
349 'closedate': $(row).attr('data-closedate'), });
350 $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
353 alert(_("All invoices for merging must be from the same vendor"));
355 $('#merge_table tbody').empty();
356 $.each(invoices, function (idx, invoice) {
357 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
358 $(row).appendTo('#merge_table tbody');
359 $(row).click(function () {
360 $('#merge_table tbody tr').removeClass('active');
361 $(this).addClass('active');
362 $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid', 'invoicenumber'], function (idx, prop) {
363 $('#merge_' + prop).val(invoice[prop]);
365 if (invoice.closedate) {
366 $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
368 $('#merge_status').text(_("Open"));
372 $('#merge_table tbody tr:first').click();
373 $('#merge_invoices').show();
380 [% INCLUDE 'intranet-bottom.inc' %]