7 [% USE AuthorisedValues %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 <title>Invoice › Acquisitions › Koha</title>
11 [% INCLUDE 'doc-head-close.inc' %]
14 <body id="acq_invoice" class="acq">
15 [% WRAPPER 'header.inc' %]
16 [% INCLUDE 'acquisitions-search.inc' %]
19 [% SET readonly = NOT CAN_user_acquisition_edit_invoices %]
22 [% WRAPPER 'sub-header.inc' %]
23 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
26 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
29 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
32 <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a>
35 <a href="#" aria-current="page">[% invoicenumber | html %]</a>
41 <div class="main container-fluid">
43 <div class="col-sm-10 col-sm-push-2">
46 <h1>Invoice: [% invoicenumber | html %]</h1>
47 [% INCLUDE 'blocking_errors.inc' %]
50 <div class="dialog message">
51 <p>Invoice has been modified</p>
55 <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% suppliername | html %]</a></p>
56 <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
57 <fieldset class="rows">
61 <label for="shipmentdate">Invoice number:</label>
62 [% invoicenumber | html %]
64 <label for="shipmentdate" class="required">Invoice number:</label>
65 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
66 <span class="required">Required</span>
71 <label for="shipmentdate">Shipment date:</label>
73 [% shipmentdate | $KohaDates %]
75 <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | html %]" class="flatpickr" />
76 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
81 <label for="billingdate">Billing date:</label>
83 [% billingdate | $KohaDates %]
85 <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | html %]" class="flatpickr" />
86 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
91 <label for="shipmentcost">Shipping cost:</label>
93 [% shipmentcost | $Price %]
95 <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost | $Price on_editing => 1 %]" />
99 <label for="shipment_budget_id">Shipping fund: </label>
101 [% budget.budget_name | html %]
103 <select id="shipment_budget_id" name="shipment_budget_id">
104 <option value="">No fund</option>
105 [% FOREACH budget IN budgets %]
106 [% IF ( budget.selected ) %]
107 <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
108 [% ELSIF ( budget.b_active ) %]
109 <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
111 <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option>
115 <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label>
116 <input type="checkbox" id="showallfunds" />
120 [% IF ( invoiceclosedate ) %]
121 <li><span class="label">Status:</span>
122 Closed on [% invoiceclosedate | $KohaDates %]</li>
124 [% IF CAN_user_acquisition_reopen_closed_invoices AND NOT readonly %]
126 <label for="reopen">Reopen: </label>
127 <input type="checkbox" name="reopen" id="reopen" />
132 <span class="label">Status:</span>
135 [% UNLESS ( readonly ) %]
137 <label for="close">Close: </label>
138 <input type="checkbox" name="close" id="close" />
143 [% UNLESS readonly %]
144 <input type="hidden" name="op" value="mod" />
145 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
146 <fieldset class="action">
147 <input type="submit" value="Save" />
148 [% IF CAN_user_acquisition_delete_invoices AND NOT orders_loop.size %]
149 <a href="invoice.pl?op=delete&invoiceid=[% invoiceid | uri %]" id="delete">Delete</a>
160 <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
161 <fieldset class="rows">
162 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
163 [% IF (adjustments && adjustments.count > 0) %]
164 <table id="invoice_adj_table">
171 <th>Encumber while invoice open</th>
172 [% UNLESS readonly %]<th> </th>[% END %]
175 [% FOREACH adjustment IN adjustments %]
176 [% total_adj = total_adj + adjustment.adjustment %]
178 <td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id | html %]" />[% adjustment.adjustment_id | html %]</td>
181 [% adjustment.adjustment | $Price %]
183 <input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment | $Price on_editing => 1 %]" />
188 [% AuthorisedValues.GetByCode('ADJ_REASON', adjustment.reason) | html %]
190 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
192 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
193 <option value="">No reason</option>
194 [% FOREACH reason IN reasons %]
195 [% IF ( adjustment.reason == reason.authorised_value ) %]
196 <option selected="selected" value="[% reason.authorised_value | html %]">
198 <option value="[% reason.authorised_value | html %]">
200 [% reason.lib | html %]
205 <p title="Define values in authorised value category ADJ_REASON to enable">None</p>
206 <input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id | html %]" value="" />
212 [% adjustment.note | html %]
214 <input type="text" name="note" id="note_new" value="[% adjustment.note | html %]"/>
219 [% adjustement.fund.budget_name | html %]
221 <select id="budget_id_[% adjustment.adjustment_id | html %]" name="budget_id">
222 <option value="">No fund</option>
223 [% FOREACH budget IN budgets %]
224 [% IF ( budget.b_id == adjustment.budget_id ) %]
225 <option selected="selected" value="[% budget.b_id | html %]">
227 <option value="[% budget.b_id | html %]">
229 [% IF budget.b_active %]
230 [% budget.b_txt | html %]
232 [% budget.b_txt | html %] <span>(inactive)</span>
239 [% IF adjustment.encumber_open %]
242 <input type="checkbox" checked="checked" readonly="readonly" />
244 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" checked/>
250 <input type="checkbox" disabled="disabled" />
252 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" />
256 [% UNLESS readonly %]
258 <a class="btn btn-default btn-xs delete_adjustment" href="/cgi-bin/koha/acqui/invoice.pl?op=del_adj&adjustment_id=[% adjustment.adjustment_id | html %]&invoiceid=[% invoiceid | html %]"><i class="fa fa-trash"></i> Delete</a>
266 [% UNLESS readonly %]
268 <a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
271 <fieldset id="add_invoice_adjustment" style="display:none">
272 <h4>Add an adjustment</h4>
273 <input type="hidden" name="adjustment_id" value="new" />
276 <label for="adjustment_new">Amount: </label>
277 <input type="text" name="adjustment" id="adjustment_new" />
279 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
282 <label for="reason_[% adjustment.adjustment_id | html %]">Reason: </label>
283 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
284 <option value="">No reason</option>
285 [% FOREACH reason IN reasons %]
286 <option value="[% reason.authorised_value | html %]">
287 [% reason.lib | html %]
294 <span class="label">Reason: </span>
296 <div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
300 <label for="note_new">Note: </label>
301 <input type="text" name="note" id="note_new" value=""/>
304 <label for="budget_id_new">Fund: </label>
305 <select id="budget_id_new" name="budget_id">
306 <option value="">No fund</option>
307 [% FOREACH budget IN budgets %]
308 [% IF ( budget.selected ) %]
309 <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
310 [% ELSIF ( budget.b_active ) %]
311 <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
313 <option value="[% budget.b_id | html %]" class="ab_inactive">[% budget.b_txt | html %] (inactive)</option>
317 <label for="showallfunds_adj" style="float:none;width:auto;"> Show inactive:</label>
318 <input type="checkbox" id="showallfunds_adj" />
321 <label for="encumber_new">Encumber while invoice open? </label>
322 <input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
323 <input type="hidden" name="delete" value="">
326 <span class="label"> </span>
327 <a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
331 <fieldset class="action">
332 <input type="hidden" name="op" value="mod_adj" />
333 <input type="submit" value="Update adjustments" />
339 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Go to receipt page</a>
340 [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]">Manage invoice files</a>[% END %]
342 <h2>Invoice details</h2>
344 [% IF orders_loop.size %]
345 <label for="show_all_details">
346 <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
352 <th class="anti-the">Summary</th>
354 <th class="tax_excluded">Actual cost tax exc.</th>
355 <th class="tax_included">Actual cost tax inc.</th>
356 <th class="replacementprice">Replacement price</th>
358 <th class="tax_excluded">Total tax exc. ([% currency.symbol | html %])</th>
359 <th class="tax_included">Total tax inc. ([% currency.symbol | html %])</th>
366 [% FOREACH order IN orders_loop %]
369 [% IF order.biblionumber %]
370 [% INCLUDE 'biblio-title.inc' biblio=order link = 1 %]
371 [% IF ( order.author ) %]
372 <br /><em>by</em> [% order.author | html %]
375 <em>Deleted bibliographic record, can't find title</em>
377 [% IF ( order.isbn ) %] – [% order.isbn | html %][% END %]
378 [% IF ( order.publishercode ) %]
379 <br/>[% order.publishercode | html %]
380 [% IF order.publicationyear %], [% order.publicationyear | html %]
381 [% ELSIF ( order.copyrightdate ) %][% order.copyrightdate | html %][% END %]
384 <td><p>[% order.branchcode | html %]</p></td>
385 <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
386 <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
387 <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] <span>(Uncertain)</span> [% END %]</td>
388 <td class="number">[% order.quantity | html %]</td>
389 <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
390 <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
391 <td class="number">[% order.tax_rate * 100 | html %]</td>
392 <td class="number">[% order.tax_value | $Price %]</td>
393 <td>[% order.budget_name | html %]</td>
398 [% FOR tf IN foot_loop %]
400 <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
401 <th class="tax_excluded"></th>
402 <th class="tax_included"></th>
403 <th class="replacementprice"/>
404 <th>[% tf.quantity | html %]</th>
405 <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
406 <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
408 <th>[% tf.tax_value | $Price %]</th>
413 <th colspan="2">Total ([% currency.symbol | html %])</th>
414 <th class="tax_excluded"></th>
415 <th class="tax_included"></th>
416 <th class="replacementprice"/>
417 <th>[% total_quantity | html %]</th>
418 <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
419 <th class="tax_included">[% total_tax_included | $Price %]</th>
421 <th>[% total_tax_value | $Price %]</th>
425 <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
426 <th class="tax_excluded"></th>
427 <th class="tax_included"></th>
428 <th class="replacementprice"/>
429 <th>[% total_quantity | html %]</th>
430 <th class="tax_excluded">[% total_tax_excluded_shipment + total_adj | $Price %]</th>
431 <th class="tax_included">[% total_tax_included_shipment + total_adj | $Price %]</th>
433 <th>[% total_tax_value | $Price %]</th>
439 <div class="dialog message"><p>No orders yet</p>
440 [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
441 <p>Adjustments plus shipping: [% total_adj + shipmentcost | $Price %]</p>
445 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
447 <h2>Files attached to invoice</h2>
448 <table id="invoice_files_table">
458 [% FOREACH f IN files %]
460 <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]&op=download&view=1&file_id=[% f.file_id | uri %]">[% f.file_name | html %]</a></td>
461 <td>[% f.file_type | html %]</td>
462 <td>[% f.file_description | html %]</td>
463 <td data-order="[% f.date_uploaded | html %]">
464 [% f.date_uploaded | $KohaDates %]
473 </div> <!-- /.col-sm-10.col-sm-push-2 -->
476 <div class="col-sm-2 col-sm-pull-10">
477 [% INCLUDE 'acquisitions-menu.inc' %]
480 </div> <!-- /.row -->
482 [% MACRO jsinclude BLOCK %]
483 [% Asset.js("js/acquisitions-menu.js") | $raw %]
484 [% INCLUDE 'calendar.inc' %]
485 [% INCLUDE 'datatables.inc' %]
487 function updateColumnsVisibility(visible) {
489 $("table .tax_excluded, .tax_included").show();
491 [% IF ( invoiceincgst ) %]
492 $("table .tax_excluded").hide();
494 $("table .tax_included").hide();
499 $(document).ready(function() {
500 $("#delete").click(function(){
501 return confirmDelete(_("Are you sure you want to delete this invoice?"));
503 $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
509 { "sType": "anti-the", "aTargets": [ "anti-the" ] }
512 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
513 $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
520 $("#show_all_details").click(function(){
521 updateColumnsVisibility( $(this).is(":checked") );
524 $("#show_all_details").prop('checked', false);
525 updateColumnsVisibility(false);
526 $(".toggle_invoice_adjustment").on("click", function(e){
528 $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
530 $("a.delete_adjustment").click(function(){
531 return ( confirm( _("Are you sure you want to delete this file ?") ) );
534 //keep a copy of all budgets before removing the inactives
535 var budgetId = $("#shipment_budget_id");
536 var disabledBudgetsCopy = budgetId.html();
537 $('.b_inactive').remove();
539 $('#showallfunds').click(function() {
540 if ($(this).is(":checked")) {
541 budgetId.html(disabledBudgetsCopy); //Puts back all the funds
544 $('.b_inactive').remove();
547 // same effort for the adjustments
548 var adjBudgetId = $("#budget_id_new");
549 var disabledAdjBudgetsCopy = adjBudgetId.html();
550 $('.ab_inactive').remove();
551 $('#showallfunds_adj').click(function() {
552 if ($(this).is(":checked")) {
553 adjBudgetId.html(disabledAdjBudgetsCopy); //Puts back all the funds
556 $('.ab_inactive').remove();
563 [% INCLUDE 'intranet-bottom.inc' %]