[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Administration › Funds[% IF ( add_form ) %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
+<title>Koha › Administration › Funds[% IF op == 'add_form' %] › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund [% END %][% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript">
//<![CDATA[
</script>
<script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
-
-[% IF ( add_form ) %]
+[% IF op == 'add_form' %]
<script type="text/javascript">
//<![CDATA[
}
//]]>
</script>
-[% ELSE %]
- [% IF ( notree ) %]
- <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
- [% INCLUDE 'datatables.inc' %]
- [% ELSE %]
- <link href="[% themelang %]/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
- <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
- [% END %]
-
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.qtip.js"></script>
+[% ELSIF op == 'list' %]
+ <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
+ [% INCLUDE 'datatables.inc' %]
+ <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
<script type="text/javascript">
//<![CDATA[
//
$(document).ready(function() {
- var tooltipcontent = $(".tooltipcontent");
- tooltipcontent.hide();
-
- $(".tooltiped td").each(function (){
- contentelem = $(this).parent().children().filter(".tooltipcontent");
- if(contentelem.html() != ""){
- $(this).qtip({
- content: contentelem.html(),
- show: "mouseover",
- hide: "mouseout",
- style: {
- name: "light",
- tip: "bottomLeft",
- border: {
- radius: 5,
- color: "#356CA1"
- }
- },
- position: {
- corner: {
- target: "topRight",
- tooltip: "bottomRight"
+ var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "fnDrawCallback": function ( oSettings ) {
+ if ( oSettings.aiDisplay.length == 0 )
+ {
+ return;
+ }
+
+ var nTrs = $('#budgeth tbody tr');
+ var iColspan = nTrs[0].getElementsByTagName('td').length;
+ var sLastGroup = "";
+ for ( var i=0 ; i<nTrs.length ; i++ )
+ {
+ var iDisplayIndex = oSettings._iDisplayStart + i;
+ var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
+ if ( sGroup != sLastGroup )
+ {
+ var nGroup = document.createElement( 'tr' );
+ var nCell = document.createElement( 'td' );
+ nCell.colSpan = iColspan;
+ nCell.className = "group";
+ nCell.innerHTML = sGroup;
+ nGroup.appendChild( nCell );
+ nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
+ sLastGroup = sGroup;
}
}
- });
- }
+ },
+ "aoColumnDefs": [
+ { "bVisible": false, "aTargets": [ 0, 1 ] },
+ { "bSortable": false, "aTargets": ["_all"] }
+ ],
+ 'bSort': true,
+ 'aaSortingFixed': [[ 1, 'asc' ]],
+ 'bPaginate': false,
+ "bAutoWidth": false
+ }));
+
+ $(oTable).treetable({
+ expandable: true
});
- [% IF ( notree ) %]
- $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
- "aoColumnDefs": [
- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
- ],
- "aLengthMenu": [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]],
- "iDisplayLength": 20,
- "sPaginationType": "four_button"
- }));
- [% ELSE %]
- $("#budgeth").treeTable();
+ $(oTable).treetable('expandAll');
+ $("#expand_all").click(function(e){
+ e.preventDefault();
+ $(oTable).treetable('expandAll');
+ });
+ $("#collapse_all").click(function(e){
+ e.preventDefault();
+ $(oTable).treetable('collapseAll');
+ });
+
+ [% UNLESS budget_period_id %]
+ $("#hide_inactive").click(function(e){
+ e.preventDefault();
+ oTable.fnFilter( 1, 0 ); // Show only active=1
+ });
+ $("#show_inactive").click(function(e){
+ e.preventDefault();
+ oTable.fnFilter( '', 0 );
+ });
+ $("#hide_inactive").click();
[% END %]
$("#filterbutton").click(function() {
[% INCLUDE 'budgets-admin-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
- <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › [% IF ( else ) %]Funds for '[% budget_period_description %]'[% END %][% IF ( add_form ) %]
- <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %][% END %] [% IF ( delete_confirm ) %]
- <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> › Delete fund?[% END %]</div>
+ <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › [% IF op == 'list' %][% IF budget_period_id %]Funds for '[% budget_period_description %]'[% ELSE %]All funds[% END %][% END %]
+ [% IF op == 'add_form' %]
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> › [% IF ( budget_id ) %]Modify fund[% IF ( budget_name ) %] '[% budget_name %]'[% END %][% ELSE %]Add fund[% END %]
+ [% END %]
+ [% IF op == 'delete_confirm' %]
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> › Delete fund?
+ [% END %]
+</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div class="yui-b" id="content">
-[% UNLESS ( delete_confirm ) %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
+[% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
[% IF (error_not_authorised_to_modify) %]
<div class="error">
</div>
[% END %]
-[% IF ( else ) %]
+[% IF op == 'list' %]
-<h1>Funds for '[% budget_period_description %]'</h1>
+<h1>
+ [% IF budget_period_id %]
+ Funds for '[% budget_period_description %]'
+ [% ELSE %]
+ All funds
+ [% END %]
+</h1>
[% INCLUDE 'budgets-active-currency.inc' %]
-[% IF ( budget ) %]
+[% IF budgets %]
<table id="budgeth">
+ [% UNLESS budget_period_id %]
+ <caption>
+ <span class="actions"><a href="#" id="expand_all">Expand all</a>
+ | <a href="#" id="collapse_all">Collapse all</a>
+ | <a href="#" id="hide_inactive">Hide inactive budgets</a>
+ | <a href="#" id="show_inactive">Show inactive budgets</a></span>
+ </caption>
+ [% END %]
<thead>
<tr>
+ <th>Active</th>
+ <th>Budget period description</th>
<th>Fund code</th>
<th>Fund name</th>
- <th>Total<br />allocated</th>
- <th>Base-level<br />allocated</th>
- <th>Base-level<br />spent</th>
- <th>Total sublevels<br />spent</th>
- <th>Base-level<br />remaining</th>
- <th class="tooltipcontent"> </th>
+ <th>Base-level allocated</th>
+ <th>Base-level ordered</th>
+ <th>Total ordered</th>
+ <th>Base-level spent</th>
+ <th>Total spent</th>
+ <th>Base-level available</th>
+ <th>Total available</th>
<th>Actions</th>
</tr>
</thead>
-<tfoot>
+ <tfoot>
<tr>
+ <th></th>
+ <th></th>
<th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %] </th>
<th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
- <th nowrap="nowrap" class="data"> [% base_alloc_total %]</th>
- <th class="data">[% base_spent_total %]</th>
- <th class="data">[% base_spent_total %]</th>
- <th class="data">[% base_remaining_total %]</th>
- <th class="tooltipcontent"></th>
+ <th></th>
+ <th class="data">[% ordered_total %]</th>
+ <th></th>
+ <th class="data">[% spent_total %]</th>
+ <th></th>
+ <th class="data">[% available_total %]</th>
<th></th>
</tr>
</tfoot>
<tbody>
- [% FOREACH budge IN budget %]
- [% IF ( budge.toggle ) %]
- <tr id="node-[% budge.budget_id %]" class="highlight[% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %] tooltiped">
+ [% FOREACH budget IN budgets %]
+ [% IF budget.budget_parent_id %]
+ <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
[% ELSE %]
- <tr id="node-[% budge.budget_id %]" class="tooltiped [% IF ( budge.budget_parent_id ) %] child-of-node-[% budge.budget_parent_id %][% END %]">
+ <tr data-tt-id="[% budget.budget_id %]">
[% END %]
-
- <td>[% budge.budget_code_indent %]</td>
- <td>[% budge.budget_name %]</td>
- <td class="data">[% budge.budget_amount_total %]</td>
- <td class="data">[% budge.budget_amount %] </td>
- <td class="data">[% budge.budget_spent %] </td>
- <td class="data">[% budge.total_levels_spent %]</td>
- [% IF ( budge.remaining_pos ) %]
- <td class="data" style="color: green;">
- [% ELSIF ( budge.remaining_neg ) %]
- <td class="data" style="color: red;">
- [% ELSE %]
- <td class="data">
+ <td>[% budget.budget_period_active %]</td>
+ <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
+ <td>[% budget.budget_code_indent %]</td>
+ <td>[% budget.budget_name %]</td>
+ <td class="data">
+ [% IF budget.budget_parent_id %]
+ <span class="child_fund_amount">[% budget.budget_amount %]</span>
+ [% ELSE %]
+ [% budget.budget_amount %]
+ [% END %]
+ </td>
+ <td class="data">
+ [% IF budget.budget_parent_id %]
+ <span class="child_fund_amount">[% budget.budget_ordered %]</span>
+ [% ELSE %]
+ [% budget.budget_ordered %]
+ [% END %]
+ </td>
+ <td class="data">
+ [% IF budget.budget_parent_id %]
+ <span class="child_fund_amount">[% budget.total_ordered %]</span>
+ [% ELSE %]
+ [% budget.total_ordered %]
+ [% END %]
+ </td>
+ <td class="data">
+ [% IF budget.budget_parent_id %]
+ <span class="child_fund_amount">[% budget.budget_spent %]</span>
+ [% ELSE %]
+ [% budget.budget_spent %]
+ [% END %]
+ </td>
+ <td class="data">
+ [% IF budget.budget_parent_id %]
+ <span class="child_fund_amount">[% budget.total_spent %]</span>
+ [% ELSE %]
+ [% budget.total_spent %]
+ [% END %]
+ </td>
+
+
+ [% BLOCK colorcellvalue %]
+ [% IF parent %]
+ [% IF (value > 0) %]
+ <span class="child_fund_amount" style="color: green;">
+ [% ELSIF (value < 0) %]
+ <span class="child_fund_amount" style="color: red;">
+ [% ELSE %]
+ <span class="child_fund_amount">
+ [% END %]
+ [% ELSE %]
+ [% IF (value > 0) %]
+ <span style="color: green;">
+ [% ELSIF (value < 0) %]
+ <span style="color: red;">
+ [% ELSE %]
+ <span>
+ [% END %]
+ [% END %]
+ [% text %]
+ </span>
[% END %]
- [% budge.budget_remaining %] </td>
-
- <td class="tooltipcontent">[% IF ( budge.budget_owner_id ) %]<strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budge.budget_owner_id %]">[% budge.budget_owner_name %]</a>[% END %]
- [% IF ( budge.budget_branchcode ) %]<br /><strong>Library: </strong>[% budge.budget_branchcode %][% END %]
- [% IF ( budge.budget_notes ) %]<br /><strong>Notes: </strong>[% budge.budget_notes %][% END %]
- [% IF ( budge.budget_hierarchy ) %]
- <ul class="budget_hierarchy">[% FOREACH budget_hierarch IN budge.budget_hierarchy %]
- [% IF ( budget_hierarch.element_id ) %]
- <li><a href="?op=add_form&budget_id=[% budget_hierarch.element_id %]&budget_period_id=[% budget_hierarch.budget_period_id %]">[% budget_hierarch.element_name %]</a></li>
- [% ELSE %]
- <li><strong>[% budget_hierarch.element_name %] : </strong></li>
- [% END %]
- [% END %]
- </ul>
- [% END %]</td>
- [% IF ( budge.budget_lock ) %]
+ <td class="data">
+ [% INCLUDE colorcellvalue value=budget.budget_remaining text=budget.budget_remaining_display parent=budget.budget_parent_id %]
+ </td>
+ <td class="data">
+ [% INCLUDE colorcellvalue value=budget.total_remaining text=budget.total_remaining_display parent=budget.budget_parent_id %]
+ </td>
+ [% IF ( budget.budget_lock ) %]
<td> <span style="color: gray;"> Edit Delete </span> </td>
[% ELSE %]
<td>
- <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budge.budget_id %]&budget_period_id=[% budge.budget_period_id %]" >Edit</a>
- <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&budget_id=[% budge.budget_id %]&budget_period_id=[% budge.budget_period_id %]">Delete</a>
- <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_parent_id=[% budge.budget_id %]&budget_period_id=[% budge.budget_period_id %]">Add child fund</a>
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget.budget_id %]&budget_period_id=[% budget.budget_period_id %]" >Edit</a>
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&budget_id=[% budget.budget_id %]&budget_period_id=[% budget.budget_period_id %]">Delete</a>
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_parent_id=[% budget.budget_id %]&budget_period_id=[% budget.budget_period_id %]">Add child fund</a>
</td>
[% END %]
</tr>
No fund found
[% END %]
-[% IF ( pagination_bar ) %]<div class="pages">[% pagination_bar %]</div>[% END %]
-[% END %] <!-- else -->
+[% END %] <!-- list -->
<!-- ********************************************************************************************** -->
<!-- create add/mod entry form -->
-[% IF ( add_form && !error_not_authorised_to_modify ) %]
+[% IF op == 'add_form' && !error_not_authorised_to_modify %]
<form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
<fieldset class="rows">
<legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
<input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount %]" size="8" />
</li>
- <li style="display:none;">
- <label for="budget_encumb">Encumbrance: </label>
- <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="8" />
+ <li>
+ <label for="budget_encumb">Warning at (%): </label>
+ <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
+ <span style="color:grey">0 to disable</span>
</li>
- <li style="display:none;">
- <label for="budget_expend">Expenditure: </label>
- <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend %]" size="8" />
+ <li>
+ <label for="budget_expend">Warning at (amount): </label>
+ <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend %]" size="10" /><input type="hidden" name="budget_owner_id" id="budget_owner_id" value="[% budget_owner_id %]" />
+ <span style="color:grey">0 to disable</span>
</li>
<li>
[% END %] <!-- add_form -->
-[% IF ( delete_confirm ) %]
+[% IF op == 'delete_confirm' %]
<div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
<table>
<tr>
</tr>
</table>
-<form action="[% action %]" method="post">
+<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="budget_id" value="[% budget_id %]" />
<input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
<input type="submit" value="Delete" class="approve" />
</form>
-<form action="[% action %]" method="get">
+<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
<input type="submit" class="deny" value="Cancel" />
</form>
</div>
</div>
</div>
<div class="yui-b">
-[% IF ( else ) %]<form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
+[% IF op == 'list' %]
+ <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
<a href="#" id="filterbutton">Filters</a>
<fieldset class="brief" id="fundfilters">
<h4>Fund filters</h4>
<input type="checkbox" id="show_mine" name="show_mine" value="1" />
[% END %]
</li>
+
+ [% IF periods %]
+ <li>
+ <label for="periods">Budget:</label>
+ <select id="periods" name="budget_period_id">
+ <option value="">All budgets</option>
+ [% FOR period IN periods %]
+ [% IF budget_period_id && period.budget_period_id == budget_period_id %]
+ <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
+ [% ELSE %]
+ <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [% END %]
</ol>
- <input type="hidden" name="show" value="1" />
- <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
+ <input type="hidden" name="op" value="list" />
<input type="submit" class="submit" name="filter" value="Go" />
</fieldset>
</form>[% END %]