1 [% INCLUDE 'doc-head-open.inc' %]
2 <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>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript">
6 var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
7 var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
8 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
12 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
13 [% IF op == 'add_form' %]
14 <script type="text/javascript">
17 function userPopup() {
18 window.open("/cgi-bin/koha/admin/aqbudget_user_search.pl?type=user",
20 'width=740,height=450,location=yes,toolbar=no,'
21 + 'scrollbars=yes,resize=yes'
25 function ownerPopup() {
26 window.open("/cgi-bin/koha/admin/aqbudget_user_search.pl?type=owner",
28 'width=740,height=450,location=yes,toolbar=no,'
29 + 'scrollbars=yes,resize=yes'
33 function edit_owner(borrowernumber, surname, firstname) {
34 $('#budget_owner_name').empty();
35 $('#budget_owner_id').val('');
37 var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
38 + '?borrowernumber=' + borrowernumber + '">'
39 + firstname + ' ' + surname + '</a>';
40 $('#budget_owner_name').html(ownerlink);
41 $('#budget_owner_id').val(borrowernumber);
45 function ownerRemove() {
49 function add_user(borrowernumber, surname, firstname) {
50 var ids = $("#budget_users_id").val().split(':');
51 if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
52 var li = '<li id="user_' + borrowernumber + '">'
53 + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
54 + borrowernumber + '">' + firstname + ' ' + surname
55 + '</a> [<a style="cursor:pointer"'
56 + 'onclick="del_user(' + borrowernumber +')">Remove</a>]</li>';
57 $(li).insertBefore("li#add_user_button");
58 ids.push(borrowernumber);
59 $("#budget_users_id").val(ids.join(':'));
66 function del_user(borrowernumber) {
67 var ids = $("#budget_users_id").val().split(':');
69 var idx = ids.indexOf(borrowernumber+'');
72 $("#budget_users_id").val(ids.join(':'));
73 $("li#user_" + borrowernumber).remove();
83 if (!(isNotNull(f.budget_code,1))) {
84 _alertString += _("- Budget code cannot be blank") + "\n";
87 if (!(isNotNull(f.budget_name,1))) {
88 _alertString += _("- Budget name cannot be blank") + "\n";
91 if (!(isNotNull(f.budget_amount,1))) {
92 _alertString += _("- Budget amount cannot be blank") + "\n";
96 if (typeof(f.budget_id ) != "undefined") {
97 budgetId = f.budget_id.value
102 // hack to test if selected parent_id in scrolling-list...
103 // if value == 'undef' its got a selected_parent :/
104 if(f.budget_parent_id){
105 var chkAdd = f.budget_parent_id.value ;
106 if ( typeof(chkAdd ) != "undefined") {
107 newBudgetParent = f.budget_parent_id.value
109 newBudgetParent = f.budget_parent_id.item(0).value
112 if (budgetId > 0) { ; //its a mod ...
113 // if parent == curent-budget, fail...
114 if ( newBudgetParent == budgetId ) {
115 _alertString += _("- Budget parent is current budget") + "\n";
118 else if (newBudgetParent) {
119 var result = checkBudgetParent( budgetId , newBudgetParent );
121 _alertString += result;
128 var budgetTotal = Math.abs(f.budget_amount.value);
129 var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
131 _alertString += result;
134 if (_alertString.length==0) {
135 document.Aform.submit();
137 alertString2 = _("Form not submitted because of the following problem(s)");
138 alertString2 += "\n------------------------------------------------------------------------------------\n\n";
139 alertString2 += _alertString;
145 [% ELSIF op == 'list' %]
146 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
147 [% INCLUDE 'datatables.inc' %]
148 <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
149 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
151 <script type="text/javascript">
154 $(document).ready(function() {
155 var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
156 "fnDrawCallback": function ( oSettings ) {
157 if ( oSettings.aiDisplay.length == 0 )
162 var nTrs = $('#budgeth tbody tr');
163 var iColspan = nTrs[0].getElementsByTagName('td').length;
165 for ( var i=0 ; i<nTrs.length ; i++ )
167 var iDisplayIndex = oSettings._iDisplayStart + i;
168 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
169 if ( sGroup != sLastGroup )
171 var nGroup = document.createElement( 'tr' );
172 var nCell = document.createElement( 'td' );
173 nCell.colSpan = iColspan;
174 nCell.className = "group";
175 nCell.innerHTML = sGroup;
176 nGroup.appendChild( nCell );
177 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
183 { "bVisible": false, "aTargets": [ 0, 1 ] },
184 { "bSortable": false, "aTargets": ["_all"] }
187 'aaSortingFixed': [[ 1, 'asc' ]],
192 $(oTable).treetable({
195 $(oTable).treetable('expandAll');
196 $("#expand_all").click(function(e){
198 $(oTable).treetable('expandAll');
200 $("#collapse_all").click(function(e){
202 $(oTable).treetable('collapseAll');
205 [% UNLESS budget_period_id %]
206 $("#hide_inactive").click(function(e){
208 oTable.fnFilter( 1, 0 ); // Show only active=1
210 $("#show_inactive").click(function(e){
212 oTable.fnFilter( '', 0 );
214 $("#hide_inactive").click();
217 $("#filterbutton").click(function() {
218 $("#fundfilters").slideToggle(0);
226 <body id="admin_aqbudgets" class="admin">
227 [% INCLUDE 'header.inc' %]
228 [% INCLUDE 'budgets-admin-search.inc' %]
230 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
231 <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 %]
232 [% IF op == 'add_form' %]
233 <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 %]
235 [% IF op == 'delete_confirm' %]
236 <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> › Delete fund?
240 <div id="doc3" class="yui-t2">
243 <div class="yui-b" id="content">
246 [% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
248 [% IF (error_not_authorised_to_modify) %]
250 <p>You are not authorized to modify this fund</p>
254 [% IF op == 'list' %]
257 [% IF budget_period_id %]
258 Funds for '[% budget_period_description %]'
264 [% INCLUDE 'budgets-active-currency.inc' %]
269 [% UNLESS budget_period_id %]
271 <span class="actions"><a href="#" id="expand_all">Expand all</a>
272 | <a href="#" id="collapse_all">Collapse all</a>
273 | <a href="#" id="hide_inactive">Hide inactive budgets</a>
274 | <a href="#" id="show_inactive">Show inactive budgets</a></span>
280 <th>Budget period description</th>
283 <th>Base-level allocated</th>
284 <th>Base-level ordered</th>
285 <th>Total ordered</th>
286 <th>Base-level spent</th>
288 <th>Base-level available</th>
289 <th>Total available</th>
297 <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF ( budget_period_total ) %][% budget_period_total %][% END %] </th>
298 <th nowrap="nowrap" class="data"> [% period_alloc_total %]</th>
300 <th class="data">[% ordered_total %]</th>
302 <th class="data">[% spent_total %]</th>
304 <th class="data">[% available_total %]</th>
309 [% FOREACH budget IN budgets %]
310 [% IF budget.budget_parent_id %]
311 <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
313 <tr data-tt-id="[% budget.budget_id %]">
315 <td>[% budget.budget_period_active %]</td>
316 <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
317 <td>[% budget.budget_code_indent %]</td>
318 <td>[% budget.budget_name %]</td>
320 [% IF budget.budget_parent_id %]
321 <span class="child_fund_amount">[% budget.budget_amount %]</span>
323 [% budget.budget_amount %]
327 [% IF budget.budget_parent_id %]
328 <span class="child_fund_amount">[% budget.budget_ordered %]</span>
330 [% budget.budget_ordered %]
334 [% IF budget.budget_parent_id %]
335 <span class="child_fund_amount">[% budget.total_ordered %]</span>
337 [% budget.total_ordered %]
341 [% IF budget.budget_parent_id %]
342 <span class="child_fund_amount">[% budget.budget_spent %]</span>
344 [% budget.budget_spent %]
348 [% IF budget.budget_parent_id %]
349 <span class="child_fund_amount">[% budget.total_spent %]</span>
351 [% budget.total_spent %]
356 [% BLOCK colorcellvalue %]
359 <span class="child_fund_amount" style="color: green;">
360 [% ELSIF (value < 0) %]
361 <span class="child_fund_amount" style="color: red;">
363 <span class="child_fund_amount">
367 <span style="color: green;">
368 [% ELSIF (value < 0) %]
369 <span style="color: red;">
378 [% INCLUDE colorcellvalue value=budget.budget_remaining text=budget.budget_remaining_display parent=budget.budget_parent_id %]
381 [% INCLUDE colorcellvalue value=budget.total_remaining text=budget.total_remaining_display parent=budget.budget_parent_id %]
383 [% IF ( budget.budget_lock ) %]
384 <td> <span style="color: gray;"> Edit Delete </span> </td>
387 <div class="dropdown dropup">
388 <a class="btn btn-mini dropdown-toggle" id="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
389 Actions <b class="caret"></b>
391 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
392 <li><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></li>
393 <li><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></li>
394 <li><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></li>
408 [% END %] <!-- list -->
410 <!-- ********************************************************************************************** -->
411 <!-- create add/mod entry form -->
412 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
413 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
414 <fieldset class="rows">
415 <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
416 [% IF ( budget_period_description ) %]
417 [% budget_name %] for Budget '[% budget_period_description %]'
421 <input type="hidden" name="op" value="add_validate" />
422 <input type="hidden" name="checked" value="0" />
424 [% IF ( budget_parent_id ) %]
426 <span class="label">Fund parent: </span>
427 [% budget_parent_name %]
428 [% budget_parent_id %] - [% budget_parent_name %]
429 <input type="hidden" name="budget_parent_id" value="[% budget_parent_id %]" />
433 <label class="required" for="budget_code">Fund code: </label>
434 <input type="text" name="budget_code" id="budget_code" value="[% budget_code %]" size="30" />
438 <label class="required" for="budget_name">Fund name: </label>
439 <input type="text" name="budget_name" id="budget_name" value="[% budget_name %]" size="60" />
443 <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
444 <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount %]" size="8" />
448 <label for="budget_encumb">Warning at (%): </label>
449 <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
450 <span style="color:grey">0 to disable</span>
454 <label for="budget_expend">Warning at (amount): </label>
455 <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend %]" size="10" />
456 <span style="color:grey">0 to disable</span>
460 <span class="label">Owner: </span>
461 <span id="budget_owner_name">
462 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
463 [% budget_owner_name %]
466 <input type="hidden" name="budget_owner_id" id="budget_owner_id"
467 value="[% budget_owner_id %]" />
469 <!-- FIXME: hardcoded button positions :/ -->
470 <input type="button" id="edit_owner" value="Edit owner"
471 onclick="ownerPopup(); return false;" />
472 <input type="button" id="remove_owner" value="Remove owner"
473 onclick="ownerRemove(); return false;" />
477 <span class="label">Users:</span>
478 <ul style="float:left;" id="budget_users">
479 [% FOREACH user IN budget_users %]
480 <li id="user_[% user.borrowernumber %]">
481 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
482 [% user.firstname %] [% user.surname %]
484 [<a style="cursor:pointer"
485 onclick="del_user([% user.borrowernumber %])">Remove</a>]
488 <li id="add_user_button">
489 <input type="button" onclick="userPopup()" value="Add users" />
492 <input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
494 <label for="budget_branchcode">Library: </label>
495 <select name="budget_branchcode" id="budget_branchcode">
496 <option value=""></option>
497 [% FOREACH branchloop_selec IN branchloop_select %]
498 [% UNLESS ( branchloop_selec.selected ) %] <option value="[% branchloop_selec.value %]" > [% ELSE %] <option value="[% branchloop_selec.value %]" selected="selected"> [% END %] [% branchloop_selec.value %]-[% branchloop_selec.branchname %]</option>
504 <label for="budget_permission">Restrict access to: </label>
505 <select name="budget_permission" id="budget_permission">
506 [% IF ( budget_perm_0 ) %]
507 <option value="0" selected="selected">
514 [% IF ( budget_perm_1 ) %]
515 <option value="1" selected="selected">
522 [% IF ( budget_perm_3) %]
523 <option value="3" selected="selected">
530 [% IF ( budget_perm_2 ) %]
531 <option value="2" selected="selected">
535 Owner, users and library
541 <label for="budget_notes">Notes: </label>
542 <textarea name="budget_notes" id="budget_notes" cols="80" rows="6">[% budget_notes %]</textarea>
546 <label style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
547 <select name="sort1_authcat" id="authorised_value_category1">
548 <option value=""></option>
549 [% FOREACH authorised_value_categories IN authorised_value_categories1 %]
550 [% IF ( authorised_value_categories.selected ) %]
551 <option value="[% authorised_value_categories.category %]" selected="selected">
552 [% authorised_value_categories.category %]
555 <option value="[% authorised_value_categories.category %]">
556 [% authorised_value_categories.category %]
563 <label style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
564 <select name="sort2_authcat" id="authorised_value_category2">
565 <option value=""></option>
566 [% FOREACH authorised_value_categories IN authorised_value_categories2 %]
567 [% IF ( authorised_value_categories.selected ) %]
568 <option value="[% authorised_value_categories.category %]" selected="selected">
569 [% authorised_value_categories.category %]
572 <option value="[% authorised_value_categories.category %]">
573 [% authorised_value_categories.category %]
581 [% IF ( budget_id ) %]
582 <input type="hidden" name="budget_id" value="[% budget_id %]" />
586 <fieldset class="action">
587 <input type="submit" value="Submit" onclick="Check(this.form); return false;" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
588 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
592 [% END %] <!-- add_form -->
594 [% IF op == 'delete_confirm' %]
595 <div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
598 <th scope="row">Fund amount:</th>
599 <td>[% budget_amount %]</td>
603 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
604 <input type="hidden" name="op" value="delete_confirmed" />
605 <input type="hidden" name="budget_id" value="[% budget_id %]" />
606 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
607 <input type="submit" value="Delete" class="approve" />
610 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
611 <input type="submit" class="deny" value="Cancel" />
619 [% IF op == 'list' %]
620 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
621 <a href="#" id="filterbutton">Filters</a>
622 <fieldset class="brief" id="fundfilters">
623 <h4>Fund filters</h4>
626 <label for="filter_budgetbranch2">Library: </label>
627 <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
628 <option value=""></option>
629 [% FOREACH branchloo IN branchloop %]
630 [% UNLESS ( branchloo.selected ) %]<option value="[% branchloo.value %]">
631 [% ELSE %]<option value="[% branchloo.value %]" selected="selected">[% END %]
632 [% branchloo.branchname %]</option>
638 <label for="show_mine">Show my funds only</label>
639 [% IF ( show_mine ) %]
640 <input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
642 <input type="checkbox" id="show_mine" name="show_mine" value="1" />
648 <label for="periods">Budget:</label>
649 <select id="periods" name="budget_period_id">
650 <option value="">All budgets</option>
651 [% FOR period IN periods %]
652 [% IF budget_period_id && period.budget_period_id == budget_period_id %]
653 <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
655 <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
663 <input type="hidden" name="op" value="list" />
664 <input type="submit" class="submit" name="filter" value="Go" />
667 [% INCLUDE 'acquisitions-menu.inc' %]
670 [% INCLUDE 'intranet-bottom.inc' %]