6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha › Acquisitions › Invoices</title>
8 [% INCLUDE 'doc-head-close.inc' %]
12 <body id="acq_invoices" class="acq">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'acquisitions-search.inc' %]
16 <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>
18 <div class="main container-fluid">
20 <div class="col-sm-10 col-sm-push-2">
24 [% IF ( do_search ) %]
26 <label for="show_only_subscription">
27 <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
28 Show only subscriptions
37 <th class="title-string">Shipment date</th>
38 <th class="title-string">Billing date</th>
39 <th>Received bibliographic records</th>
40 <th>Received items</th>
46 [% FOREACH invoice IN invoices %]
47 <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 %]">
48 <td>[% invoice.is_linked_to_subscriptions | html %]</td>
49 <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid | html %]" /></td>
50 <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]">[% invoice.invoicenumber | html %]</a></td>
51 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid | uri %]">[% invoice.suppliername | html %]</a></td>
53 [% IF invoice.shipmentdate %]
54 <span title="[% invoice.shipmentdate | html %]">[% invoice.shipmentdate | $KohaDates %]</span>
56 <span title="0000-00-00"></span>
60 [% IF invoice.billingdate %]
61 <span title="[% invoice.billingdate | html %]">[% invoice.billingdate | $KohaDates %]</span>
63 <span title="0000-00-00"></span>
66 <td>[% invoice.receivedbiblios | html %]</td>
67 <td>[% invoice.receiveditems | html %]</td>
69 [% IF invoice.closedate %]
70 Closed on [% invoice.closedate | $KohaDates %]
77 <div class="btn-group dropup">
78 <a class="btn btn-default btn-xs dropdown-toggle" id="invoiceactions[% invoice.invoiceid | html %]" role="button" data-toggle="dropdown" href="#">
79 Actions <b class="caret"></b>
81 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid | html %]">
82 <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
83 [% IF invoice.closedate %]
84 [% IF CAN_user_acquisition_reopen_closed_invoices %]
85 <li><a href="invoice.pl?op=reopen&invoiceid=[% invoice.invoiceid | uri %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-refresh"></i> Reopen</a></li>
88 [% IF CAN_user_acquisition_edit_invoices %]
89 <li><a href="invoice.pl?op=close&invoiceid=[% invoice.invoiceid | uri %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]"><i class="fa fa-times-circle"></i> Close</a></li>
92 [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
93 [% IF CAN_user_acquisition_edit_invoices %]
94 <li><a href="invoice.pl?op=delete&invoiceid=[% invoice.invoiceid | uri %]&referer=/cgi-bin/koha/acqui/invoices.pl%3Fop=do_search%26invoicenumber=[% invoicenumber | uri %]%26supplier=[% booksellerid | uri %]%26shipmentdatefrom=[% shipmentdatefrom | $KohaDates %]%26shipmentdateto=[% shipmentdateto | $KohaDates %]%26billingdatefrom=[% billingdatefrom | $KohaDates %]%26billingdateto=[% billingdateto | $KohaDates %]%26isbneanissn=[% isbneanissn | uri %]%26title=[% title | uri %]%26author=[% author | uri %]%26publisher=[% publisher | uri %]%26publicationyear=[% publicationyear | uri %]%26branch=[% branch | uri %]" class="delete_invoice"><i class="fa fa-trash"></i> Delete</a></li>
104 <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
105 <div id="merge_invoices">
106 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
107 <fieldset class="rows">
109 <li><h2>Merge invoices</h2></li>
110 <li><table id="merge_table">
111 <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
115 <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
116 <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
117 <span class="required">Required</span>
119 <li><label for="merge_shipmentdate">Shipment date:</label>
120 <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
122 <li><label for="merge_billingdate">Billing date:</label>
123 <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
125 <li><label for="merge_shipmentcost">Shipment cost:</label>
126 <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
127 <li><label for="merge_shipment_budgetid">Fund:</label>
128 <select id="merge_shipment_budgetid" name="shipment_budget_id">
129 <option value="">No fund</option>
130 [% FOREACH budget IN budgets_loop %]
131 <option value="[% budget.budget_id | html %]">[% budget.budget_name | html %]
136 <li><span class="label">Status:</span> <span id="merge_status"></span></li>
137 <li><input type="submit" value="Merge" /></li>
139 <input type="hidden" name="op" value="mod" />
140 <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
145 <p>Sorry, but there are no results for your search.</p>
148 [% IF ( invoicenumber ) %]
149 <li>Invoice no.: [% invoicenumber | html %]</li>
151 [% IF booksellerid %]
152 <li>Vendor: [% suppliername | html %]</li>
154 [% IF shipmentdatefrom %]
156 [% IF shipmentdateto %]
157 From [% shipmentdatefrom | $KohaDates %]
158 To [% shipmentdateto | $KohaDates %]
160 All since [% shipmentdatefrom | $KohaDates %]
164 [% IF shipmentdateto %]
166 All until [% shipmentdateto | $KohaDates %]
170 [% IF billingdatefrom %]
172 [% IF billingdateto %]
173 From [% billingdatefrom | $KohaDates %]
174 To [% billingdateto | $KohaDates %]
176 All since [% billingdatefrom | $KohaDates %]
180 [% IF billingdateto %]
182 All until [% billingdateto | $KohaDates %]
186 [% IF ( isbneanissn ) %]
187 <li>ISBN/EAN/ISSN: [% isbneanissn | html %]</li>
190 <li>Title: [% title | html %]</li>
193 <li>Author: [% author | html %]</li>
195 [% IF ( publisher ) %]
196 <li>Publisher: [% publisher | html %]</li>
198 [% IF ( publicationyear ) %]
199 <li>Publication year: [% publicationyear | html %]</li>
202 <li>Library: [% Branches.GetName( branch ) | html %]</li>
206 [% END %]<!-- invoices -->
208 <p>Use the search form on the left to find invoices.</p>
209 [% END %]<!-- do_search -->
211 </div> <!-- /.col-sm-10.col-sm-push-2 -->
213 <div class="col-sm-2 col-sm-pull-10">
215 <form action="" method="get">
216 <fieldset class="sidebar brief">
217 <h3>Search filters</h3>
220 <label for="invoicenumber">Invoice no:</label>
221 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="focus" />
224 <label for="supplier">Vendor:</label>
225 <select id="supplier" name="supplierid">
226 <option value="">All</option>
227 [% FOREACH supplier IN suppliers_loop %]
228 [% IF ( supplier.selected ) %]
229 <option selected="selected" value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
231 <option value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
237 <fieldset class="brief">
238 <legend>Shipment date</legend>
241 <label for="shipmentdatefrom">From:</label>
242 <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
245 <label for="shipmentdateto">To:</label>
246 <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
252 <fieldset class="brief">
253 <legend>Billing date</legend>
256 <label for="billingdatefrom">From:</label>
257 <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
260 <label for="billingdateto">To:</label>
261 <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
267 <label for="isbneanissn">ISBN / EAN / ISSN:</label>
268 <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn | html %]" />
271 <label for="title">Title:</label>
272 <input type="text" id="title" name="title" value="[% title | html %]" />
275 <label for="author">Author:</label>
276 <input type="text" id="author" name="author" value="[% author | html %]" />
279 <label for="publisher">Publisher:</label>
280 <input type="text" id="publisher" name="publisher" value="[% publisher | html %]" />
283 <label for="publicationyear">Publication year:</label>
284 <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear | html %]" />
287 <label for="branch">Library:</label>
288 <select id="branch" name="branch">
289 <option value="">All</option>
290 [%# FIXME Should not we filter the libraries %]
291 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
295 <fieldset class="action">
296 <input type="submit" value="Search" />
299 <input type="hidden" name="op" id="op" value="do_search" />
301 [% INCLUDE 'acquisitions-menu.inc' %]
303 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
304 </div> <!-- /.row -->
306 [% MACRO jsinclude BLOCK %]
307 [% Asset.js("js/acquisitions-menu.js") | $raw %]
308 [% INCLUDE 'datatables.inc' %]
309 [% INCLUDE 'calendar.inc' %]
311 $(document).ready(function() {
312 $(".delete_invoice").click(function(){
313 return confirmDelete(_("Are you sure you want to delete this invoice?"));
315 var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
318 { "bSortable": false, "aTargets": [1, -1] },
319 { "bVisible": false, "aTargets": [0] },
320 { "sType": "title-string", "aTargets" : [ "title-string" ] }
324 $("#show_only_subscription").prop("checked", false);
326 $("#show_only_subscription").click(function(){
327 if ( $(this).prop("checked") ) {
328 resultst.fnFilter( "1", 0, true );
330 resultst.fnFilter( '', 0 );
334 $('#merge').click(function (ev) {
338 if ($('.select-invoice:checked').size() < 2) {
339 alert(_("You must select at least two invoices to merge."));
342 $('.select-invoice:checked').each(function () {
343 var row = $(this).parents('tr');
344 booksellerid = booksellerid || $(row).attr('data-booksellerid');
345 if (booksellerid !== $(row).attr('data-booksellerid')) {
348 invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
349 'invoicenumber': $(row).find('td:nth-child(2) a').text(),
350 'shipmentdate': $(row).attr('data-shipmentdate'),
351 'billingdate': $(row).attr('data-billingdate'),
352 'shipmentcost': $(row).attr('data-shipmentcost'),
353 'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
354 'closedate': $(row).attr('data-closedate'), });
355 $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
358 alert(_("All invoices for merging must be from the same vendor"));
360 $('#merge_table tbody').empty();
361 $.each(invoices, function (idx, invoice) {
362 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
363 $(row).appendTo('#merge_table tbody');
364 $(row).click(function () {
365 $('#merge_table tbody tr').removeClass('active');
366 $(this).addClass('active');
367 $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid', 'invoicenumber'], function (idx, prop) {
368 $('#merge_' + prop).val(invoice[prop]);
370 if (invoice.closedate) {
371 $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
373 $('#merge_status').text(_("Open"));
377 $('#merge_table tbody tr:first').click();
378 $('#merge_invoices').show();
385 [% INCLUDE 'intranet-bottom.inc' %]