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">Home</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 <fieldset class="rows">
144 [% IF available_additional_fields.count %]
145 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
148 [% UNLESS readonly %]
149 <input type="hidden" name="op" value="mod" />
150 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
151 <fieldset class="action">
152 <input type="submit" value="Save" />
153 [% IF CAN_user_acquisition_delete_invoices AND NOT orders_loop.size %]
154 <a href="invoice.pl?op=delete&invoiceid=[% invoiceid | uri %]" id="delete">Delete</a>
163 <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
164 <fieldset class="rows">
165 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
166 [% IF (adjustments && adjustments.count > 0) %]
167 <table id="invoice_adj_table">
174 <th>Encumber while invoice open</th>
175 [% UNLESS readonly %]<th> </th>[% END %]
178 [% FOREACH adjustment IN adjustments %]
179 [% total_adj = total_adj + adjustment.adjustment %]
181 <td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id | html %]" />[% adjustment.adjustment_id | html %]</td>
184 [% adjustment.adjustment | $Price %]
186 <input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment | $Price on_editing => 1 %]" />
191 [% AuthorisedValues.GetByCode('ADJ_REASON', adjustment.reason) | html %]
193 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
195 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
196 <option value="">No reason</option>
197 [% FOREACH reason IN reasons %]
198 [% IF ( adjustment.reason == reason.authorised_value ) %]
199 <option selected="selected" value="[% reason.authorised_value | html %]">
201 <option value="[% reason.authorised_value | html %]">
203 [% reason.lib | html %]
208 <p title="Define values in authorised value category ADJ_REASON to enable">None</p>
209 <input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id | html %]" value="" />
215 [% adjustment.note | html %]
217 <input type="text" name="note" id="note_new" value="[% adjustment.note | html %]"/>
222 [% adjustement.fund.budget_name | html %]
224 <select id="budget_id_[% adjustment.adjustment_id | html %]" name="budget_id">
225 <option value="">No fund</option>
226 [% FOREACH budget IN budgets %]
227 [% IF ( budget.b_id == adjustment.budget_id ) %]
228 <option selected="selected" value="[% budget.b_id | html %]">
230 <option value="[% budget.b_id | html %]">
232 [% IF budget.b_active %]
233 [% budget.b_txt | html %]
235 [% budget.b_txt | html %] <span>(inactive)</span>
242 [% IF adjustment.encumber_open %]
245 <input type="checkbox" checked="checked" readonly="readonly" />
247 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" checked/>
253 <input type="checkbox" disabled="disabled" />
255 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" />
259 [% UNLESS readonly %]
261 <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>
269 [% UNLESS readonly %]
271 <a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
274 <fieldset id="add_invoice_adjustment" style="display:none">
275 <h4>Add an adjustment</h4>
276 <input type="hidden" name="adjustment_id" value="new" />
279 <label for="adjustment_new">Amount: </label>
280 <input type="text" name="adjustment" id="adjustment_new" />
282 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
285 <label for="reason_[% adjustment.adjustment_id | html %]">Reason: </label>
286 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
287 <option value="">No reason</option>
288 [% FOREACH reason IN reasons %]
289 <option value="[% reason.authorised_value | html %]">
290 [% reason.lib | html %]
297 <span class="label">Reason: </span>
299 <div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
303 <label for="note_new">Note: </label>
304 <input type="text" name="note" id="note_new" value=""/>
307 <label for="budget_id_new">Fund: </label>
308 <select id="budget_id_new" name="budget_id">
309 <option value="">No fund</option>
310 [% FOREACH budget IN budgets %]
311 [% IF ( budget.selected ) %]
312 <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option>
313 [% ELSIF ( budget.b_active ) %]
314 <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option>
316 <option value="[% budget.b_id | html %]" class="ab_inactive">[% budget.b_txt | html %] (inactive)</option>
320 <label for="showallfunds_adj" style="float:none;width:auto;"> Show inactive:</label>
321 <input type="checkbox" id="showallfunds_adj" />
324 <label for="encumber_new">Encumber while invoice open? </label>
325 <input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
326 <input type="hidden" name="delete" value="">
329 <span class="label"> </span>
330 <a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
334 <fieldset class="action">
335 <input type="hidden" name="op" value="mod_adj" />
336 <input type="submit" value="Update adjustments" />
342 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Go to receipt page</a>
343 [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]">Manage invoice files</a>[% END %]
345 <h2>Invoice details</h2>
347 [% IF orders_loop.size %]
348 <label for="show_all_details">
349 <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
355 <th class="anti-the">Summary</th>
357 <th class="tax_excluded">Actual cost tax exc.</th>
358 <th class="tax_included">Actual cost tax inc.</th>
359 <th class="replacementprice">Replacement price</th>
361 <th class="tax_excluded">Total tax exc. ([% currency.symbol | html %])</th>
362 <th class="tax_included">Total tax inc. ([% currency.symbol | html %])</th>
369 [% FOREACH order IN orders_loop %]
372 [% IF order.biblionumber %]
373 [% INCLUDE 'biblio-title.inc' biblio=order link = 1 %]
374 [% IF ( order.author ) %]
375 <br /><em>by</em> [% order.author | html %]
378 <em>Deleted bibliographic record, can't find title</em>
380 [% IF ( order.isbn ) %] – [% order.isbn | html %][% END %]
381 [% IF ( order.publishercode ) %]
382 <br/>[% order.publishercode | html %]
383 [% IF order.publicationyear %], [% order.publicationyear | html %]
384 [% ELSIF ( order.copyrightdate ) %][% order.copyrightdate | html %][% END %]
387 <td><p>[% order.branchcode | html %]</p></td>
388 <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
389 <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
390 <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] <span>(Uncertain)</span> [% END %]</td>
391 <td class="number">[% order.quantity | html %]</td>
392 <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
393 <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
394 <td class="number">[% order.tax_rate * 100 | html %]</td>
395 <td class="number">[% order.tax_value | $Price %]</td>
396 <td>[% order.budget_name | html %]</td>
401 [% FOR tf IN foot_loop %]
403 <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
404 <th class="tax_excluded"></th>
405 <th class="tax_included"></th>
406 <th class="replacementprice"/>
407 <th>[% tf.quantity | html %]</th>
408 <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
409 <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
411 <th>[% tf.tax_value | $Price %]</th>
416 <th colspan="2">Total ([% currency.symbol | html %])</th>
417 <th class="tax_excluded"></th>
418 <th class="tax_included"></th>
419 <th class="replacementprice"/>
420 <th>[% total_quantity | html %]</th>
421 <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
422 <th class="tax_included">[% total_tax_included | $Price %]</th>
424 <th>[% total_tax_value | $Price %]</th>
428 <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
429 <th class="tax_excluded"></th>
430 <th class="tax_included"></th>
431 <th class="replacementprice"/>
432 <th>[% total_quantity | html %]</th>
433 <th class="tax_excluded">[% total_tax_excluded_shipment + total_adj | $Price %]</th>
434 <th class="tax_included">[% total_tax_included_shipment + total_adj | $Price %]</th>
436 <th>[% total_tax_value | $Price %]</th>
442 <div class="dialog message"><p>No orders yet</p>
443 [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
444 <p>Adjustments plus shipping: [% total_adj + shipmentcost | $Price %]</p>
448 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
450 <h2>Files attached to invoice</h2>
451 <table id="invoice_files_table">
461 [% FOREACH f IN files %]
463 <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>
464 <td>[% f.file_type | html %]</td>
465 <td>[% f.file_description | html %]</td>
466 <td data-order="[% f.date_uploaded | html %]">
467 [% f.date_uploaded | $KohaDates %]
476 </div> <!-- /.col-sm-10.col-sm-push-2 -->
479 <div class="col-sm-2 col-sm-pull-10">
480 [% INCLUDE 'acquisitions-menu.inc' %]
483 </div> <!-- /.row -->
485 [% MACRO jsinclude BLOCK %]
486 [% Asset.js("js/acquisitions-menu.js") | $raw %]
487 [% INCLUDE 'calendar.inc' %]
488 [% INCLUDE 'datatables.inc' %]
490 function updateColumnsVisibility(visible) {
492 $("table .tax_excluded, .tax_included").show();
494 [% IF ( invoiceincgst ) %]
495 $("table .tax_excluded").hide();
497 $("table .tax_included").hide();
502 $(document).ready(function() {
503 $("#delete").click(function(){
504 return confirmDelete(_("Are you sure you want to delete this invoice?"));
506 $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
512 { "sType": "anti-the", "aTargets": [ "anti-the" ] }
515 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
516 $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
523 $("#show_all_details").click(function(){
524 updateColumnsVisibility( $(this).is(":checked") );
527 $("#show_all_details").prop('checked', false);
528 updateColumnsVisibility(false);
529 $(".toggle_invoice_adjustment").on("click", function(e){
531 $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
533 $("a.delete_adjustment").click(function(){
534 return ( confirm( _("Are you sure you want to delete this file ?") ) );
537 //keep a copy of all budgets before removing the inactives
538 var budgetId = $("#shipment_budget_id");
539 var disabledBudgetsCopy = budgetId.html();
540 $('.b_inactive').remove();
542 $('#showallfunds').click(function() {
543 if ($(this).is(":checked")) {
544 budgetId.html(disabledBudgetsCopy); //Puts back all the funds
547 $('.b_inactive').remove();
550 // same effort for the adjustments
551 var adjBudgetId = $("#budget_id_new");
552 var disabledAdjBudgetsCopy = adjBudgetId.html();
553 $('.ab_inactive').remove();
554 $('#showallfunds_adj').click(function() {
555 if ($(this).is(":checked")) {
556 adjBudgetId.html(disabledAdjBudgetsCopy); //Puts back all the funds
559 $('.ab_inactive').remove();
566 [% INCLUDE 'intranet-bottom.inc' %]