1 [% USE AuthorisedValues %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <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>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <script type="text/javascript">
9 var MSG_BUDGET_PARENT_ALLOCATION = "- " + _("Fund amount exceeds parent allocation") + "\n";
10 var MSG_BUDGET_PERIOD_ALLOCATION = "- " + _("Fund amount exceeds period allocation") + "\n";
11 var MSG_PARENT_BENEATH_BUDGET = "- " + _("New budget-parent is beneath budget") + "\n";
15 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
16 [% IF op == 'add_form' %]
17 <script type="text/javascript">
20 function userPopup() {
21 window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=add",
23 'width=740,height=450,location=yes,toolbar=no,'
24 + 'scrollbars=yes,resize=yes'
28 function ownerPopup() {
29 window.open("/cgi-bin/koha/admin/add_user_search.pl?selection_type=select",
31 'width=740,height=450,location=yes,toolbar=no,'
32 + 'scrollbars=yes,resize=yes'
36 function select_user(borrowernumber, borrower) {
38 var borrowername = borrower.firstname + ' ' + borrower.surname
40 var ownerlink = '<a href="/cgi-bin/koha/members/moremember.pl'
41 + '?borrowernumber=' + borrowernumber + '">'
42 + borrowername + '</a>';
43 $('#budget_owner_name').html(ownerlink);
44 $('#budget_owner_id').val(borrowernumber);
48 function ownerRemove() {
49 $('#budget_owner_name').empty();
50 $('#budget_owner_id').val('');
53 function add_user(borrowernumber, borrowername) {
54 var ids = $("#budget_users_id").val().split(':');
55 if(borrowernumber && ids.indexOf(borrowernumber) == -1) {
56 var li = '<li id="user_' + borrowernumber + '">'
57 + '<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber='
58 + borrowernumber + '">' + borrowername + '</a> '
59 + ' • <a data-borrowernumber=" + borrowernumber +" class="del_user" href="#"><i class="fa fa-trash"></i> Remove</a> '
61 $("#budget_users").prepend(li);
62 ids.push(borrowernumber);
63 $("#budget_users_id").val(ids.join(':'));
70 function del_user(borrowernumber) {
71 var ids = $("#budget_users_id").val().split(':');
73 var idx = ids.indexOf(borrowernumber+'');
76 $("#budget_users_id").val(ids.join(':'));
77 $("li#user_" + borrowernumber).remove();
87 if (!(isNotNull(f.budget_code,1))) {
88 _alertString += _("- Budget code cannot be blank") + "\n";
91 if (!(isNotNull(f.budget_name,1))) {
92 _alertString += _("- Budget name cannot be blank") + "\n";
95 if (!(isNotNull(f.budget_amount,1))) {
96 _alertString += _("- Budget amount cannot be blank") + "\n";
100 if (typeof(f.budget_id ) != "undefined") {
101 budgetId = f.budget_id.value
106 // hack to test if selected parent_id in scrolling-list...
107 // if value == 'undef' its got a selected_parent :/
108 if(f.budget_parent_id){
109 var chkAdd = f.budget_parent_id.value ;
110 if ( typeof(chkAdd ) != "undefined") {
111 newBudgetParent = f.budget_parent_id.value
113 newBudgetParent = f.budget_parent_id.item(0).value
116 if (budgetId > 0) { ; //its a mod ...
117 // if parent == curent-budget, fail...
118 if ( newBudgetParent == budgetId ) {
119 _alertString += _("- Budget parent is current budget") + "\n";
122 else if (newBudgetParent) {
123 var result = checkBudgetParent( budgetId , newBudgetParent );
125 _alertString += result;
132 var budgetTotal = Math.abs(f.budget_amount.value);
133 var result = budgetExceedsParent (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
135 _alertString += result;
138 if (_alertString.length==0) {
139 document.Aform.submit();
141 alertString2 = _("Form not submitted because of the following problem(s)");
142 alertString2 += "\n------------------------------------------------------------------------------------\n\n";
143 alertString2 += _alertString;
147 $(document).ready(function(){
148 $("#remove_owner").on("click",function(e){
152 $("#edit_owner").on("click",function(e){
156 $("body").on("click",".del_user",function(e){
158 var borrowernumber = $(this).data("borrowernumber");
159 del_user(borrowernumber);
161 $("#add_user_button").on("click",function(e){
165 $("#edit_fund").on("submit",function(e){
172 [% ELSIF op == 'list' %]
173 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
174 [% INCLUDE 'datatables.inc' %]
175 <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
176 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
178 <script type="text/javascript">
181 $(document).ready(function() {
184 var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
185 "fnDrawCallback": function ( oSettings ) {
186 if ( oSettings.aiDisplay.length == 0 )
191 var nTrs = $('#budgeth tbody tr');
192 var iColspan = nTrs[0].getElementsByTagName('td').length;
194 for ( var i=0 ; i<nTrs.length ; i++ )
196 var iDisplayIndex = oSettings._iDisplayStart + i;
197 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1];
198 if ( sGroup != sLastGroup )
200 var nGroup = document.createElement( 'tr' );
201 var nCell = document.createElement( 'td' );
202 nCell.colSpan = iColspan;
203 nCell.className = "group";
204 nCell.innerHTML = sGroup;
205 nGroup.appendChild( nCell );
206 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
211 "footerCallback": function ( row, data, start, end, display ) {
212 var api = this.api(), data;
213 footer_column_sum( api, [ 4, 6, 8, 10 ], 2 );
216 { "bVisible": false, "aTargets": [ 0, 1 ] },
217 { "bSortable": false, "aTargets": ["_all"] }
219 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>',
221 'aaSortingFixed': [[ 1, 'asc' ]],
226 $(oTable).treetable({
229 $(oTable).treetable('expandAll');
230 $("#expand_all").click(function(e){
232 $(oTable).treetable('expandAll');
234 $("#collapse_all").click(function(e){
236 $(oTable).treetable('collapseAll');
239 [% UNLESS budget_period_id %]
240 $("#hide_inactive").click(function(e){
242 oTable.fnFilter( 1, 0 ); // Show only active=1
244 $("#show_inactive").click(function(e){
246 oTable.fnFilter( '', 0 );
248 $("#hide_inactive").click();
250 oTable.fnAddFilters("filter", 750);
252 $("#filterbutton").click(function() {
253 $("#fundfilters").slideToggle(0);
256 $(".deletefund-disabled").tooltip().on("click", function(e){
258 alert(_("This fund has children. It cannot be deleted."));
266 <body id="admin_aqbudgets" class="admin">
267 [% INCLUDE 'header.inc' %]
268 [% INCLUDE 'budgets-admin-search.inc' %]
270 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
271 <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 %]
272 [% IF op == 'add_form' %]
273 <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 %]
275 [% IF op == 'delete_confirm' %]
276 <a href="/cgi-bin/koha/admin/aqbudgets.pl">Funds</a> › Delete fund?
280 <div id="doc3" class="yui-t2">
283 <div class="yui-b" id="content">
286 [% UNLESS op == 'delete_confirm' %][% INCLUDE 'budgets-admin-toolbar.inc' %][% END %]
288 [% IF (error_not_authorised_to_modify) %]
290 <p>You are not authorized to modify this fund</p>
294 [% IF op == 'list' %]
297 [% IF budget_period_id %]
298 Funds for '[% budget_period_description %]'
304 [% INCLUDE 'budgets-active-currency.inc' %]
308 <table id="budgeth" class="group">
309 [% UNLESS budget_period_id %]
311 <span class="actions"><a href="#" id="expand_all">Expand all</a>
312 | <a href="#" id="collapse_all">Collapse all</a>
313 | <a href="#" id="hide_inactive">Hide inactive budgets</a>
314 | <a href="#" id="show_inactive">Show inactive budgets</a></span>
320 <th>Budget period description</th>
323 <th>Base-level allocated</th>
324 <th>Base-level ordered</th>
325 <th>Total ordered</th>
326 <th>Base-level spent</th>
328 <th>Base-level available</th>
329 <th>Total available</th>
337 <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated [% IF budget_period_total %][% budget_period_total | $Price %][% END %] </th>
338 <th nowrap="nowrap" class="data"> [% period_alloc_total | $Price %]</th>
340 <th class="data">[% ordered_total | $Price %]</th>
342 <th class="data">[% spent_total | $Price %]</th>
344 <th class="data">[% available_total | $Price %]</th>
349 [% FOREACH budget IN budgets %]
350 [% IF budget.budget_parent_id %]
351 <tr data-tt-id="[% budget.budget_id %]" data-tt-parent-id="[% budget.budget_parent_id %]">
353 <tr data-tt-id="[% budget.budget_id %]">
355 <td>[% budget.budget_period_active %]</td>
356 <td>Budget [% budget.budget_period_description %] [id=[% budget.budget_period_id %]][% UNLESS budget.budget_period_active %] (inactive)[% END %]</td>
357 <td>[% budget.budget_code %]</td>
358 <td>[% budget.budget_name %]</td>
360 [% IF budget.budget_parent_id %]
361 <span class="child_fund_amount">[% budget.budget_amount | $Price %]</span>
363 <span class="total_amount">[% budget.budget_amount | $Price %]</span>
367 [% IF budget.budget_parent_id %]
368 <span class="child_fund_amount">[% budget.budget_ordered | $Price %]</span>
370 <span class="total_amount">[% budget.budget_ordered | $Price %]</span>
374 [% IF budget.budget_parent_id %]
375 <span class="child_fund_amount">[% budget.total_ordered | $Price %]</span>
377 <span class="total_amount">[% budget.total_ordered | $Price %]</span>
381 [% IF budget.budget_parent_id %]
382 <span class="child_fund_amount">[% budget.budget_spent | $Price %]</span>
384 <span class="total_amount">[% budget.budget_spent | $Price %]</span>
388 [% IF budget.budget_parent_id %]
389 <span class="child_fund_amount">[% budget.total_spent | $Price %]</span>
391 <span class="total_amount">[% budget.total_spent | $Price %]</span>
396 [% BLOCK colorcellvalue %]
399 <span class="child_fund_amount" style="color: green;">
400 [% ELSIF (value < 0) %]
401 <span class="child_fund_amount" style="color: red;">
403 <span class="child_fund_amount">
407 <span class="total_amount" style="color: green;">
408 [% ELSIF (value < 0) %]
409 <span class="total_amount" style="color: red;">
411 <span class="totalamount">
418 [% INCLUDE colorcellvalue value=budget.budget_remaining parent=budget.budget_parent_id %]
421 [% INCLUDE colorcellvalue value=budget.total_remaining parent=budget.budget_parent_id %]
423 [% IF ( budget.budget_lock ) %]
424 <td> <span></span> </td>
427 <div class="dropdown dropup">
428 <a class="btn btn-mini dropdown-toggle" id="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
429 Actions <b class="caret"></b>
431 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetactions[% budget.budget_id %]_[% budget.budget_period_id %]">
432 <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_id=[% budget.budget_id %]&budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-pencil"></i> Edit</a></li>
433 [% IF budget.budget_has_children %]
434 <li class="disabled"><a href="#" class="deletefund-disabled" data-toggle="tooltip" data-placement="left" title="This fund has children"><i class="fa fa-trash"></i> Delete</a></li>
436 <li><a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&budget_id=[% budget.budget_id %]&budget_period_id=[% budget.budget_period_id %]"><i class="fa fa-trash"></i> Delete</a></li>
438 <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 %]"><i class="fa fa-plus"></i> Add child fund</a></li>
452 [% END %] <!-- list -->
454 <!-- ********************************************************************************************** -->
455 <!-- create add/mod entry form -->
456 [% IF op == 'add_form' && !error_not_authorised_to_modify %]
457 <form action="/cgi-bin/koha/admin/aqbudgets.pl" id="edit_fund" name="Aform" method="post">
458 <fieldset class="rows">
459 <legend>[% IF ( budget_id ) %]Modify[% ELSE %]Add[% END %] Fund
460 [% IF ( budget_period_description ) %]
461 [% budget_name %] for Budget '[% budget_period_description %]'
465 <input type="hidden" name="op" value="add_validate" />
466 <input type="hidden" name="checked" value="0" />
468 [% IF ( budget_parent_id ) %]
470 <span class="label">Fund parent: </span>
471 [% budget_parent_name %]
472 [% budget_parent_id %] - [% budget_parent_name %]
473 <input type="hidden" name="budget_parent_id" value="[% budget_parent_id %]" />
477 <label class="required" for="budget_code">Fund code: </label>
478 <input type="text" name="budget_code" id="budget_code" value="[% budget_code %]" size="30" />
482 <label class="required" for="budget_name">Fund name: </label>
483 <input type="text" name="budget_name" id="budget_name" value="[% budget_name %]" size="60" />
487 <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
488 <input type="text" name="budget_amount" id="budget_amount" value="[% budget_amount | $Price on_editing => 1 %]" size="8" />
492 <label for="budget_encumb">Warning at (%): </label>
493 <input type="text" name="budget_encumb" id="budget_encumb" value="[% budget_encumb %]" size="10" />
494 <span class="hint">0 to disable</span>
498 <label for="budget_expend">Warning at (amount): </label>
499 <input type="text" name="budget_expend" id="budget_expend" value="[% budget_expend | $Price on_editing => 1 %]" size="10" />
500 <span class="hint">0 to disable</span>
504 <span class="label">Owner: </span>
505 [% IF ( budget_owner_name ) %]
506 <span id="budget_owner_name">
507 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% budget_owner_id %]">
508 [% budget_owner_name %]
512 <a id="edit_owner" class="new_window" href="#"><i class="fa fa-search"></i> Select owner</a>
513 <a id="remove_owner" href="#"><i class="fa fa-trash"></i> Remove owner</a>
514 <input type="hidden" name="budget_owner_id" id="budget_owner_id"
515 value="[% budget_owner_id %]" />
519 [% IF budget_has_children %]
522 <input type="checkbox" id="set_owner_to_children" name="set_owner_to_children" value="1" />
523 Update all child funds with this owner
525 <span class="hint">Selecting this option will overwrite existing fund owners, if any</span>
530 <span class="label">Users:</span>
531 <ul style="float:left;" id="budget_users">
532 [% FOREACH user IN budget_users %]
533 <li id="user_[% user.borrowernumber %]">
534 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% user.borrowernumber %]">
535 [% user.firstname %] [% user.surname %]
537 • <a href="#" class="del_user" data-borrowernumber="[% user.borrowernumber %]"><i class="fa fa-trash"></i> Remove</a>
540 <li><a href="#" id="add_user_button"><i class="fa fa-plus"></i> Add users</a></li>
542 <input type="hidden" name="budget_users_ids" id="budget_users_id" value="[% budget_users_ids %]" />
545 <label for="budget_branchcode">Library: </label>
546 <select name="budget_branchcode" id="budget_branchcode">
547 <option value=""></option>
548 [% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
553 <label for="budget_permission">Restrict access to: </label>
554 <select name="budget_permission" id="budget_permission">
555 [% IF ( budget_perm_0 ) %]
556 <option value="0" selected="selected">
563 [% IF ( budget_perm_1 ) %]
564 <option value="1" selected="selected">
571 [% IF ( budget_perm_3) %]
572 <option value="3" selected="selected">
579 [% IF ( budget_perm_2 ) %]
580 <option value="2" selected="selected">
584 Owner, users and library
590 <label for="budget_notes">Notes: </label>
591 <textarea name="budget_notes" id="budget_notes" cols="80" rows="6">[% budget_notes %]</textarea>
595 <label style="white-space: nowrap;" for="authorised_value_category1">Statistic 1 done on: </label>
596 <select name="sort1_authcat" id="authorised_value_category1">
597 <option value=""></option>
598 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort1_authcat ) %]
602 <label style="white-space: nowrap;" for="authorised_value_category2">Statistic 2 done on: </label>
603 <select name="sort2_authcat" id="authorised_value_category2">
604 <option value=""></option>
605 [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => sort2_authcat ) %]
610 [% IF ( budget_id ) %]
611 <input type="hidden" name="budget_id" value="[% budget_id %]" />
615 <fieldset class="action">
616 <input type="submit" value="Submit" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
617 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
621 [% END %] <!-- add_form -->
623 [% IF op == 'delete_confirm' %]
624 <div class="dialog alert">
625 <h3>Delete fund [% budget_name %]?</h3>
626 If you delete this fund, all orders linked to this fund will be deleted!
629 <th scope="row">Fund amount:</th>
630 <td>[% budget_amount | $Price %]</td>
634 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="post">
635 <input type="hidden" name="op" value="delete_confirmed" />
636 <input type="hidden" name="budget_id" value="[% budget_id %]" />
637 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
638 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this fund</button>
640 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
641 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
649 [% IF op == 'list' %]
650 <form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
651 <a href="#" id="filterbutton">Filters</a>
652 <fieldset class="brief" id="fundfilters">
653 <h4>Fund filters</h4>
656 <label for="filter_budgetbranch2">Library: </label>
657 <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
658 <option value=""></option>
659 [% PROCESS options_for_libraries libraries => Branches.all( selected => budget_branchcode, unfiltered => 1 ) %]
664 <label for="show_mine">Show my funds only:</label>
665 [% IF ( show_mine ) %]
666 <input type="checkbox" id="show_mine" name="show_mine" value="1" checked="checked" />
668 <input type="checkbox" id="show_mine" name="show_mine" value="1" />
674 <label for="periods">Budget:</label>
675 <select id="periods" name="budget_period_id">
676 <option value="">All budgets</option>
677 [% FOR period IN periods %]
678 [% IF budget_period_id && period.budget_period_id == budget_period_id %]
679 <option value="[% period.budget_period_id %]" selected="selected">[% period.budget_period_description %]</option>
681 <option value="[% period.budget_period_id %]">[% period.budget_period_description %]</option>
689 <input type="hidden" name="op" value="list" />
690 <input type="submit" class="submit" name="filter" value="Go" />
693 [% INCLUDE 'acquisitions-menu.inc' %]
696 [% INCLUDE 'intranet-bottom.inc' %]