6 [%- BLOCK action_menu %]
8 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id | html %]" role="button" data-toggle="dropdown" href="#">
9 Actions <b class="caret"></b>
11 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id | html %]">
13 <a href="[% script_name | html %]?op=add_form&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-pencil"></i> Edit</a>
15 [% IF block_budget.count %]
17 <a data-toggle="tooltip" data-placement="left" title="[% block_budget.count | html %] fund(s) are attached to this budget. You must delete all attached funds before deleting this budget." href="#"><i class="fa fa-trash"></i> Delete</a>
21 <a href="[% script_name | html %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-trash"></i> Delete</a>
25 <a href="[% script_name | html %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-copy"></i> Duplicate</a>
28 <a href="[% script_name | html %]?op=close_form&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-times-circle"></i> Close</a>
31 <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-plus"></i> Add fund</a>
37 [% INCLUDE 'doc-head-open.inc' %]
38 [% INCLUDE 'doc-head-close.inc' %]
39 [% Asset.css("css/datatables.css") | $raw %]
41 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
45 Koha › Administration › Budgets
47 [% IF ( add_form ) %]›
48 [% IF ( budget_period_id ) %]
49 Modify budget [% budget_period_description | html %]
54 [% IF ( duplicate_form ) %]› Duplicate budget[% END %]
55 [% IF ( delete_confirm ) %]›
56 Delete budget '[% budget_period_description | html %]'?
58 [% IF ( delete_confirmed ) %]›
61 [% IF close_form %]›
62 Close budget [% budget_period_description | html %]
64 [% IF closed %]›
65 Budget [% budget_period_description | html %] closed
72 <body id="admin_aqbudgetperiods" class="admin">
74 [% INCLUDE 'header.inc' %]
75 [% INCLUDE 'budgets-admin-search.inc' %]
77 <!-- ################################################################################# -->
79 <!-- ################################################################################# -->
81 <div id="breadcrumbs">
82 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
83 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
86 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
87 [% IF ( budget_period_id ) %]
88 <span>Modify budget '[% budget_period_description | html %]'</span>
90 <span>Add budget</span>
93 [% IF ( delete_confirm ) %]
94 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
95 [% IF ( total || funds_exist ) %]
96 <span>Cannot delete budget '[% budget_period_description | html %]'</span>
98 <span>Delete budget '[% budget_period_description | html %]'?</span>
101 [% IF ( duplicate_form ) %]
102 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › Duplicate budget
105 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
106 <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a></span>
109 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
110 <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a> closed</span>
113 <span>Budgets administration</span>
117 <div class="main container-fluid">
119 <div class="col-sm-10 col-sm-push-2">
122 [% UNLESS close_form OR closed OR duplicate_form %]
123 [% INCLUDE 'budgets-admin-toolbar.inc' %]
126 [% IF ( duplicate_form ) %]
127 <h3>Duplicate budget</h3>
128 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
129 <fieldset class="rows">
130 <input type="hidden" name="op" value="duplicate_budget" />
131 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
136 <label class="required" for="from">Start date: </label>
137 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
138 <span class="required">Required</span>
139 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
143 <label class="required" for="to">End date: </label>
144 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
145 <span class="required">Required</span>
146 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
150 <label class="required" for="budget_period_description">Description</label>
151 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
152 <span class="required">Required</span>
156 <label for="amount_change_percentage">Change amounts by</label>
157 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
158 <div class="hint">(can be positive or negative)</div>
162 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
163 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
164 <div class="hint">(amounts will be rounded down)</div>
168 <label for="mark_as_inactive">Mark the original budget as inactive</label>
169 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
173 <label for="reset_all_budgets">Set all funds to zero</label>
174 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
180 <fieldset class="action">
181 <input type="submit" value="Save" />
182 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
189 [% IF ( add_form ) %]
190 <!-- add or modify a budget period -->
192 [% IF ( budget_period_id ) %]
193 <h3>Modify budget <i>[% budget_period_description | html %]</i></h3>
197 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
198 <fieldset class="rows">
199 <!-- ################################################################################# -->
200 <!-- display information about the budget period that must be added or modified -->
201 <!-- ################################################################################# -->
202 <input type="hidden" name="op" value="add_validate" />
203 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
206 <label class="required" for="from">Start date: </label>
207 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
208 <span class="required">Required</span>
209 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
213 <label class="required" for="to">End date: </label>
214 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
215 <span class="required">Required</span>
216 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
221 <!-- ############################## -->
222 <label class="required" for="budget_period_description">Description: </label>
223 <input type="text" id="budget_period_description" name="budget_period_description"
224 size="48" maxlength="80" value="[% budget_period_description | html %]" />
225 <span class="required">Required</span>
230 <!-- ############################## -->
231 <label for="budget_period_total">Total amount: </label>
232 <input type="text" id="budget_period_total" name="budget_period_total"
233 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 | html %]" />
238 <!-- ############################## -->
239 <label for="budget_period_active">Make budget active: </label>
240 [% IF ( budget_period_active ) %]<input type="checkbox" checked="checked" id="budget_period_active" name="budget_period_active" value="1" />[% ELSE %] <input type="checkbox" id="budget_period_active" name="budget_period_active" value="1"/> [% END %]
245 <!-- ############################## -->
246 <label for="budget_period_locked">Lock budget: </label>
247 [% IF ( budget_period_locked ) %]<input type="checkbox" checked="checked" id="budget_period_locked" name="budget_period_locked" value="1" />[% ELSE %] <input type="checkbox" id="budget_period_locked" name="budget_period_locked" value="1"/> [% END %]
252 <fieldset class="action">
253 <!-- "save changes" button -->
254 <!-- ###################################### -->
255 <input type="submit" value="Save" />
256 [% IF ( budget_period_id ) %]
257 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]" class="cancel">Cancel</a>
259 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
267 <!-- ####################################################################### -->
268 <!-- delete a budget period -->
269 <!-- ####################################################################### -->
271 [% IF ( delete_confirm ) %]
273 <div class="dialog message">
274 <h3>Cannot delete budget</h3>
275 <p><strong>This record is used [% total | html %] times</strong>
276 . Deletion is not possible.</p>
277 [% ELSIF ( funds_exist ) %]
278 <div class="dialog message">
279 <h3>Cannot delete budget</h3>
280 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
282 <div class="dialog alert">
283 <h3>Delete budget '[% budget_period_description | html %]'?</h3>
285 <!-- ############################################################# -->
286 <!-- "delete" and "cancel" buttons -->
287 <!-- ############################################################# -->
289 <form action="[% script_name | html %]" method="post">
290 <input type="hidden" name="op" value="delete_confirmed" />
291 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
292 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
294 <form action="[% script_name | html %]" method="post">
295 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
303 [% IF budget_periods.size == 0 %]
304 You cannot move funds of this budget, there is no active budget.
305 Please create a new active budget and retry.
306 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
307 [% ELSIF number_of_unreceived_orders == 0 %]
308 There are no unreceived orders for this budget.
309 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
311 <h3>The unreceived orders from the following funds will be moved</h3>
312 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a>:
319 <th>Unreceived orders</th>
323 [% FOREACH budget IN budgets_to_move %]
325 <td>[% budget.budget_id | html %]</td>
326 <td>[% budget.budget_code_indent | html %]</td>
327 <td>[% budget.budget_name | html %]</td>
328 <td>[% budget.unreceived_orders.size | html %]</td>
333 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
334 <fieldset class="rows">
337 <label class="required" for="to_budget_period_id">Select a budget</label>
338 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
339 <option value=""></option>
340 [% FOR budget_period IN budget_periods %]
341 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
346 <label for="move_remaining_unspent">Move remaining unspent funds</label>
347 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
351 <fieldset class="action">
352 <input type="hidden" name="op" value="close_confirmed" />
353 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
354 <input type="submit" value="Move unreceived orders" />
355 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
360 <h3>Report after moving unreceived orders from budget [% from_budget_period.budget_period_description | html %] ([% from_budget_period.budget_period_startdate | $KohaDates %] - [% from_budget_period.budget_period_enddate | $KohaDates %]) to [% to_budget_period.budget_period_description | html %] ([% to_budget_period.budget_period_startdate | $KohaDates %] - [% to_budget_period.budget_period_enddate | $KohaDates%])</h3>
362 <table id="closed_report">
372 [% FOR r IN report %]
374 [% IF r.orders_moved.size > 0 %]
375 [% FOR order IN r.orders_moved %]
377 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %]) Amount=[% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
378 <td>[% order.basketname | html %]</td>
379 <td>[% order.ordernumber | html %]</td>
385 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
388 <td>There were no unreceived orders for this fund.</td>
392 [% IF r.error == 'budget_code_not_exists' %]
394 <td>[% r.budget.budget_id | html %] [% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
397 <td>This fund code does not exist in the destination budget.</td>
405 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
408 <!-- DEFAULT display budget periods list -->
410 <h2>Budgets administration</h2>
412 [% IF ( failed_delete_funds_exist ) %]
413 <div class="dialog message">Failed to delete budget because funds exist.</div>
416 [% INCLUDE 'budgets-active-currency.inc' %]
418 <div id="budgetsTabs" class="toptabs">
420 <li><a href="#active">Active budgets</a></li>
421 <li><a href="#inactive">Inactive budgets</a></li>
425 [% IF ( period_active_loop ) %]
426 <table id="activeperiodst">
430 <th class="title-string">Start date</th>
431 <th class="title-string">End date</th>
438 [% FOREACH period_active IN period_active_loop %]
440 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id | html %]" title="View funds for [% period_active.budget_period_description | html %]">[% period_active.budget_period_description | html %]</a></td>
441 <td><span title="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
442 <td><span title="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
444 [% IF ( period_active.budget_period_locked ) %]
445 <span style="color:green;">Locked</span>
448 <td class="data">[% period_active.budget_period_total | $Price %]</td>
450 [% PROCESS action_menu block_budget=period_active %]
461 [% IF ( period_inactive_loop ) %]
462 <table id="inactiveperiodst">
466 <th class="title-string">Start date</th>
467 <th class="title-string">End date</th>
474 [% FOREACH period_loo IN period_inactive_loop %]
476 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id | html %]" title="View funds for [% period_loo.budget_period_description | html %]">[% period_loo.budget_period_description | html %]</a></td>
477 <td><span title="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
478 <td><span title="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
479 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
480 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
482 [% PROCESS action_menu block_budget=period_loo %]
496 </div> <!-- /.col-sm-10.col-sm-push-2 -->
498 <div class="col-sm-2 col-sm-pull-10">
500 [% INCLUDE 'acquisitions-menu.inc' %]
502 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
503 </div> <!-- /.row -->
505 [% MACRO jsinclude BLOCK %]
506 [% INCLUDE 'calendar.inc' %]
507 [% INCLUDE 'datatables.inc' %]
509 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
511 [% Asset.js("js/acq.js") | $raw %]
513 $(document).ready(function() {
514 var tabs = $('#budgetsTabs').tabs();
516 tabs.tabs("option", "active", [% tab | html %]);
518 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
520 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
521 { "sType": "title-string", "aTargets" : [ "title-string" ] }
523 "sPaginationType": "four_button",
528 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
531 $("#move_form").submit(function(){
532 var budget_from = "[% budget_period_description | html %]";
533 var budget_to = $("#to_budget_period_id").find("option:selected").html();
534 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
535 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
536 return confirm ( alert_message );
540 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
541 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
542 "fnDrawCallback": function ( oSettings ) {
543 if ( oSettings.aiDisplay.length == 0 )
548 var nTrs = $('#closed_report tbody tr');
549 var iColspan = nTrs[1].getElementsByTagName('td').length;
551 for ( var i=0 ; i<nTrs.length ; i++ )
553 var iDisplayIndex = oSettings._iDisplayStart + i;
554 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
555 if ( sGroup != sLastGroup )
557 var nGroup = document.createElement( 'tr' );
558 var nCell = document.createElement( 'td' );
559 nCell.colSpan = iColspan;
560 nCell.className = "group";
561 nCell.innerHTML = sGroup;
562 nGroup.appendChild( nCell );
563 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
569 { "bVisible": false, "aTargets": [ 0, 1 ] },
570 { "bSortable": false, "aTargets": ["_all"] }
573 'aaSortingFixed': [[ 1, 'asc' ]],
575 "sPaginationType": "full_numbers"
578 $("#add_modify_budget").validate({
580 budget_period_startdate: "required",
581 budget_period_enddate: {
583 date_on_or_after: "#from"
585 budget_period_description: "required",
586 budget_period_total: {
591 budget_period_enddate: {
592 date_on_or_after: _("Budget end date must be on or after budget start date")
599 [% INCLUDE 'intranet-bottom.inc' %]