7 [% USE AuthorisedValues %]
8 [% Asset.css("css/humanmsg.css") | $raw %]
10 <span style="display:none;" id="all_fund_dropdown">
11 [% FOREACH budget IN budgets %]
12 [% IF ( budget.b_active ) %]
13 <option value="[% budget.b_id | html %]" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat | html %]">[% budget.b_txt | html %]</option>
15 <option value="[% budget.b_id | html %]" class="b_inactive" data-sort1-authcat="[% budget.b_sort1_authcat | html %]" data-sort2-authcat="[% budget.b_sort2_authcat |html %]">[% budget.b_txt | html %] (inactive)</option>
19 [% BLOCK fund_dropdown %]
21 <label for="[% form_name | html %]">Fund: </label>
22 <select id="[% form_id | html %]" name="[% form_name | html %]" class="fund_dropdown" data-selected="[% selected | html %]">
24 <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label>
25 <input type="checkbox" class="showallfunds" />
29 <div id="updateFund" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="updateReceivedFund" aria-hidden="true">
30 <div class="modal-dialog">
31 <div class="modal-content">
32 <div class="modal-header">
33 <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
34 <h3 id="updateReceivedFund">Update received fund</h3>
36 <div class="modal-body">
37 <p>Updating the fund may change available statistics for the order, please check values before submitting.</p>
38 <fieldset class="rows">
40 <li>[% PROCESS fund_dropdown form_id => 'modify_budget_id' form_name => 'modify_budget_id' selected => "" %]</li>
42 <label for="sort1">Statistic 1: </label>
43 <input type="text" name="sort1" />
46 <label for="sort2">Statistic 2: </label>
47 <input type="text" name="sort2" />
51 <a id="update_fund" class="btn btn-default">Update fund</a>
53 <div class="modal-footer">
54 <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
61 [% INCLUDE 'doc-head-open.inc' %]
62 <title>Invoice › Acquisitions › Koha</title>
63 [% INCLUDE 'doc-head-close.inc' %]
66 <body id="acq_invoice" class="acq">
67 [% WRAPPER 'header.inc' %]
68 [% INCLUDE 'acquisitions-search.inc' %]
71 [% SET readonly = NOT CAN_user_acquisition_edit_invoices %]
74 [% WRAPPER 'sub-header.inc' %]
75 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
78 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
81 <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a>
84 <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a>
87 <a href="#" aria-current="page">[% invoicenumber | html %]</a>
93 <div class="main container-fluid">
95 <div class="col-sm-10 col-sm-push-2">
98 <h1>Invoice: [% invoicenumber | html %]</h1>
99 [% INCLUDE 'blocking_errors.inc' %]
101 [% IF ( modified ) %]
102 <div class="dialog message">
103 <p>Invoice has been modified</p>
107 <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | uri %]">[% suppliername | html %]</a></p>
108 <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
109 <fieldset class="rows">
113 <label for="shipmentdate">Invoice number:</label>
114 [% invoicenumber | html %]
116 <label for="shipmentdate" class="required">Invoice number:</label>
117 <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
118 <span class="required">Required</span>
123 <label for="shipmentdate">Shipment date:</label>
125 [% shipmentdate | $KohaDates %]
127 <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | html %]" class="flatpickr" />
128 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
133 <label for="billingdate">Billing date:</label>
135 [% billingdate | $KohaDates %]
137 <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | html %]" class="flatpickr" />
138 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
143 <label for="shipmentcost">Shipping cost:</label>
145 [% shipmentcost | $Price %]
147 <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost | $Price on_editing => 1 %]" />
151 [% PROCESS fund_dropdown form_id => 'shipment_budget_id' form_name => 'shipment_budget_id' selected => shipment_budget_id %]
154 [% IF ( invoiceclosedate ) %]
155 <li><span class="label">Status:</span>
156 Closed on [% invoiceclosedate | $KohaDates %]</li>
158 [% IF CAN_user_acquisition_reopen_closed_invoices AND NOT readonly %]
160 <label for="reopen">Reopen: </label>
161 <input type="checkbox" name="reopen" id="reopen" />
166 <span class="label">Status:</span>
169 [% UNLESS ( readonly ) %]
171 <label for="close">Close: </label>
172 <input type="checkbox" name="close" id="close" />
177 <fieldset class="rows">
178 [% IF available_additional_fields.count %]
179 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
182 [% UNLESS readonly %]
183 <input type="hidden" name="op" value="mod" />
184 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
185 <fieldset class="action">
186 <input type="submit" class="btn btn-primary" value="Save" />
187 [% IF CAN_user_acquisition_delete_invoices AND NOT orders_loop.size %]
188 <a href="invoice.pl?op=delete&invoiceid=[% invoiceid | uri %]" id="delete">Delete</a>
197 <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
198 <fieldset class="rows">
199 <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
200 [% IF (adjustments && adjustments.count > 0) %]
201 <table id="invoice_adj_table">
208 <th>Encumber while invoice open</th>
209 [% UNLESS readonly %]<th> </th>[% END %]
212 [% FOREACH adjustment IN adjustments %]
213 [% total_adj = total_adj + adjustment.adjustment %]
215 <td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id | html %]" />[% adjustment.adjustment_id | html %]</td>
218 [% adjustment.adjustment | $Price %]
220 <input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment | $Price on_editing => 1 %]" />
225 [% AuthorisedValues.GetByCode('ADJ_REASON', adjustment.reason) | html %]
227 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
229 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
230 <option value="">No reason</option>
231 [% FOREACH reason IN reasons %]
232 [% IF ( adjustment.reason == reason.authorised_value ) %]
233 <option selected="selected" value="[% reason.authorised_value | html %]">
235 <option value="[% reason.authorised_value | html %]">
237 [% reason.lib | html %]
242 <p title="Define values in authorised value category ADJ_REASON to enable">None</p>
243 <input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id | html %]" value="" />
249 [% adjustment.note | html %]
251 <input type="text" name="note" id="note_new" value="[% adjustment.note | html %]"/>
255 [% PROCESS fund_dropdown form_id => "budget_id_" _ adjustment.adjustment_id form_name => 'budget_id' selected => adjustment.budget_id %]
257 [% IF adjustment.encumber_open %]
260 <input type="checkbox" checked="checked" readonly="readonly" />
262 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" checked/>
268 <input type="checkbox" disabled="disabled" />
270 <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" />
274 [% UNLESS readonly %]
276 <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>
284 [% UNLESS readonly %]
286 <a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
289 <fieldset id="add_invoice_adjustment" style="display:none">
290 <h4>Add an adjustment</h4>
291 <input type="hidden" name="adjustment_id" value="new" />
294 <label for="adjustment_new">Amount: </label>
295 <input type="text" name="adjustment" id="adjustment_new" />
297 [% reasons = AuthorisedValues.Get("ADJ_REASON") %]
300 <label for="reason_[% adjustment.adjustment_id | html %]">Reason: </label>
301 <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
302 <option value="">No reason</option>
303 [% FOREACH reason IN reasons %]
304 <option value="[% reason.authorised_value | html %]">
305 [% reason.lib | html %]
312 <span class="label">Reason: </span>
314 <div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
318 <label for="note_new">Note: </label>
319 <input type="text" name="note" id="note_new" value=""/>
322 [% PROCESS fund_dropdown form_id => "budget_id_new" form_name => 'budget_id' selected => "" %]
325 <label for="encumber_new">Encumber while invoice open? </label>
326 <input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
327 <input type="hidden" name="delete" value="">
330 <span class="label"> </span>
331 <a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
335 <fieldset class="action">
336 <input type="hidden" name="op" value="mod_adj" />
337 <input type="submit" class="btn btn-primary" value="Update adjustments" />
343 <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | uri %]">Go to receipt page</a>
344 [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | uri %]">Manage invoice files</a>[% END %]
346 <h2>Invoice details</h2>
348 [% IF orders_loop.size %]
349 <label for="show_all_details">
350 <input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
356 <th class="anti-the">Summary</th>
358 <th class="tax_excluded">Actual cost tax exc.</th>
359 <th class="tax_included">Actual cost tax inc.</th>
360 <th class="replacementprice">Replacement price</th>
362 <th class="tax_excluded">Total tax exc. ([% currency.symbol | html %])</th>
363 <th class="tax_included">Total tax inc. ([% currency.symbol | html %])</th>
370 [% FOREACH order IN orders_loop %]
373 [% IF order.biblionumber %]
374 [% INCLUDE 'biblio-title.inc' biblio=order link = 1 %]
375 [% IF ( order.author ) %]
376 <br /><em>by</em> [% order.author | html %]
379 <em>Deleted bibliographic record, can't find title</em>
381 [% IF ( order.isbn ) %] – [% order.isbn | html %][% END %]
382 [% IF ( order.publishercode ) %]
383 <br/>[% order.publishercode | html %]
384 [% IF order.publicationyear %], [% order.publicationyear | html %]
385 [% ELSIF ( order.copyrightdate ) %][% order.copyrightdate | html %][% END %]
388 <td><p>[% order.branchcode | html %]</p></td>
389 <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price %]</td>
390 <td class="number tax_included">[% order.unitprice_tax_included | $Price %]</td>
391 <td class="number replacementprice">[% order.replacementprice | $Price %] [% IF ( order.uncertainprice ) %] <span>(Uncertain)</span> [% END %]</td>
392 <td class="number">[% order.quantity | html %]</td>
393 <td class="number tax_excluded">[% order.total_tax_excluded | $Price %]</td>
394 <td class="number tax_included">[% order.total_tax_included | $Price %]</td>
395 <td class="number">[% order.tax_rate * 100 | html %]</td>
396 <td class="number">[% order.tax_value | $Price %]</td>
398 <span class="order_name" data-order_id="[% order.ordernumber | html %]">[% order.budget_name | html %]</span></br>
399 <a href="#" class="modify_fund" data-order_id="[% order.ordernumber | html %]" data-budget_id="[% order.budget_id | html %]" data-sort_1="[% order.sort1 | html %]" data-sort_2="[% order.sort2 | html %]" data-sort1="[% order.sort1 | html %]" data-sort2="[% order.sort2 | html %]">Modify fund</a>
405 [% FOR tf IN foot_loop %]
407 <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
408 <th class="tax_excluded"></th>
409 <th class="tax_included"></th>
410 <th class="replacementprice"/>
411 <th>[% tf.quantity | html %]</th>
412 <th class="tax_excluded">[% tf.total_tax_excluded | $Price %]</th>
413 <th class="tax_included">[% tf.total_tax_included | $Price %]</th>
415 <th>[% tf.tax_value | $Price %]</th>
420 <th colspan="2">Total ([% currency.symbol | html %])</th>
421 <th class="tax_excluded"></th>
422 <th class="tax_included"></th>
423 <th class="replacementprice"/>
424 <th>[% total_quantity | html %]</th>
425 <th class="tax_excluded">[% total_tax_excluded | $Price %]</th>
426 <th class="tax_included">[% total_tax_included | $Price %]</th>
428 <th>[% total_tax_value | $Price %]</th>
432 <th colspan="2">Total + adjustments + shipment cost ([% currency.symbol | html %])</th>
433 <th class="tax_excluded"></th>
434 <th class="tax_included"></th>
435 <th class="replacementprice"/>
436 <th>[% total_quantity | html %]</th>
437 <th class="tax_excluded">[% total_tax_excluded_shipment + total_adj | $Price %]</th>
438 <th class="tax_included">[% total_tax_included_shipment + total_adj | $Price %]</th>
440 <th>[% total_tax_value | $Price %]</th>
446 <div class="dialog message"><p>No orders yet</p>
447 [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
448 <p>Adjustments plus shipping: [% total_adj + shipmentcost | $Price %]</p>
452 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
454 <h2>Files attached to invoice</h2>
455 <table id="invoice_files_table">
465 [% FOREACH f IN files %]
467 <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>
468 <td>[% f.file_type | html %]</td>
469 <td>[% f.file_description | html %]</td>
470 <td data-order="[% f.date_uploaded | html %]">
471 [% f.date_uploaded | $KohaDates %]
480 </div> <!-- /.col-sm-10.col-sm-push-2 -->
483 <div class="col-sm-2 col-sm-pull-10">
484 [% INCLUDE 'acquisitions-menu.inc' %]
487 </div> <!-- /.row -->
489 [% MACRO jsinclude BLOCK %]
490 [% Asset.js("js/acquisitions-menu.js") | $raw %]
491 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
492 [% Asset.js("js/acq.js") | $raw %]
493 [% INCLUDE 'calendar.inc' %]
494 [% INCLUDE 'datatables.inc' %]
496 function updateColumnsVisibility(visible) {
498 $("table .tax_excluded, .tax_included").show();
500 [% IF ( invoiceincgst ) %]
501 $("table .tax_excluded").hide();
503 $("table .tax_included").hide();
508 $(document).ready(function() {
509 $("#delete").click(function(){
510 return confirmDelete(_("Are you sure you want to delete this invoice?"));
512 $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
518 { "sType": "anti-the", "aTargets": [ "anti-the" ] }
521 [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
522 $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
529 $("#show_all_details").click(function(){
530 updateColumnsVisibility( $(this).is(":checked") );
533 $("#show_all_details").prop('checked', false);
534 updateColumnsVisibility(false);
535 $(".toggle_invoice_adjustment").on("click", function(e){
537 $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
539 $("a.delete_adjustment").click(function(){
540 return ( confirm( _("Are you sure you want to delete this file ?") ) );
543 //keep a copy of all budgets before removing the inactives
544 var disabledBudgetsCopy = $("#all_fund_dropdown").html();
545 $(".fund_dropdown").each(function(){
546 $(this).html( disabledBudgetsCopy);
547 var selected = $(this).data('selected');
548 $(this).find('option[value="'+selected+'"]').removeClass('b_inactive');
549 $(this).val( selected );
552 $('.b_inactive').remove();
554 $('.showallfunds').click(function() {
555 var the_dropdown = $(this).parent('span').find('.fund_dropdown');
556 var selected = the_dropdown.val();
557 if ($(this).is(":checked")) {
558 the_dropdown.html(disabledBudgetsCopy).val(selected);
561 the_dropdown.find('option[value="'+selected+'"]').removeClass('b_inactive');
562 $(this).parent('span').find('.b_inactive').remove();
566 $(".modify_fund").on('click',function(e){
568 var selected = $(this).data('budget_id');
569 var sort1 = $(this).data('sort1');
570 var sort2 = $(this).data('sort2');
571 $("#update_fund").data('order_id',$(this).data('order_id'));
572 $("#modify_budget_id").html(disabledBudgetsCopy);
573 $("#modify_budget_id").val(selected).find('option[value="'+selected+'"]').removeClass('b_inactive');
574 $("#sort1").val(sort1);
575 $("#sort2").val(sort2);
576 $("#modify_budget_id").find('.b_inactive').remove();
577 $("#modify_budget_id").change();
578 $("#updateFund").modal('show');
580 $("#update_fund").on('click',function(){
581 var new_fund = $("#modify_budget_id").val();
582 var sort1 = $("#sort1").val();
583 var sort2 = $("#sort2").val();
584 var new_fund_name = $('#modify_budget_id option[value="'+new_fund+'"]').text();
585 var order_id = $(this).data('order_id');
587 url: "/api/v1/acquisitions/orders/" + order_id,
589 contentType: 'application/json',
590 data: JSON.stringify({
597 .then(function(thing,result){
598 $("#updateFund").modal('hide');
599 $('#updateFund .showallfunds').prop('checked',false);
600 $('.modify_fund[data-order_id="'+order_id+'"]').data('budget_id',new_fund);
601 $('.order_name[data-order_id="'+order_id+'"]').text(new_fund_name);
602 humanMsg.displayAlert( _("Order updated"), { className: 'humanError' } );
605 humanMsg.displayAlert( _("Failed to update order:") + err.responseText, { className: 'humanError' } );
608 $("#modify_budget_id").change(function(){
609 var destination_sort1 = $(this).parents('.modal-body').find('input[name="sort1"]');
610 var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat');
611 var sort1 = $(destination_sort1).val() || "";
612 if ( destination_sort1.length < 1 ) {
613 destination_sort1 = $(this).parents('.modal-body').find('select[name="sort1"]');
615 var destination_sort2 = $(this).parents('.modal-body').find('input[name="sort2"]');
616 var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat');
617 var sort2 = $(destination_sort2).val() || "";
618 if ( destination_sort2.length < 1 ) {
619 destination_sort2 = $(this).parents('.modal-body').find('select[name="sort2"]');
621 getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 );
622 getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 );
624 // same effort for the adjustments
625 var adjBudgetId = $("#budget_id_new");
626 var disabledAdjBudgetsCopy = adjBudgetId.html();
627 $('.ab_inactive').remove();
628 $('#showallfunds_adj').click(function() {
629 if ($(this).is(":checked")) {
630 adjBudgetId.html(disabledAdjBudgetsCopy); //Puts back all the funds
633 $('.ab_inactive').remove();
640 [% INCLUDE 'intranet-bottom.inc' %]