4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Acquisitions › Invoices</title>
6 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
7 [% INCLUDE 'doc-head-close.inc' %]
11 <body id="acq_invoices" class="acq">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'acquisitions-search.inc' %]
15 <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>
17 <div id="doc3" class="yui-t2">
23 [% IF ( do_search ) %]
25 <label for="show_only_subscription">
26 <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
27 Show only subscriptions
36 <th class="title-string">Shipment date</th>
37 <th class="title-string">Billing date</th>
38 <th>Received biblios</th>
39 <th>Received items</th>
45 [% FOREACH invoice IN invoices %]
46 <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 %]">
47 <td>[% invoice.is_linked_to_subscriptions %]</td>
48 <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid %]" /></td>
49 <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]">[% invoice.invoicenumber %]</a></td>
50 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid %]">[% invoice.suppliername %]</a></td>
52 [% IF invoice.shipmentdate %]
53 <span title="[% invoice.shipmentdate %]">[% invoice.shipmentdate | $KohaDates %]</span>
55 <span title="0000-00-00"></span>
59 [% IF invoice.billingdate %]
60 <span title="[% invoice.billingdate %]">[% invoice.billingdate | $KohaDates %]</span>
62 <span title="0000-00-00"></span>
65 <td>[% invoice.receivedbiblios %]</td>
66 <td>[% invoice.receiveditems %]</td>
68 [% IF invoice.closedate %]
69 Closed on [% invoice.closedate | $KohaDates %]
76 <div class="dropdown dropup">
77 <a class="btn btn-default btn-xs dropdown-toggle" id="invoiceactions[% invoice.invoiceid %]" role="button" data-toggle="dropdown" href="#">
78 Actions <b class="caret"></b>
80 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid %]">
81 <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid %]"><i class="fa fa-search"></i> Details</a></li>
82 [% IF invoice.closedate %]
83 <li><a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid %]&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>
85 <li><a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid %]&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>
87 [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
88 <li><a href="invoice.pl?op=delete&invoiceid=[% invoice.invoiceid %]&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 %]" class="delete_invoice"><i class="fa fa-trash"></i> Delete</a></li>
97 <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
98 <div id="merge_invoices">
99 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
100 <fieldset class="rows">
102 <li><h2>Merge invoices</h2></li>
103 <li><table id="merge_table">
104 <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
108 <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
109 <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
110 <span class="required">Required</span>
112 <li><label for="merge_shipmentdate">Shipment date:</label>
113 <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
115 <li><label for="merge_billingdate">Billing date:</label>
116 <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
118 <li><label for="merge_shipmentcost">Shipment cost:</label>
119 <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
120 <li><label for="merge_shipment_budgetid">Fund:</label>
121 <select id="merge_shipment_budgetid" name="shipment_budget_id">
122 <option value="">No fund</option>
123 [% FOREACH budget IN budgets_loop %]
124 <option value="[% budget.budget_id %]">[% budget.budget_name %]
129 <li><span class="label">Status:</span> <span id="merge_status"></span></li>
130 <li><input type="submit" value="Merge" /></li>
132 <input type="hidden" name="op" value="mod" />
133 <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
138 <p>Sorry, but there are no results for your search.</p>
141 [% IF ( invoicenumber ) %]
142 <li>Invoice no.: [% invoicenumber |html %]</li>
144 [% IF booksellerid %]
145 <li>Vendor: [% suppliername %]</li>
147 [% IF shipmentdatefrom %]
149 [% IF shipmentdateto %]
150 From [% shipmentdatefrom | $KohaDates %]
151 To [% shipmentdateto | $KohaDates %]
153 All since [% shipmentdatefrom | $KohaDates %]
157 [% IF shipmentdateto %]
159 All until [% shipmentdateto | $KohaDates %]
163 [% IF billingdatefrom %]
165 [% IF billingdateto %]
166 From [% billingdatefrom | $KohaDates %]
167 To [% billingdateto | $KohaDates %]
169 All since [% billingdatefrom | $KohaDates %]
173 [% IF billingdateto %]
175 All until [% billingdateto | $KohaDates %]
179 [% IF ( isbneanissn ) %]
180 <li>ISBN/EAN/ISSN: [% isbneanissn |html %]</li>
183 <li>Title: [% title |html %]</li>
186 <li>Author: [% author |html %]</li>
188 [% IF ( publisher ) %]
189 <li>Publisher: [% publisher |html %]</li>
191 [% IF ( publicationyear ) %]
192 <li>Publication year: [% publicationyear |html %]</li>
195 <li>Library: [% Branches.GetName( branch ) %]</li>
199 [% END %]<!-- invoices -->
201 <p>Use the search form on the left to find invoices.</p>
202 [% END %]<!-- do_search -->
206 <form action="" method="get">
207 <fieldset class="brief">
208 <h3>Search filters</h3>
211 <label for="invoicenumber">Invoice no:</label>
212 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber |html %]" class="focus" />
215 <label for="supplier">Vendor:</label>
216 <select id="supplier" name="supplierid">
217 <option value="">All</option>
218 [% FOREACH supplier IN suppliers_loop %]
219 [% IF ( supplier.selected ) %]
220 <option selected="selected" value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
222 <option value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
228 <fieldset class="brief">
229 <legend>Shipment date</legend>
232 <label for="shipmentdatefrom">From:</label>
233 <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
236 <label for="shipmentdateto">To:</label>
237 <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
243 <fieldset class="brief">
244 <legend>Billing date</legend>
247 <label for="billingdatefrom">From:</label>
248 <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
251 <label for="billingdateto">To:</label>
252 <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
258 <label for="isbneanissn">ISBN / EAN / ISSN:</label>
259 <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn |html %]" />
262 <label for="title">Title:</label>
263 <input type="text" id="title" name="title" value="[% title |html %]" />
266 <label for="author">Author:</label>
267 <input type="text" id="author" name="author" value="[% author |html %]" />
270 <label for="publisher">Publisher:</label>
271 <input type="text" id="publisher" name="publisher" value="[% publisher |html %]" />
274 <label for="publicationyear">Publication year:</label>
275 <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear |html %]" />
278 <label for="branch">Library:</label>
279 <select id="branch" name="branch">
280 <option value="">All</option>
281 [%# FIXME Should not we filter the libraries %]
282 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
286 <fieldset class="action">
287 <input type="submit" value="Search" />
290 <input type="hidden" name="op" id="op" value="do_search" />
292 [% INCLUDE 'acquisitions-menu.inc' %]
296 [% MACRO jsinclude BLOCK %]
297 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
298 [% INCLUDE 'datatables.inc' %]
299 [% INCLUDE 'calendar.inc' %]
300 <script type="text/javascript">
301 $(document).ready(function() {
302 $(".delete_invoice").click(function(){
303 return confirmDelete(_("Are you sure you want to delete this invoice?"));
305 var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
308 { "bSortable": false, "aTargets": [1, -1] },
309 { "bVisible": false, "aTargets": [0] },
310 { "sType": "title-string", "aTargets" : [ "title-string" ] }
314 $("#show_only_subscription").prop("checked", false);
316 $("#show_only_subscription").click(function(){
317 if ( $(this).prop("checked") ) {
318 resultst.fnFilter( "1", 0, true );
320 resultst.fnFilter( '', 0 );
324 $('#merge').click(function (ev) {
328 if ($('.select-invoice:checked').size() < 2) {
329 alert(_("You must select at least two invoices to merge."));
332 $('.select-invoice:checked').each(function () {
333 var row = $(this).parents('tr');
334 booksellerid = booksellerid || $(row).attr('data-booksellerid');
335 if (booksellerid !== $(row).attr('data-booksellerid')) {
338 invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
339 'invoicenumber': $(row).find('td:nth-child(2) a').text(),
340 'shipmentdate': $(row).attr('data-shipmentdate'),
341 'billingdate': $(row).attr('data-billingdate'),
342 'shipmentcost': $(row).attr('data-shipmentcost'),
343 'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
344 'closedate': $(row).attr('data-closedate'), });
345 $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
348 alert(_("All invoices for merging must be from the same vendor"));
350 $('#merge_table tbody').empty();
351 $.each(invoices, function (idx, invoice) {
352 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
353 $(row).appendTo('#merge_table tbody');
354 $(row).click(function () {
355 $('#merge_table tbody tr').removeClass('active');
356 $(this).addClass('active');
357 $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid', 'invoicenumber'], function (idx, prop) {
358 $('#merge_' + prop).val(invoice[prop]);
360 if (invoice.closedate) {
361 $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
363 $('#merge_status').text(_("Open"));
367 $('#merge_table tbody tr:first').click();
368 $('#merge_invoices').show();
375 [% INCLUDE 'intranet-bottom.inc' %]