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">Invoice number:</label><span id="merge_invoicenumber"></span></li>
109 <li><label for="merge_shipmentdate">Shipment date:</label>
110 <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
112 <li><label for="merge_billingdate">Billing date:</label>
113 <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
115 <li><label for="merge_shipmentcost">Shipment cost:</label>
116 <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
117 <li><label for="merge_shipment_budgetid">Fund:</label>
118 <select id="merge_shipment_budgetid" name="shipment_budget_id">
119 <option value="">No fund</option>
120 [% FOREACH budget IN budgets_loop %]
121 <option value="[% budget.budget_id %]">[% budget.budget_name %]
126 <li><span class="label">Status:</span> <span id="merge_status"></span></li>
127 <li><input type="submit" value="Merge" /></li>
129 <input type="hidden" name="op" value="mod" />
130 <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
135 <p>Sorry, but there are no results for your search.</p>
138 [% IF ( invoicenumber ) %]
139 <li>Invoice no.: [% invoicenumber |html %]</li>
141 [% IF booksellerid %]
142 <li>Vendor: [% suppliername %]</li>
144 [% IF shipmentdatefrom %]
146 [% IF shipmentdateto %]
147 From [% shipmentdatefrom | $KohaDates %]
148 To [% shipmentdateto | $KohaDates %]
150 All since [% shipmentdatefrom | $KohaDates %]
154 [% IF shipmentdateto %]
156 All until [% shipmentdateto | $KohaDates %]
160 [% IF billingdatefrom %]
162 [% IF billingdateto %]
163 From [% billingdatefrom | $KohaDates %]
164 To [% billingdateto | $KohaDates %]
166 All since [% billingdatefrom | $KohaDates %]
170 [% IF billingdateto %]
172 All until [% billingdateto | $KohaDates %]
176 [% IF ( isbneanissn ) %]
177 <li>ISBN/EAN/ISSN: [% isbneanissn |html %]</li>
180 <li>Title: [% title |html %]</li>
183 <li>Author: [% author |html %]</li>
185 [% IF ( publisher ) %]
186 <li>Publisher: [% publisher |html %]</li>
188 [% IF ( publicationyear ) %]
189 <li>Publication year: [% publicationyear |html %]</li>
192 <li>Library: [% Branches.GetName( branch ) %]</li>
196 [% END %]<!-- invoices -->
198 <p>Use the search form on the left to find invoices.</p>
199 [% END %]<!-- do_search -->
203 <form action="" method="get">
204 <fieldset class="brief">
205 <h3>Search filters</h3>
208 <label for="invoicenumber">Invoice no:</label>
209 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber |html %]" class="focus" />
212 <label for="supplier">Vendor:</label>
213 <select id="supplier" name="supplierid">
214 <option value="">All</option>
215 [% FOREACH supplier IN suppliers_loop %]
216 [% IF ( supplier.selected ) %]
217 <option selected="selected" value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
219 <option value="[% supplier.booksellerid %]">[% supplier.suppliername %]</option>
225 <fieldset class="brief">
226 <legend>Shipment date</legend>
229 <label for="shipmentdatefrom">From:</label>
230 <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
233 <label for="shipmentdateto">To:</label>
234 <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
240 <fieldset class="brief">
241 <legend>Billing date</legend>
244 <label for="billingdatefrom">From:</label>
245 <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
248 <label for="billingdateto">To:</label>
249 <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
255 <label for="isbneanissn">ISBN / EAN / ISSN:</label>
256 <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn |html %]" />
259 <label for="title">Title:</label>
260 <input type="text" id="title" name="title" value="[% title |html %]" />
263 <label for="author">Author:</label>
264 <input type="text" id="author" name="author" value="[% author |html %]" />
267 <label for="publisher">Publisher:</label>
268 <input type="text" id="publisher" name="publisher" value="[% publisher |html %]" />
271 <label for="publicationyear">Publication year:</label>
272 <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear |html %]" />
275 <label for="branch">Library:</label>
276 <select id="branch" name="branch">
277 <option value="">All</option>
278 [%# FIXME Should not we filter the libraries %]
279 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
283 <fieldset class="action">
284 <input type="submit" value="Search" />
287 <input type="hidden" name="op" id="op" value="do_search" />
289 [% INCLUDE 'acquisitions-menu.inc' %]
293 [% MACRO jsinclude BLOCK %]
294 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
295 [% INCLUDE 'datatables.inc' %]
296 [% INCLUDE 'calendar.inc' %]
297 <script type="text/javascript">
298 $(document).ready(function() {
299 $(".delete_invoice").click(function(){
300 return confirmDelete(_("Are you sure you want to delete this invoice?"));
302 var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
305 { "bSortable": false, "aTargets": [1, -1] },
306 { "bVisible": false, "aTargets": [0] },
307 { "sType": "title-string", "aTargets" : [ "title-string" ] }
311 $("#show_only_subscription").prop("checked", false);
313 $("#show_only_subscription").click(function(){
314 if ( $(this).prop("checked") ) {
315 resultst.fnFilter( "1", 0, true );
317 resultst.fnFilter( '', 0 );
321 $('#merge').click(function (ev) {
325 if ($('.select-invoice:checked').size() < 2) {
326 alert(_("You must select at least two invoices to merge."));
329 $('.select-invoice:checked').each(function () {
330 var row = $(this).parents('tr');
331 booksellerid = booksellerid || $(row).attr('data-booksellerid');
332 if (booksellerid !== $(row).attr('data-booksellerid')) {
335 invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
336 'invoicenumber': $(row).find('td:nth-child(2) a').text(),
337 'shipmentdate': $(row).attr('data-shipmentdate'),
338 'billingdate': $(row).attr('data-billingdate'),
339 'shipmentcost': $(row).attr('data-shipmentcost'),
340 'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
341 'closedate': $(row).attr('data-closedate'), });
342 $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
345 alert(_("All invoices for merging must be from the same vendor"));
347 $('#merge_table tbody').empty();
348 $.each(invoices, function (idx, invoice) {
349 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
350 $(row).appendTo('#merge_table tbody');
351 $(row).click(function () {
352 $('#merge_table tbody tr').removeClass('active');
353 $(this).addClass('active');
354 $('#merge_invoicenumber').text(invoice.invoicenumber);
355 $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid'], function (idx, prop) {
356 $('#merge_' + prop).val(invoice[prop]);
358 if (invoice.closedate) {
359 $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
361 $('#merge_status').text(_("Open"));
365 $('#merge_table tbody tr:first').click();
366 $('#merge_invoices').show();
373 [% INCLUDE 'intranet-bottom.inc' %]