+[% USE raw %]
+[% USE Asset %]
[% USE Koha %]
[% USE KohaDates %]
+[% USE Price %]
+[% SET footerjs = 1 %]
+[% USE AuthorisedValues %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions › Invoice</title>
-<link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+[% Asset.css("css/datatables.css") | $raw %]
[% INCLUDE 'doc-head-close.inc' %]
-[% INCLUDE 'calendar.inc' %]
-[% INCLUDE 'datatables.inc' %]
-<script type="text/javascript">
-//<![CDATA[
- function updateColumnsVisibility(visible) {
- if ( visible ) {
- $("table .gste, .gsti").show();
- } else {
- [% IF ( invoiceincgst ) %]
- $("table .gste").hide();
- [% ELSE %]
- $("table .gsti").hide();
- [% END %]
- }
- }
-
- $(document).ready(function() {
- $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
- bInfo: false,
- bPaginate: false,
- bFilter: false,
- sDom: "t"
- }));
-[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
- $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
- "aoColumnDefs": [
- { "aTargets": [ 3 ], "sType": "natural" }
- ],
- bInfo: false,
- bPaginate: false,
- bFilter: false,
- sDom: "t"
- }));
-[% END %]
- $("#show_all_details").click(function(){
- updateColumnsVisibility($(this+":checked").val());
- });
-
- $("#show_all_details").attr('checked', false);
- updateColumnsVisibility(false);
- });
-//]]>
-</script>
</head>
-<body>
+<body id="acq_invoice" class="acq">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'acquisitions-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> › <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid %]">[% invoicenumber %]</a></div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/acqui/acqui-home.pl">Acquisitions</a> › <a href="/cgi-bin/koha/acqui/invoices.pl">Invoices</a> › <a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid=[% invoiceid | html %]">[% invoicenumber | html %]</a></div>
-<div id="doc3" class="yui-t2">
+<div class="main container-fluid">
+ <div class="row">
+ <div class="col-sm-10 col-sm-push-2">
+ <main>
-<div id="bd">
- <div id="yui-main">
- <div class="yui-b">
[% IF ( modified ) %]
<div class="dialog message">
<p>Invoice has been modified</p>
</div>
[% END %]
- <h1>Invoice: [% invoicenumber %]</h1>
+ <h1>Invoice: [% invoicenumber | html %]</h1>
- <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid %]">[% suppliername %]</a></p>
- <form action="/cgi-bin/koha/acqui/invoice.pl" method="post">
+ <p>Vendor: <a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% booksellerid | html %]">[% suppliername | html %]</a></p>
+ <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
<fieldset class="rows">
<ol>
+ <li>
+ <label for="shipmentdate" class="required">Invoice number:</label>
+ <input type="text" id="invoicenumber" name="invoicenumber" value="[% invoicenumber | html %]" class="required" required="required"/>
+ <span class="required">Required</span>
+ </li>
+
<li><label for="shipmentdate">Shipment date:</label>
- <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li>
+ <input type="text" size="10" id="shipmentdate" name="shipmentdate" value="[% shipmentdate | $KohaDates %]" class="datepicker" /></li>
<li><label for="billingdate">Billing date:</label>
- <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" readonly="readonly" class="datepicker" /></li>
+ <input type="text" size="10" id="billingdate" name="billingdate" value="[% billingdate | $KohaDates %]" class="datepicker" /></li>
<li><label for="shipmentcost">Shipping cost:</label>
- <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost %]" /></li>
- <li><label for="shipment_budget_id">Fund:</label>
+ <input type="text" size="10" id="shipmentcost" name="shipmentcost" value="[% shipmentcost | html %]" /></li>
+ <li><label for="shipment_budget_id">Shipping fund:</label>
<select id="shipment_budget_id" name="shipment_budget_id">
<option value="">No fund</option>
[% FOREACH budget IN budgets_loop %]
[% IF ( budget.selected ) %]
- <option selected="selected" value="[% budget.budget_id %]">
+ <option selected="selected" value="[% budget.budget_id | html %]">
[% ELSE %]
- <option value="[% budget.budget_id %]">
+ <option value="[% budget.budget_id | html %]">
[% END %]
- [% budget.budget_name %]
+ [% budget.budget_name | html %]
</option>
[% END %]
</select></li>
[% END %]
</ol>
<input type="hidden" name="op" value="mod" />
- <input type="hidden" name="invoiceid" value="[% invoiceid %]" />
- </fieldset>
- <fieldset class="action">
- <input type="submit" value="Save" />
- [% UNLESS orders_loop.size %]
- <a href="invoice.pl?op=delete&invoiceid=[% invoiceid %]">Delete</a>
- [% END %]
+ <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
+ <fieldset class="action">
+ <input type="submit" value="Save" />
+ [% UNLESS orders_loop.size %]
+ <a href="invoice.pl?op=delete&invoiceid=[% invoiceid | html %]" id="delete">Delete</a>
+ [% END %]
+ </fieldset>
</fieldset>
</form>
+
+ <hr />
+
+ <h3>Adjustments</h3>
+
+ <form action="/cgi-bin/koha/acqui/invoice.pl" method="post" class="validated">
+ <fieldset class="rows">
+ <input type="hidden" name="invoiceid" value="[% invoiceid | html %]" />
+ [% IF (adjustments && adjustments.count > 0) %]
+ <table id="invoice_adj_table">
+ <tr>
+ <th>Id</th>
+ <th>Amount</th>
+ <th>Reason</th>
+ <th>Note</th>
+ <th>Fund</th>
+ <th>Encumber while invoice open</th>
+ <th> </th>
+ </tr>
+ [% total_adj = 0 | html %]
+ [% FOREACH adjustment IN adjustments %]
+ [% total_adj = total_adj + adjustment.adjustment | html %]
+ <tr>
+ <td><input type="hidden" name="adjustment_id" value="[% adjustment.adjustment_id | html %]" />[% adjustment.adjustment_id | html %]</td>
+ <td><input type="text" name="adjustment" id="adjustment_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment | $Price | html %]" /></td>
+ <td>
+ [% reasons = AuthorisedValues.Get("ADJ_REASON") | html %]
+ [% IF reasons.0 %]
+ <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
+ <option value="">No reason</option>
+ [% FOREACH reason IN reasons %]
+ [% IF ( adjustment.reason == reason.authorised_value ) %]
+ <option selected="selected" value="[% reason.authorised_value | html %]">
+ [% ELSE %]
+ <option value="[% reason.authorised_value | html %]">
+ [% END %]
+ [% reason.lib | html %]
+ </option>
+ [% END %]
+ </select>
+ [% ELSE %]
+ <p title="Define values in authorised value category ADJ_REASON to enable">None</p>
+ <input type="hidden" name="reason" id="reason_[% adjustment.adjustment_id | html %]" value="" />
+ [% END %]
+ </td>
+ <td><input type="text" name="note" id="note_new" value="[% adjustment.note | html %]"/></td>
+ <td>
+ <select id="budget_id_[% adjustment.adjustment_id | html %]" name="budget_id">
+ <option value="">No fund</option>
+ [% FOREACH budget IN budgets_loop %]
+ [% IF ( budget.budget_id == adjustment.budget_id ) %]
+ <option selected="selected" value="[% budget.budget_id | html %]">
+ [% ELSE %]
+ <option value="[% budget.budget_id | html %]">
+ [% END %]
+ [% budget.budget_name | html %]
+ </option>
+ [% END %]
+ </select>
+ </td>
+ [% IF adjustment.encumber_open %]
+ <td>
+ <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" checked/>
+ </td>
+ [% ELSE %]
+ <td>
+ <input type="checkbox" name="encumber_open" id="encumber_[% adjustment.adjustment_id | html %]" value="[% adjustment.adjustment_id | html %]" />
+ </td>
+ [% END %]
+ <td>
+ <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>
+ </td>
+ </tr>
+ [% END %]
+ </table>
+ [% END %]
+
+ <p>
+ <a href="#" id="show_invoice_adjustment" class="toggle_invoice_adjustment"><i class="fa fa-plus"></i> Add an adjustment</a>
+ </p>
+
+ <fieldset id="add_invoice_adjustment" style="display:none">
+ <h4>Add an adjustment</h4>
+ <input type="hidden" name="adjustment_id" value="new" />
+ <ol>
+ <li>
+ <label for="adjustment_new">Amount: </label>
+ <input type="text" name="adjustment" id="adjustment_new" />
+ </li>
+ [% reasons = AuthorisedValues.Get("ADJ_REASON") | html %]
+ [% IF reasons.0 %]
+ <li>
+ <label for="reason_[% adjustment.adjustment_id | html %]">Reason: </label>
+ <select id="reason_[% adjustment.adjustment_id | html %]" name="reason">
+ <option value="">No reason</option>
+ [% FOREACH reason IN reasons %]
+ <option value="[% reason.authorised_value | html %]">
+ [% reason.lib | html %]
+ </option>
+ [% END %]
+ </select>
+ </li>
+ [% ELSE %]
+ <li>
+ <span class="label">Reason: </span>
+ <span>None</span>
+ <div class="hint">Define values in authorised value category ADJ_REASON to enable</div>
+ </li>
+ [% END %]
+ <li>
+ <label for="note_new">Note: </label>
+ <input type="text" name="note" id="note_new" value=""/>
+ </li>
+ <li>
+ <label for="budget_id_new">Fund: </label>
+ <select id="budget_id_new" name="budget_id">
+ <option selected="selected" value="">No fund</option>
+ [% FOREACH budget IN budgets_loop %]
+ <option value="[% budget.budget_id | html %]">
+ [% budget.budget_name | html %]
+ </option>
+ [% END %]
+ </select>
+ </li>
+ <li>
+ <label for="encumber_new">Encumber while invoice open? </label>
+ <input type="checkbox" name="encumber_open" id="encumber_new" value="new" />
+ <input type="hidden" name="delete" value="">
+ </li>
+ <li>
+ <span class="label"> </span>
+ <a href="#" id="cancel_invoice_adjustment" class="toggle_invoice_adjustment" style="display:none"><i class="fa fa-remove"></i> Cancel</a>
+ </li>
+ </ol>
+ </fieldset>
+ <fieldset class="action">
+ <input type="hidden" name="op" value="mod_adj" />
+ <input type="submit" value="Update adjustments" />
+ </fieldset>
+ </fieldset>
+ </form>
<p>
- <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid %]">Go to receipt page</a>
- [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]">Manage invoice files</a>[% END %]
+ <a href="/cgi-bin/koha/acqui/parcel.pl?invoiceid=[% invoiceid | html %]">Go to receipt page</a>
+ [% IF Koha.Preference('AcqEnableFiles') %]| <a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | html %]">Manage invoice files</a>[% END %]
</p>
<h2>Invoice details</h2>
+ <fieldset>
[% IF orders_loop.size %]
<label for="show_all_details">
<input type="checkbox" style="vertical-align: middle;" id="show_all_details" />
<table id="orderst">
<thead>
<tr>
- <th>Summary</th>
- <th>Publisher</th>
+ <th class="anti-the">Summary</th>
<th>Library</th>
- <th class="gste">Actual cost tax exc.</th>
- <th class="gsti">Actual cost tax inc.</th>
+ <th class="tax_excluded">Actual cost tax exc.</th>
+ <th class="tax_included">Actual cost tax inc.</th>
+ <th class="replacementprice">Replacement price</th>
<th>Qty.</th>
- <th class="gste">Total tax exc. ([% currency %])</th>
- <th class="gsti">Total tax inc. ([% currency %])</th>
+ <th class="tax_excluded">Total tax exc. ([% currency.symbol | html %])</th>
+ <th class="tax_included">Total tax inc. ([% currency.symbol | html %])</th>
<th>GST %</th>
<th>GST</th>
<th>Fund</th>
<tbody>
[% FOREACH order IN orders_loop %]
<tr>
- <td><p><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber %]">[% order.title %]</a>
- [% IF ( order.author ) %]
- <br /><em>by</em> [% order.author %]
- [% END %]
- </p></td>
<td>
+ [% IF order.biblionumber %]
+ <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% order.biblionumber | html %]">[% order.title | html %]</a>
+ [% IF ( order.author ) %]
+ <br /><em>by</em> [% order.author | html %]
+ [% END %]
+ [% ELSE %]
+ <em>Deleted bibliographic record, can't find title</em>
+ [% END %]
+ [% IF ( order.isbn ) %] – [% order.isbn | html %][% END %]
[% IF ( order.publishercode ) %]
- <p>[% order.publishercode %]
- [% IF ( order.publicationyear ) %]
- - [% order.publicationyear %]
- [% END %]
- </p>
+ <br/>[% order.publishercode | html %]
+ [% IF order.publicationyear %], [% order.publicationyear | html %]
+ [% ELSIF ( order.copyrightdate ) %][% order.copyrightdate | html %][% END %]
[% END %]
</td>
- <td><p>[% order.branchcode %]</p></td>
- <td class="number gste">[% order.actualcostgste %]</td>
- <td class="number gsti">[% order.actualcostgsti %]</td>
- <td class="number">[% order.quantity %]</td>
- <td class="number gste">[% order.totalgste %]</td>
- <td class="number gsti">[% order.totalgsti %]</td>
- <td class="number">[% order.gstgsti %]</td>
- <td class="number">[% order.gstvalue %]</td>
- <td>[% order.budget_name %]</td>
+ <td><p>[% order.branchcode | html %]</p></td>
+ <td class="number tax_excluded">[% order.unitprice_tax_excluded | $Price | html %]</td>
+ <td class="number tax_included">[% order.unitprice_tax_included | $Price | html %]</td>
+ <td class="number replacementprice">[% order.replacementprice | $Price | html %]</td>
+ <td class="number">[% order.quantity | html %]</td>
+ <td class="number tax_excluded">[% order.total_tax_excluded | $Price | html %]</td>
+ <td class="number tax_included">[% order.total_tax_included | $Price | html %]</td>
+ <td class="number">[% order.tax_rate * 100 | html %]</td>
+ <td class="number">[% order.tax_value | $Price | html %]</td>
+ <td>[% order.budget_name | html %]</td>
</tr>
[% END %]
</tbody>
<tfoot>
[% FOR tf IN foot_loop %]
<tr>
- <th colspan='3'>Total (GST [% tf.gstgsti %] %)</th>
- <th class="gste"/><th class="gsti"/>
- <th>[% tf.quantity %]</th>
- <th class="gste">[% tf.totalgste %]</th>
- <th class="gsti">[% tf.totalgsti %]</th>
+ <th colspan="2">Total (GST [% tf.tax_rate * 100 | html %] %)</th>
+ <th class="tax_excluded"></th>
+ <th class="tax_included"></th>
+ <th class="replacementprice"/>
+ <th>[% tf.quantity | html %]</th>
+ <th class="tax_excluded">[% tf.total_tax_excluded | $Price | html %]</th>
+ <th class="tax_included">[% tf.total_tax_included | $Price | html %]</th>
<th> </th>
- <th>[% tf.gstvalue %]</th>
+ <th>[% tf.tax_value | $Price | html %]</th>
<th> </th>
</tr>
[% END %]
<tr>
- <th colspan='3'>Total ([% currency %])</th>
- <th class="gste"/><th class="gsti"/>
- <th>[% total_quantity %]</th>
- <th class="gste">[% total_gste %]</th>
- <th class="gsti">[% total_gsti %]</th>
+ <th colspan="2">Total ([% currency.symbol | html %])</th>
+ <th class="tax_excluded"></th>
+ <th class="tax_included"></th>
+ <th class="replacementprice"/>
+ <th>[% total_quantity | html %]</th>
+ <th class="tax_excluded">[% total_tax_excluded | $Price | html %]</th>
+ <th class="tax_included">[% total_tax_included | $Price | html %]</th>
<th> </th>
- <th>[% total_gstvalue %]</th>
+ <th>[% total_tax_value | $Price | html %]</th>
<th> </th>
</tr>
<tr>
- <th colspan="3">Total + Shipment cost ([% currency %])</th>
- <th class="gste"></th>
- <th class="gsti"></th>
- <th>[% total_quantity %]</th>
- <th class="gste">[% total_gste_shipment %]</th>
- <th class="gsti">[% total_gsti_shipment %]</th>
+ <th colspan="2">Total + Adjustments + Shipment cost ([% currency.symbol | html %])</th>
+ <th class="tax_excluded"></th>
+ <th class="tax_included"></th>
+ <th class="replacementprice"/>
+ <th>[% total_quantity | html %]</th>
+ <th class="tax_excluded">[% total_tax_excluded_shipment + total_adj | $Price | html %]</th>
+ <th class="tax_included">[% total_tax_included_shipment | $Price | html %]</th>
<th> </th>
- <th>[% total_gstvalue %]</th>
+ <th>[% total_tax_value | $Price | html %]</th>
<th> </th>
</tr>
</tfoot>
</table>
[% ELSE %]
- <div class="dialog message"><p>No orders yet</p></div>
+ <div class="dialog message"><p>No orders yet</p>
+ [% IF adjustments && adjustments.count > 0 || shipmentcost && shipmentcost > 0 %]
+ <p>Adjustments plus shipping:[% total_adj + shipmentcost | $Price | html %]</p>
+ [% END %]
+ </div>
[% END %]
[% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
<br />
<tbody>
[% FOREACH f IN files %]
<tr>
- <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid %]&op=download&view=1&file_id=[% f.file_id %]">[% f.file_name | html %]</a></td>
+ <td><a href="/cgi-bin/koha/acqui/invoice-files.pl?invoiceid=[% invoiceid | html %]&op=download&view=1&file_id=[% f.file_id | html %]">[% f.file_name | html %]</a></td>
<td>[% f.file_type | html %]</td>
<td>[% f.file_description | html %]</td>
- <td><!-- [% f.date_uploaded %] -->[% f.date_uploaded | $KohaDates %]</td>
+ <td class="title-string">
+ <span title="[% f.date_uploaded | html %]">[% f.date_uploaded | $KohaDates %]</span>
+ </td>
</tr>
[% END %]
</tbody>
</table>
[% END %]
- </div>
- </div>
- <div class="yui-b">
- [% INCLUDE 'acquisitions-menu.inc' %]
- </div>
-</div>
+ </fieldset>
+ </main>
+ </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+ <aside>
+ <div class="col-sm-2 col-sm-pull-10">
+ [% INCLUDE 'acquisitions-menu.inc' %]
+ </div>
+ </aside>
+</div> <!-- /.row -->
+
+[% MACRO jsinclude BLOCK %]
+ [% Asset.js("js/acquisitions-menu.js") | $raw %]
+ [% INCLUDE 'calendar.inc' %]
+ [% INCLUDE 'datatables.inc' %]
+ <script>
+ function updateColumnsVisibility(visible) {
+ if ( visible ) {
+ $("table .tax_excluded, .tax_included").show();
+ } else {
+ [% IF ( invoiceincgst ) %]
+ $("table .tax_excluded").hide();
+ [% ELSE %]
+ $("table .tax_included").hide();
+ [% END %]
+ }
+ }
+
+ $(document).ready(function() {
+ $("#delete").click(function(){
+ return confirmDelete(_("Are you sure you want to delete this invoice?"));
+ });
+ $("#orderst").dataTable($.extend(true, {}, dataTablesDefaults, {
+ bInfo: false,
+ bPaginate: false,
+ bFilter: false,
+ sDom: "t",
+ "aoColumnDefs": [
+ { "sType": "anti-the", "aTargets": [ "anti-the" ] }
+ ]
+ }));
+ [% IF ( (Koha.Preference('AcqEnableFiles')) && files ) %]
+ $("#invoice_files_table").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "aoColumnDefs": [
+ { "aTargets": [ "title-string" ], "sType": "title-string" }
+ ],
+ bInfo: false,
+ bPaginate: false,
+ bFilter: false,
+ sDom: "t"
+ }));
+ [% END %]
+ $("#show_all_details").click(function(){
+ updateColumnsVisibility( $(this).is(":checked") );
+ });
+
+ $("#show_all_details").prop('checked', false);
+ updateColumnsVisibility(false);
+ $(".toggle_invoice_adjustment").on("click", function(e){
+ e.preventDefault();
+ $("#show_invoice_adjustment, #cancel_invoice_adjustment, #add_invoice_adjustment").toggle();
+ });
+ $("a.delete_adjustment").click(function(){
+ return ( confirm( _("Are you sure you want to delete this file ?") ) );
+ });
+ });
+ </script>
+[% END %]
+
[% INCLUDE 'intranet-bottom.inc' %]