+[% USE Price %]
+[% USE Branches %]
+[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Acquisitions</title>
[% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript">
-//<![CDATA[
-$(document).ready(function() {
- $('#showallbudgets').click(function() {
- if ( $('#showallbudgets:checked').val() !== undefined) {
- $('.b_inactive').show();
- $('#b_inactive').show();
- $('.bu_active').show();
- $('.bu_inactive').hide();
- }
- else {
- $('.b_inactive').hide();
- $('#b_inactive').hide();
- $('.bu_inactive').show();
- $('.bu_active').hide();
- }
- });
-});
-//]]>
-</script>
-
+<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables_[% KOHA_VERSION %].css" />
+<link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable_[% KOHA_VERSION %].css" rel="stylesheet" type="text/css" />
</head>
+
<body id="acq_acqui-home" 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> › </div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Acquisitions</div>
<div id="doc3" class="yui-t2">
[% INCLUDE 'acquisitions-toolbar.inc' %]
<h1>Acquisitions</h1>
-<div class="yui-g">
-<div class="yui-u first">
-<div id="acqui_acqui_home_order">
-
+ [% INCLUDE 'budgets-active-currency.inc' hide = 'yes' %]
[% UNLESS ( loop_budget ) %]
- [% IF ( CAN_user_parameters ) %]
- <div class="dialog alert">You must <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">define a budget</a> in Administration</div>
+ [% IF ( CAN_user_acquisition_period_manage ) %]
+ <div class="dialog alert"><a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">You must define a budget in Administration</a></div>
[% ELSE %]
<div class="dialog alert">Your administrator must define a budget in Administration</div>
[% END %]
[% END %]
-
+<div class="yui-g">
+<div class="yui-u first">
+<div id="acqui_acqui_home_order">
<fieldset>
<legend>Manage orders</legend>
<form name="findsupplier" action="/cgi-bin/koha/acqui/booksellers.pl" method="post">
</form>
</fieldset>
</div>
-
-[% IF ( suggestion ) %][% IF ( suggestions_count ) %]
-<div id="acqui_acqui_home_suggestions">
- <fieldset>
- <legend>Pending suggestions</legend>
- <p>[% suggestions_count %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl">Manage suggestions</a>.</p>
- </fieldset>
-</div>[% END %][% END %]
-
</div>
+[% IF ( suggestion && suggestions_count ) %]
<div class="yui-u">
+ <div id="acqui_acqui_home_suggestions">
+ <fieldset>
+ <legend>Pending suggestions</legend>
+ <p>[% suggestions_count %] suggestions waiting. <a href="/cgi-bin/koha/suggestion/suggestion.pl#ASKED">Manage suggestions</a>.</p>
+ </fieldset>
+ </div>
+</div>
+[% END %]
- [% IF ( loop_budget ) %]
-
- <h3>All available funds[% IF ( branchname ) %] for [% branchname %] library[% END %]</h3>
-
- <!-- <a href="/cgi-bin/koha/admin/aqbookfund.pl" title="[ Manage funds ]">[ Manage ]</a>
- <a href="/cgi-bin/koha/admin/budgetperiods.pl">manage budgets</a><br><br> -->
+</div>
+[% IF ( loop_budget ) %]
+ <h3>All available funds[% IF LoginBranchname %] for [% LoginBranchname %][% END %]</h3>
<div id="BudgetsAndFunds">
<table id="accounts">
+ <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>
+
<thead>
<tr>
- <th>Fund</th>
+ <th>Active</th>
+ <th>Budget period description</th>
+ <th>Fund code</th>
+ <th>Fund name</th>
<th>Owner</th>
<th>Library</th>
<th>Amount</th>
<th>Ordered</th>
<th>Spent</th>
- <th>Avail</th>
+ <th>Total available</th>
</tr>
</thead>
<tfoot id="funds_total">
<tr>
- <th>Total</th>
- <th> </th>
- <th> </th>
- <th align="right" ><span class="bu_active" style="display : none;">[% total %]</span><span class="bu_inactive" >[% total_active %]</span></th>
- <th align="right" ><span class="bu_active" style="display : none;">[% totordered %]</span><span class="bu_inactive" >[% totordered_active %]</span></th>
- <th align="right" ><span class="bu_active" style="display : none;">[% totspent %]</span><span class="bu_inactive" >[% totspent_active %]</span></th>
- <th align="right" ><span class="bu_active" style="display : none;">[% totavail %]</span><span class="bu_inactive" >[% totavail_active %]</span></th>
+ <th></th>
+ <th></th>
+ <th colspan="4">Total</th>
+ <th class="data"></th>
+ <th class="data"></th>
+ <th class="data"></th>
+ <th class="data"></th>
</tr>
</tfoot>
<tbody>
[% FOREACH loop_budge IN loop_budget %]
- [% IF ( loop_budge.budget_period_active ) %]
- [% IF ( loop.odd ) %]
- <tr>
+ [% IF loop_budge.budget_parent_id %]
+ <tr data-tt-id="[% loop_budge.budget_id %]" data-tt-parent-id="[% loop_budge.budget_parent_id %]">
[% ELSE %]
- <tr class="highlight">
+ <tr data-tt-id="[% loop_budge.budget_id %]">
[% END %]
- <td align="center">[% loop_budge.budget_code %]</td>
- <td align="center">[% loop_budge.budget_owner %]</td>
- <td align="center">[% loop_budge.budget_branchname %]</td>
- <td align="right" >[% loop_budge.budget_amount %]</td>
- <td align="right" ><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered %]</a></td>
- <td align="right" ><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent %]</a></td>
- <td align="right" >[% loop_budge.budget_avail %]</td>
+
+ <td>[% loop_budge.budget_period_active %]</td>
+ <td>Budget [% loop_budge.budget_period_description %] [id=[% loop_budge.budget_period_id %]][% UNLESS loop_budge.budget_period_active %] (inactive)[% END %]</td>
+ <td>
+ [% IF ( CAN_user_acquisition_budget_manage ) %]
+ <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% loop_budge.budget_period_id %]">[% loop_budge.budget_code %]</a>
+ [% ELSE %]
+ [% loop_budge.budget_code %]
+ [% END %]
+ </td>
+ <td>[% loop_budge.budget_name %]</td>
+ <td>[% IF ( loop_budge.budget_owner ) %]
+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% loop_budge.budget_owner.borrowernumber %]">[% loop_budge.budget_owner.surname %], [% loop_budge.budget_owner.firstname %]</a>
+ [% ELSE %]
+
+ [% END %]
+ </td>
+ <td>[% Branches.GetName( loop_budge.budget_branchcode ) %]</td>
+ <td class="data">
+ [% IF loop_budge.budget_parent_id %]
+ [% loop_budge.budget_amount | $Price %]
+ [% ELSE %]
+ <span class="total_amount">[% loop_budge.budget_amount | $Price %]</span>
+ [% END %]
+ </td>
+ <td class="data">
+ <a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">
+ [% IF loop_budge.budget_parent_id %]
+ [% loop_budge.budget_ordered | $Price %]
+ [% ELSE %]
+ <span class="total_amount">[% loop_budge.budget_ordered | $Price %]</span>
+ [% END %]
+ </a>
+ </td>
+ <td class="data">
+ <a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">
+ [% IF loop_budge.budget_parent_id %]
+ [% loop_budge.budget_spent | $Price %]
+ [% ELSE %]
+ <span class="total_amount">[% loop_budge.budget_spent | $Price %]</span>
+ [% END %]
+ </a>
+ </td>
+ <td class="data">
+ [% IF loop_budge.budget_parent_id %]
+ [% loop_budge.budget_avail | $Price %]
+ [% ELSE %]
+ <span class="total_amount">[% loop_budge.budget_avail | $Price %]</span>
+ [% END %]
+ </td>
</tr>
- [% ELSE %]
- [% IF ( loop.odd ) %]
- <tr class="b_inactive" style="display : none;">
- [% ELSE %]
- <tr class="highlight" id = "b_inactive" style="display : none;">
- [% END %]
- <td align="center" >[% loop_budge.budget_code %]</td>
- <td align="center">[% loop_budge.budget_owner %]</td>
- <td align="center">[% loop_budge.budget_branchname %]</td>
- <td align="right" >[% loop_budge.budget_amount %]</td>
- <td align="right" ><a href="ordered.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_ordered %]</a></td>
- <td align="right" ><a href="spent.pl?fund=[% loop_budge.budget_id %]&fund_code=[% loop_budge.budget_code %]">[% loop_budge.budget_spent %]</a></td>
- <td align="right" >[% loop_budge.budget_avail %]</td>
- [% END %]
[% END %]
</tbody>
</table>
- </div><span class="label">Show all : </span><input type="checkbox" id="showallbudgets" />
+ </div>
[% END %]
-</div>
-</div>
</div>
</div>
<div class="yui-b">
[% INCLUDE 'acquisitions-menu.inc' %]
</div>
</div>
+
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'datatables.inc' %]
+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable_[% KOHA_VERSION %].js"></script>
+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/acquisitions-menu_[% KOHA_VERSION %].js"></script>
+ <script type="text/javascript">
+ dt_overwrite_html_sorting_localeCompare();
+
+ $(document).ready(function() {
+
+ var oTable = $("#accounts").dataTable($.extend(true, {}, dataTablesDefaults, {
+ "fnDrawCallback": function ( oSettings ) {
+ if ( oSettings.aiDisplay.length == 0 )
+ {
+ return;
+ }
+
+ var nTrs = $('#accounts 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;
+ }
+ }
+ },
+ "footerCallback": function ( row, data, start, end, display ) {
+ var api = this.api(), data;
+ footer_column_sum( api, [ 6, 7, 8, 9 ] );
+ },
+ "aoColumnDefs": [
+ { "bVisible": false, "aTargets": [ 0, 1 ] },
+ { "bSortable": false, "aTargets": ["_all"] }
+ ],
+ 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
+ 'bSort': true,
+ 'aaSortingFixed': [[ 1, 'asc' ]],
+ 'bPaginate': false,
+ "bAutoWidth": false
+ }));
+
+ $(oTable).treetable({
+ expandable: true
+ });
+ $(oTable).treetable('expandAll');
+ $("#expand_all").click(function(e){
+ e.preventDefault();
+ $(oTable).treetable('expandAll');
+ });
+ $("#collapse_all").click(function(e){
+ e.preventDefault();
+ $(oTable).treetable('collapseAll');
+ });
+
+ $("#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();
+
+ });
+ </script>
+[% END %]
+
[% INCLUDE 'intranet-bottom.inc' %]