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' %]
17 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
20 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
23 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
26 <a href="#" aria-current="page">Invoices</a>
31 <div class="main container-fluid">
33 <div class="col-sm-10 col-sm-push-2">
36 [% INCLUDE 'blocking_errors.inc' %]
39 [% IF ( do_search ) %]
41 <label for="show_only_subscription">
42 <input type="checkbox" style="vertical-align: middle;" id="show_only_subscription" />
43 Show only subscriptions
48 [% IF CAN_user_acquisition_merge_invoices %]
54 <th>Shipment date</th>
56 <th>Received bibliographic records</th>
57 <th>Received items</th>
63 [% FOREACH invoice IN invoices %]
64 <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 %]">
65 [% IF CAN_user_acquisition_merge_invoices %]
66 <td>[% invoice.is_linked_to_subscriptions | html %]</td>
68 <td><input type="checkbox" class="select-invoice" value="[% invoice.invoiceid | html %]" /></td>
69 <td><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]">[% invoice.invoicenumber | html %]</a></td>
70 <td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% invoice.booksellerid | uri %]">[% invoice.suppliername | html %]</a></td>
71 <td data-order="[% invoice.shipmentdate | html %]">
72 [% invoice.shipmentdate | $KohaDates %]
74 <td data-order="[% invoice.billingdate | html %]">
75 [% invoice.billingdate | $KohaDates %]
77 <td>[% invoice.receivedbiblios | html %]</td>
78 <td>[% invoice.receiveditems | html %]</td>
80 [% IF invoice.closedate %]
81 Closed on [% invoice.closedate | $KohaDates %]
88 <div class="btn-group dropup">
89 <a class="btn btn-default btn-xs dropdown-toggle" id="invoiceactions[% invoice.invoiceid | html %]" role="button" data-toggle="dropdown" href="#">
90 Actions <b class="caret"></b>
92 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="invoiceactions[% invoice.invoiceid | html %]">
93 <li><a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoice.invoiceid | uri %]"><i class="fa fa-search"></i> Details</a></li>
94 [% IF invoice.closedate %]
95 [% IF CAN_user_acquisition_reopen_closed_invoices %]
96 <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>
99 [% IF CAN_user_acquisition_edit_invoices %]
100 <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>
103 [% UNLESS invoice.receivedbiblios || invoice.receiveditems %]
104 [% IF CAN_user_acquisition_delete_invoices %]
105 <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>
115 [% IF CAN_user_acquisition_merge_invoices %]
116 <a class="submit" id="merge" href="#merge_invoices">Merge selected invoices</a>
117 <div id="merge_invoices">
118 <form id="merge_invoice_form" action="/cgi-bin/koha/acqui/invoice.pl" method="post">
119 <fieldset class="rows">
121 <li><h2>Merge invoices</h2></li>
122 <li><table id="merge_table">
123 <thead><tr><th>Invoice no.</th><th>Shipment date</th><th>Billing date</th><th>Shipment cost</th></tr></thead>
127 <li><label for="merge_invoicenumber" class="required">Invoice number:</label>
128 <input type="text" size="10" id="merge_invoicenumber" name="invoicenumber" value="" class="required" required="required" />
129 <span class="required">Required</span>
131 <li><label for="merge_shipmentdate">Shipment date:</label>
132 <input type="text" size="10" id="merge_shipmentdate" name="shipmentdate" value="" class="datepicker" /></li>
134 <li><label for="merge_billingdate">Billing date:</label>
135 <input type="text" size="10" id="merge_billingdate" name="billingdate" value="" class="datepicker" /></li>
137 <li><label for="merge_shipmentcost">Shipment cost:</label>
138 <input type="text" size="10" id="merge_shipmentcost" name="shipmentcost" value="" /></li>
139 <li><label for="merge_shipment_budgetid">Fund:</label>
140 <select id="merge_shipment_budgetid" name="shipment_budget_id">
141 <option value="">No fund</option>
142 [% FOREACH budget IN budgets_loop %]
143 <option value="[% budget.budget_id | html %]">[% budget.budget_name | html %]
148 <li><span class="label">Status:</span> <span id="merge_status"></span></li>
149 <li><input type="submit" value="Merge" /></li>
151 <input type="hidden" name="op" value="mod" />
152 <input type="hidden" id="merge_invoiceid" name="invoiceid" value="" />
158 <p>Sorry, but there are no results for your search.</p>
161 [% IF ( invoicenumber ) %]
162 <li>Invoice no.: [% invoicenumber | html %]</li>
164 [% IF booksellerid %]
165 <li>Vendor: [% suppliername | html %]</li>
167 [% IF shipmentdatefrom %]
169 [% IF shipmentdateto %]
170 From [% shipmentdatefrom | $KohaDates %]
171 To [% shipmentdateto | $KohaDates %]
173 All since [% shipmentdatefrom | $KohaDates %]
177 [% IF shipmentdateto %]
179 All until [% shipmentdateto | $KohaDates %]
183 [% IF billingdatefrom %]
185 [% IF billingdateto %]
186 From [% billingdatefrom | $KohaDates %]
187 To [% billingdateto | $KohaDates %]
189 All since [% billingdatefrom | $KohaDates %]
193 [% IF billingdateto %]
195 All until [% billingdateto | $KohaDates %]
199 [% IF ( isbneanissn ) %]
200 <li>ISBN/EAN/ISSN: [% isbneanissn | html %]</li>
203 <li>Title: [% title | html %]</li>
206 <li>Author: [% author | html %]</li>
208 [% IF ( publisher ) %]
209 <li>Publisher: [% publisher | html %]</li>
211 [% IF ( publicationyear ) %]
212 <li>Publication year: [% publicationyear | html %]</li>
215 <li>Library: [% Branches.GetName( branch ) | html %]</li>
219 [% END %]<!-- invoices -->
221 <p>Use the search form on the left to find invoices.</p>
222 [% END %]<!-- do_search -->
224 </div> <!-- /.col-sm-10.col-sm-push-2 -->
226 <div class="col-sm-2 col-sm-pull-10">
228 <form action="" method="get">
229 <fieldset class="sidebar brief">
230 <h3>Search filters</h3>
233 <label for="invoicenumber">Invoice no:</label>
234 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="focus" />
237 <label for="supplier">Vendor:</label>
238 <select id="supplier" name="supplierid">
239 <option value="">All</option>
240 [% FOREACH supplier IN suppliers_loop %]
241 [% IF ( supplier.selected ) %]
242 <option selected="selected" value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
244 <option value="[% supplier.booksellerid | html %]">[% supplier.suppliername | html %]</option>
250 <fieldset class="brief">
251 <legend>Shipment date</legend>
254 <label for="shipmentdatefrom">From:</label>
255 <input type="text" id="shipmentdatefrom" name="shipmentdatefrom" size="10" value="[% shipmentdatefrom | $KohaDates %]" class="datepicker" />
258 <label for="shipmentdateto">To:</label>
259 <input type="text" id="shipmentdateto" name="shipmentdateto" size="10" value="[% shipmentdateto | $KohaDates %]" class="datepicker" />
265 <fieldset class="brief">
266 <legend>Billing date</legend>
269 <label for="billingdatefrom">From:</label>
270 <input type="text" id="billingdatefrom" name="billingdatefrom" size="10" value="[% billingdatefrom | $KohaDates %]" class="datepicker" />
273 <label for="billingdateto">To:</label>
274 <input type="text" id="billingdateto" name="billingdateto" size="10" value="[% billingdateto | $KohaDates %]" class="datepicker" />
280 <label for="isbneanissn">ISBN / EAN / ISSN:</label>
281 <input type="text" id="isbneanissn" name="isbneanissn" value="[% isbneanissn | html %]" />
284 <label for="title">Title:</label>
285 <input type="text" id="title" name="title" value="[% title | html %]" />
288 <label for="author">Author:</label>
289 <input type="text" id="author" name="author" value="[% author | html %]" />
292 <label for="publisher">Publisher:</label>
293 <input type="text" id="publisher" name="publisher" value="[% publisher | html %]" />
296 <label for="publicationyear">Publication year:</label>
297 <input type="text" id="publicationyear" name="publicationyear" value="[% publicationyear | html %]" />
300 <label for="branch">Library:</label>
301 <select id="branch" name="branch">
302 <option value="">All</option>
303 [%# FIXME Should not we filter the libraries %]
304 [% PROCESS options_for_libraries libraries => Branches.all( selected => branch, unfiltered => 1 ) %]
308 <fieldset class="action">
309 <input type="submit" value="Search" />
312 <input type="hidden" name="op" id="op" value="do_search" />
314 [% INCLUDE 'acquisitions-menu.inc' %]
316 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
317 </div> <!-- /.row -->
319 [% MACRO jsinclude BLOCK %]
320 [% Asset.js("js/acquisitions-menu.js") | $raw %]
321 [% INCLUDE 'datatables.inc' %]
322 [% INCLUDE 'calendar.inc' %]
324 $(document).ready(function() {
325 $(".delete_invoice").click(function(){
326 return confirmDelete(_("Are you sure you want to delete this invoice?"));
328 var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
331 { "bSortable": false, "aTargets": [1, -1] },
332 { "bVisible": false, "aTargets": [0] }
336 $("#show_only_subscription").prop("checked", false);
338 $("#show_only_subscription").click(function(){
339 if ( $(this).prop("checked") ) {
340 resultst.fnFilter( "1", 0, true );
342 resultst.fnFilter( '', 0 );
346 $('#merge').click(function (ev) {
350 if ($('.select-invoice:checked').size() < 2) {
351 alert(_("You must select at least two invoices to merge."));
354 $('.select-invoice:checked').each(function () {
355 var row = $(this).parents('tr');
356 booksellerid = booksellerid || $(row).attr('data-booksellerid');
357 if (booksellerid !== $(row).attr('data-booksellerid')) {
360 invoices.push({ 'invoiceid': $(row).attr('data-invoiceid'),
361 'invoicenumber': $(row).find('td:nth-child(2) a').text(),
362 'shipmentdate': $(row).attr('data-shipmentdate'),
363 'billingdate': $(row).attr('data-billingdate'),
364 'shipmentcost': $(row).attr('data-shipmentcost'),
365 'shipment_budgetid': $(row).attr('data-shipment_budgetid'),
366 'closedate': $(row).attr('data-closedate'), });
367 $('#merge_invoice_form').append('<input type="hidden" name="merge" value="' + $(row).attr('data-invoiceid') + '" />');
370 alert(_("All invoices for merging must be from the same vendor"));
372 $('#merge_table tbody').empty();
373 $.each(invoices, function (idx, invoice) {
374 var row = $('<tr data-invoiceid="' + invoice.invoiceid + '"><td>' + invoice.invoicenumber + '</td><td>' + invoice.shipmentdate + '</td><td>' + invoice.billingdate + '</td><td>' + invoice.shipmentcost + '</td></tr>');
375 $(row).appendTo('#merge_table tbody');
376 $(row).click(function () {
377 $('#merge_table tbody tr').removeClass('active');
378 $(this).addClass('active');
379 $.each(['invoiceid', 'shipmentdate', 'billingdate', 'shipmentcost', 'shipment_budgetid', 'invoicenumber'], function (idx, prop) {
380 $('#merge_' + prop).val(invoice[prop]);
382 if (invoice.closedate) {
383 $('#merge_status').text(_("Closed on %s").format(invoice.closedate));
385 $('#merge_status').text(_("Open"));
389 $('#merge_table tbody tr:first').click();
390 $('#merge_invoices').show();
397 [% INCLUDE 'intranet-bottom.inc' %]