2 [% INCLUDE 'doc-head-open.inc' %]
3 <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>
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript">
7 var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
8 var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
9 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
13 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
14 [% IF op == 'add_form' %]
15 <script type="text/javascript">
18 function userPopup() {
19 window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
21 'width=740,height=450,location=yes,toolbar=no,'
22 + 'scrollbars=yes,resize=yes'
26 function ownerPopup() {
27 window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
29 'width=740,height=450,location=yes,toolbar=no,'
30 + 'scrollbars=yes,resize=yes'
34 function select_user(borrowernumber, borrower) {
36 var borrowername = borrower.firstname + ' ' + borrower.surname
38 var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
39 + '?borrowernumber=' + borrowernumber + '">'
40 + borrowername + '</a>';
41 $('#budget_owner_name').html(ownerlink);
42 $('#budget_owner_id').val(borrowernumber);
46 function ownerRemove() {
47 $('#budget_owner_name').empty();
48 $('#budget_owner_id').val('');
51 function add_user(borrowernumber, borrowername) {
52 var ids = $("#budget_users_id").val().split(':');
53 if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
54 var li = '<li id="user_' + borrowernumber + '">'
55 + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
56 + borrowernumber + '">' + borrowername
57 + '</a> [<a style="cursor:pointer"'
58 + 'onclick="del_user(' + borrowernumber +')">Remove</a>]</li>';
59 $(li).insertBefore("li#add_user_button");
60 ids.push(borrowernumber);
61 $("#budget_users_id").val(ids.join(':'));
68 function del_user(borrowernumber) {
69 var ids = $("#budget_users_id").val().split(':');
71 var idx = ids.indexOf(borrowernumber+'');
74 $("#budget_users_id").val(ids.join(':'));
75 $("li#user_" + borrowernumber).remove();
85 if (!(isNotNull(f.budget_code,1))) {
86 _alertString += _("- Budget code cannot be blank") + "\n";
89 if (!(isNotNull(f.budget_name,1))) {
90 _alertString += _("- Budget name cannot be blank") + "\n";
93 if (!(isNotNull(f.budget_amount,1))) {
94 _alertString += _("- Budget amount cannot be blank") + "\n";
98 if (typeof(f.budget_id ) != "undefined") {
99 budgetId = f.budget_id.value
104 // hack to test if selected parent_id in scrolling-list...
105 // if value == 'undef' its got a selected_parent :/
106 if(f.budget_parent_id){
107 var chkAdd = f.budget_parent_id.value ;
108 if ( typeof(chkAdd ) != "undefined") {
109 newBudgetParent = f.budget_parent_id.value
111 newBudgetParent = f.budget_parent_id.item(0).value
114 if (budgetId > 0) { ; //its a mod ...
115 // if parent == curent-budget, fail...
116 if ( newBudgetParent == budgetId ) {
117 _alertString += _("- Budget parent is current budget") + "\n";
120 else if (newBudgetParent) {
121 var result = checkBudgetParent( budgetId , newBudgetParent );
123 _alertString += result;
130 var budgetTotal = Math.abs(f.budget_amount.value);
131 var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
133 _alertString += result;
136 if (_alertString.length==0) {
137 document.Aform.submit();
139 alertString2 = _("Form not submitted because of the following problem(s)");
140 alertString2 += "\n------------------------------------------------------------------------------------\n\n";
141 alertString2 += _alertString;
147 [% ELSIF op == 'list' %]
148 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
149 [% INCLUDE 'datatables.inc' %]
150 <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
151 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
153 <script type="text/javascript">
156 $(document).ready(function() {
159 var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
160 "fnDrawCallback": function ( oSettings ) {
161 if ( oSettings.aiDisplay.length == 0 )
166 var nTrs = $('#budgeth tbody tr');
167 var iColspan = nTrs[0].getElementsByTagName('td').length;
169 for ( var i=0 ; i<nTrs.length ; i++ )
171 var iDisplayIndex = oSettings._iDisplayStart + i;
172 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
173 if ( sGroup != sLastGroup )
175 var nGroup = document.createElement( 'tr' );
176 var nCell = document.createElement( 'td' );
177 nCell.colSpan = iColspan;
178 nCell.className = "group";
179 nCell.innerHTML = sGroup;
180 nGroup.appendChild( nCell );
181 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
186 "footerCallback": function ( row, data, start, end, display ) {
187 var api = this.api(), data;
188 footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
191 { "bVisible": false, "aTargets": [ 0, 1 ] },
192 { "bSortable": false, "aTargets": ["_all"] }
195 'aaSortingFixed': [[ 1, 'asc' ]],
200 $(oTable).treetable({
203 $(oTable).treetable('expandAll');
204 $("#expand_all").click(function(e){
206 $(oTable).treetable('expandAll');
208 $("#collapse_all").click(function(e){
210 $(oTable).treetable('collapseAll');
213 [% UNLESS budget_period_id %]
214 $("#hide_inactive").click(function(e){
216 oTable.fnFilter( 1, 0 ); // Show only active=1
218 $("#show_inactive").click(function(e){
220 oTable.fnFilter( '', 0 );
222 $("#hide_inactive").click();
224 oTable.fnAddFilters("filter", 750);
226 $("#filterbutton").click(function() {
227 $("#fundfilters").slideToggle(0);
230 $(".deletefund-disabled").on("click", function(e){
232 alert("This fund has children. It cannot be deleted.");
240 <body id="admin_aqbudgets" class="admin">
241 [% INCLUDE 'header.inc' %]
242 [% INCLUDE 'budgets-admin-search.inc' %]
244 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
245 <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 %]
246 [% IF op == 'add_form' %]
247 <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 %]
249 [% IF op == 'delete_confirm' %]
250 <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> › Delete fund?
254 <div id="doc3" class="yui-t2">
257 <div class="yui-b" id="content">
260 [% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
262 [% IF (error_not_authorised_to_modify) %]
264 <p>You are not authorized to modify this fund</p>
268 [% IF op == 'list' %]
271 [% IF budget_period_id %]
272 Funds for '[% budget_period_description %]'
278 [% INCLUDE 'budgets-active-currency.inc' %]
282 <table id="budgeth" class="group">
283 [% UNLESS budget_period_id %]
285 <span class="actions"><a href="#" id="expand_all">Expand all</a>
286 | <a href="#" id="collapse_all">Collapse all</a>
287 | <a href="#" id="hide_inactive">Hide inactive budgets</a>
288 | <a href="#" id="show_inactive">Show inactive budgets</a></span>
294 <th>Budget period description</th>
297 <th>Base-level allocated</th>
298 <th>Base-level ordered</th>
299 <th>Total ordered</th>
300 <th>Base-level spent</th>
302 <th>Base-level available</th>
303 <th>Total available</th>
311 <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price %][% END %] </th>
312 <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price %]</th>
314 <th class="data">[% ordered_total | $Price %]</th>
316 <th class="data">[% spent_total | $Price %]</th>
318 <th class="data">[% available_total | $Price %]</th>
323 [% FOREACH budget IN budgets %]
324 [% IF budget.budget_parent_id %]
325 <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
327 <tr data-tt-id="[% budget.budget_id %]">
329 <td>[% budget.budget_period_active %]</td>
330 <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
331 <td>[% budget.budget_code %]</td>
332 <td>[% budget.budget_name %]</td>
334 [% IF budget.budget_parent_id %]
335 <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span>
337 <span class="total_amount">[% budget.budget_amount | $Price %]</span>
341 [% IF budget.budget_parent_id %]
342 <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
344 <span class="total_amount">[% budget.budget_ordered | $Price %]</span>
348 [% IF budget.budget_parent_id %]
349 <span class="child_fund_amount">[% budget.total_ordered | $Price %]</span>
351 <span class="total_amount">[% budget.total_ordered | $Price %]</span>
355 [% IF budget.budget_parent_id %]
356 <span class="child_fund_amount">[% budget.budget_spent | $Price %]</span>
358 <span class="total_amount">[% budget.budget_spent | $Price %]</span>
362 [% IF budget.budget_parent_id %]
363 <span class="child_fund_amount">[% budget.total_spent | $Price %]</span>
365 <span class="total_amount">[% budget.total_spent | $Price %]</span>
370 [% BLOCK colorcellvalue %]
373 <span class="child_fund_amount" style="color: green;">
374 [% ELSIF (value < 0) %]
375 <span class="child_fund_amount" style="color: red;">
377 <span class="child_fund_amount">
381 <span class="total_amount" style="color: green;">
382 [% ELSIF (value < 0) %]
383 <span class="total_amount" style="color: red;">
385 <span class="totalamount">
392 [% INCLUDE colorcellvalue value=budget.budget_remaining parent=budget.budget_parent_id %]
395 [% INCLUDE colorcellvalue value=budget.total_remaining parent=budget.budget_parent_id %]
397 [% IF ( budget.budget_lock ) %]
398 <td> <span></span> </td>
401 <div class="dropdown dropup">
402 <a class="btn btn-mini dropdown-toggle" id="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
403 Actions <b class="caret"></b>
405 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
406 <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>
407 [% IF budget.budget_has_children %]
408 <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children">Delete</a></li>
410 <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>
412 <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>
426 [% END %] <!-- list -->
428 <!-- ********************************************************************************************** -->
429 <!-- create add/mod entry form -->
430 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
431 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
432 <fieldset class="rows">
433 <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
434 [% IF ( budget_period_description ) %]
435 [% budget_name %] for Budget '[% budget_period_description %]'
439 <input type="hidden" name="op" value="add_validate" />
440 <input type="hidden" name="checked" value="0" />
442 [% IF ( budget_parent_id ) %]
444 <span class="label">Fund parent: </span>
445 [% budget_parent_name %]
446 [% budget_parent_id %] - [% budget_parent_name %]
447 <input type="hidden" name="budget_parent_id" value="[% budget_parent_id %]" />
451 <label class="required" for="budget_code">Fund code: </label>
452 <input type="text" name="budget_code" id="budget_code" value="[% budget_code %]" size="30" />
456 <label class="required" for="budget_name">Fund name: </label>
457 <input type="text" name="budget_name" id="budget_name" value="[% budget_name %]" size="60" />
461 <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
462 <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
466 <label for="budget_encumb">Warning at (%): </label>
467 <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
468 <span class="hint">0 to disable</span>
472 <label for="budget_expend">Warning at (amount): </label>
473 <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
474 <span class="hint">0 to disable</span>
478 <span class="label">Owner: </span>
479 <span id="budget_owner_name">
480 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
481 [% budget_owner_name %]
484 <input type="hidden" name="budget_owner_id" id="budget_owner_id"
485 value="[% budget_owner_id %]" />
487 <input type="button" id="edit_owner" value="Edit owner"
488 onclick="ownerPopup(); return false;" />
489 <input type="button" id="remove_owner" value="Remove owner"
490 onclick="ownerRemove(); return false;" />
493 [% IF budget_has_children %]
496 <input type="checkbox" id="set_owner_to_children" name="set_owner_to_children" value="1" />
497 Update all child funds with this owner
499 <span class="hint">Selecting this option will overwrite existing fund owners, if any</span>
504 <span class="label">Users:</span>
505 <ul style="float:left;" id="budget_users">
506 [% FOREACH user IN budget_users %]
507 <li id="user_[% user.borrowernumber %]">
508 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
509 [% user.firstname %] [% user.surname %]
511 [<a style="cursor:pointer"
512 onclick="del_user([% user.borrowernumber %])">Remove</a>]
515 <li id="add_user_button">
516 <input type="button" onclick="userPopup()" value="Add users" />
519 <input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
521 <label for="budget_branchcode">Library: </label>
522 <select name="budget_branchcode" id="budget_branchcode">
523 <option value=""></option>
524 [% FOREACH branchloop_selec IN branchloop_select %]
525 [% 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>
531 <label for="budget_permission">Restrict access to: </label>
532 <select name="budget_permission" id="budget_permission">
533 [% IF ( budget_perm_0 ) %]
534 <option value="0" selected="selected">
541 [% IF ( budget_perm_1 ) %]
542 <option value="1" selected="selected">
549 [% IF ( budget_perm_3) %]
550 <option value="3" selected="selected">
557 [% IF ( budget_perm_2 ) %]
558 <option value="2" selected="selected">
562 Owner, users and library
568 <label for="budget_notes">Notes: </label>
569 <textarea name="budget_notes" id="budget_notes" cols="80" rows="6">[% budget_notes %]</textarea>
573 <label style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
574 <select name="sort1_authcat" id="authorised_value_category1">
575 <option value=""></option>
576 [% FOREACH authorised_value_categories IN authorised_value_categories1 %]
577 [% IF ( authorised_value_categories.selected ) %]
578 <option value="[% authorised_value_categories.category %]" selected="selected">
579 [% authorised_value_categories.category %]
582 <option value="[% authorised_value_categories.category %]">
583 [% authorised_value_categories.category %]
590 <label style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
591 <select name="sort2_authcat" id="authorised_value_category2">
592 <option value=""></option>
593 [% FOREACH authorised_value_categories IN authorised_value_categories2 %]
594 [% IF ( authorised_value_categories.selected ) %]
595 <option value="[% authorised_value_categories.category %]" selected="selected">
596 [% authorised_value_categories.category %]
599 <option value="[% authorised_value_categories.category %]">
600 [% authorised_value_categories.category %]
608 [% IF ( budget_id ) %]
609 <input type="hidden" name="budget_id" value="[% budget_id %]" />
613 <fieldset class="action">
614 <input type="submit" value="Submit" onclick="Check(this.form); return false;" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
615 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
619 [% END %] <!-- add_form -->
621 [% IF op == 'delete_confirm' %]
622 <div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
623 If you delete this fund, all orders linked to this fund will be deleted!
626 <th scope="row">Fund amount:</th>
627 <td>[% budget_amount | $Price %]</td>
631 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
632 <input type="hidden" name="op" value="delete_confirmed" />
633 <input type="hidden" name="budget_id" value="[% budget_id %]" />
634 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
635 <input type="submit" value="Delete" class="approve" />
638 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
639 <input type="submit" class="deny" value="Cancel" />
647 [% IF op == 'list' %]
648 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
649 <a href="#" id="filterbutton">Filters</a>
650 <fieldset class="brief" id="fundfilters">
651 <h4>Fund filters</h4>
654 <label for="filter_budgetbranch2">Library: </label>
655 <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
656 <option value=""></option>
657 [% FOREACH branchloo IN branchloop %]
658 [% UNLESS ( branchloo.selected ) %]<option value="[% branchloo.value %]">
659 [% ELSE %]<option value="[% branchloo.value %]" selected="selected">[% END %]
660 [% branchloo.branchname %]</option>
666 <label for="show_mine">Show my funds only</label>
667 [% IF ( show_mine ) %]
668 <input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
670 <input type="checkbox" id="show_mine" name="show_mine" value="1" />
676 <label for="periods">Budget:</label>
677 <select id="periods" name="budget_period_id">
678 <option value="">All budgets</option>
679 [% FOR period IN periods %]
680 [% IF budget_period_id && period.budget_period_id == budget_period_id %]
681 <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
683 <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
691 <input type="hidden" name="op" value="list" />
692 <input type="submit" class="submit" name="filter" value="Go" />
695 [% INCLUDE 'acquisitions-menu.inc' %]
698 [% INCLUDE 'intranet-bottom.inc' %]