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[1].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 %][% 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 <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>
388 <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>
389 <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>
401 [% END %] <!-- list -->
403 <!-- ********************************************************************************************** -->
404 <!-- create add/mod entry form -->
405 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
406 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
407 <fieldset class="rows">
408 <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
409 [% IF ( budget_period_description ) %]
410 [% budget_name %] for Budget '[% budget_period_description %]'
414 <input type="hidden" name="op" value="add_validate" />
415 <input type="hidden" name="checked" value="0" />
417 [% IF ( budget_parent_id ) %]
419 <span class="label">Fund parent: </span>
420 [% budget_parent_name %]
421 [% budget_parent_id %] - [% budget_parent_name %]
422 <input type="hidden" name="budget_parent_id" value="[% budget_parent_id %]" />
426 <label class="required" for="budget_code">Fund code: </label>
427 <input type="text" name="budget_code" id="budget_code" value="[% budget_code %]" size="30" />
431 <label class="required" for="budget_name">Fund name: </label>
432 <input type="text" name="budget_name" id="budget_name" value="[% budget_name %]" size="60" />
436 <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
437 <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount %]" size="8" />
441 <label for="budget_encumb">Warning at (%): </label>
442 <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
443 <span style="color:grey">0 to disable</span>
447 <label for="budget_expend">Warning at (amount): </label>
448 <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 %]" />
449 <span style="color:grey">0 to disable</span>
453 <span class="label">Owner: </span>
454 <span id="budget_owner_name">
455 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
456 [% budget_owner_name %]
459 <input type="hidden" name="budget_owner_id" id="budget_owner_id"
460 value="[% budget_owner_id %]" />
462 <!-- FIXME: hardcoded button positions :/ -->
463 <input type="button" id="edit_owner" value="Edit owner"
464 onclick="ownerPopup(); return false;" />
465 <input type="button" id="remove_owner" value="Remove owner"
466 onclick="ownerRemove(); return false;" />
470 <span class="label">Users:</span>
471 <ul style="float:left;" id="budget_users">
472 [% FOREACH user IN budget_users %]
473 <li id="user_[% user.borrowernumber %]">
474 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
475 [% user.firstname %] [% user.surname %]
477 [<a style="cursor:pointer"
478 onclick="del_user([% user.borrowernumber %])">Remove</a>]
481 <li id="add_user_button">
482 <input type="button" onclick="userPopup()" value="Add users" />
485 <input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
487 <label for="budget_branchcode">Library: </label>
488 <select name="budget_branchcode" id="budget_branchcode">
489 <option value=""></option>
490 [% FOREACH branchloop_selec IN branchloop_select %]
491 [% 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>
497 <label for="budget_permission">Restrict access to: </label>
498 <select name="budget_permission" id="budget_permission">
499 [% IF ( budget_perm_0 ) %]
500 <option value="0" selected="selected">
507 [% IF ( budget_perm_1 ) %]
508 <option value="1" selected="selected">
515 [% IF ( budget_perm_3) %]
516 <option value="3" selected="selected">
523 [% IF ( budget_perm_2 ) %]
524 <option value="2" selected="selected">
528 Owner, users and library
534 <label for="budget_notes">Notes: </label>
535 <textarea name="budget_notes" id="budget_notes" cols="80" rows="6">[% budget_notes %]</textarea>
539 <label style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
540 <select name="sort1_authcat" id="authorised_value_category1">
541 <option value=""></option>
542 [% FOREACH authorised_value_categories IN authorised_value_categories1 %]
543 [% IF ( authorised_value_categories.selected ) %]
544 <option value="[% authorised_value_categories.category %]" selected="selected">
545 [% authorised_value_categories.category %]
548 <option value="[% authorised_value_categories.category %]">
549 [% authorised_value_categories.category %]
556 <label style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
557 <select name="sort2_authcat" id="authorised_value_category2">
558 <option value=""></option>
559 [% FOREACH authorised_value_categories IN authorised_value_categories2 %]
560 [% IF ( authorised_value_categories.selected ) %]
561 <option value="[% authorised_value_categories.category %]" selected="selected">
562 [% authorised_value_categories.category %]
565 <option value="[% authorised_value_categories.category %]">
566 [% authorised_value_categories.category %]
574 [% IF ( budget_id ) %]
575 <input type="hidden" name="budget_id" value="[% budget_id %]" />
579 <fieldset class="action">
580 <input type="submit" value="Submit" onclick="Check(this.form); return false;" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
581 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
585 [% END %] <!-- add_form -->
587 [% IF op == 'delete_confirm' %]
588 <div class="dialog alert"> <h3>Delete fund [% budget_name %]?</h3>
591 <th scope="row">Fund amount:</th>
592 <td>[% budget_amount %]</td>
596 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
597 <input type="hidden" name="op" value="delete_confirmed" />
598 <input type="hidden" name="budget_id" value="[% budget_id %]" />
599 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
600 <input type="submit" value="Delete" class="approve" />
603 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
604 <input type="submit" class="deny" value="Cancel" />
612 [% IF op == 'list' %]
613 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
614 <a href="#" id="filterbutton">Filters</a>
615 <fieldset class="brief" id="fundfilters">
616 <h4>Fund filters</h4>
619 <label for="filter_budgetbranch2">Library: </label>
620 <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
621 <option value=""></option>
622 [% FOREACH branchloo IN branchloop %]
623 [% UNLESS ( branchloo.selected ) %]<option value="[% branchloo.value %]">
624 [% ELSE %]<option value="[% branchloo.value %]" selected="selected">[% END %]
625 [% branchloo.branchname %]</option>
631 <label for="show_mine">Show my funds only</label>
632 [% IF ( show_mine ) %]
633 <input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
635 <input type="checkbox" id="show_mine" name="show_mine" value="1" />
641 <label for="periods">Budget:</label>
642 <select id="periods" name="budget_period_id">
643 <option value="">All budgets</option>
644 [% FOR period IN periods %]
645 [% IF budget_period_id && period.budget_period_id == budget_period_id %]
646 <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
648 <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
656 <input type="hidden" name="op" value="list" />
657 <input type="submit" class="submit" name="filter" value="Go" />
660 [% INCLUDE 'acquisitions-menu.inc' %]
663 [% INCLUDE 'intranet-bottom.inc' %]