6 [%- BLOCK action_menu %]
7 <div class="btn-group dropup">
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 | url %]?op=add_form&budget_period_id=[% block_budget.budget_period_id | uri %]"><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 | url %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-trash"></i> Delete</a>
25 <a href="[% script_name | url %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-copy"></i> Duplicate</a>
28 <a href="[% script_name | url %]?op=close_form&budget_period_id=[% block_budget.budget_period_id | uri %]"><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 | uri %]"><i class="fa fa-plus"></i> Add fund</a>
37 [% INCLUDE 'doc-head-open.inc' %]
38 [% INCLUDE 'doc-head-close.inc' %]
40 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
44 Koha › Administration › Budgets
46 [% IF ( add_form ) %]›
47 [% IF ( budget_period_id ) %]
48 Modify budget [% budget_period_description | html %]
53 [% IF ( duplicate_form ) %]› Duplicate budget[% END %]
54 [% IF ( delete_confirm ) %]›
55 Delete budget '[% budget_period_description | html %]'?
57 [% IF ( delete_confirmed ) %]›
60 [% IF close_form %]›
61 Close budget [% budget_period_description | html %]
63 [% IF closed %]›
64 Budget [% budget_period_description | html %] closed
71 <body id="admin_aqbudgetperiods" class="admin">
73 [% INCLUDE 'header.inc' %]
74 [% INCLUDE 'budgets-admin-search.inc' %]
76 <!-- ################################################################################# -->
78 <!-- ################################################################################# -->
80 <div id="breadcrumbs">
81 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
82 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
85 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
86 [% IF ( budget_period_id ) %]
87 <span>Modify budget '[% budget_period_description | html %]'</span>
89 <span>Add budget</span>
92 [% IF ( delete_confirm ) %]
93 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
94 [% IF ( total || funds_exist ) %]
95 <span>Cannot delete budget '[% budget_period_description | html %]'</span>
97 <span>Delete budget '[% budget_period_description | html %]'?</span>
100 [% IF ( duplicate_form ) %]
101 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › Duplicate budget
104 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
105 <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a></span>
108 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
109 <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a> closed</span>
112 <span>Budgets administration</span>
116 <div class="main container-fluid">
118 <div class="col-sm-10 col-sm-push-2">
121 [% UNLESS close_form OR closed OR duplicate_form %]
122 [% INCLUDE 'budgets-admin-toolbar.inc' %]
125 [% IF ( duplicate_form ) %]
126 <h3>Duplicate budget</h3>
127 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
128 <fieldset class="rows">
129 <input type="hidden" name="op" value="duplicate_budget" />
130 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
135 <label class="required" for="from">Start date: </label>
136 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
137 <span class="required">Required</span>
138 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
142 <label class="required" for="to">End date: </label>
143 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
144 <span class="required">Required</span>
145 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
149 <label class="required" for="budget_period_description">Description</label>
150 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
151 <span class="required">Required</span>
155 <label for="amount_change_percentage">Change amounts by</label>
156 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
157 <div class="hint">(can be positive or negative)</div>
161 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
162 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
163 <div class="hint">(amounts will be rounded down)</div>
167 <label for="mark_as_inactive">Mark the original budget as inactive</label>
168 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
172 <label for="reset_all_budgets">Set all funds to zero</label>
173 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
179 <fieldset class="action">
180 <input type="submit" value="Save" />
181 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
188 [% IF ( add_form ) %]
189 <!-- add or modify a budget period -->
191 [% IF ( budget_period_id ) %]
192 <h3>Modify budget <i>[% budget_period_description | html %]</i></h3>
196 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
197 <fieldset class="rows">
198 <!-- ################################################################################# -->
199 <!-- display information about the budget period that must be added or modified -->
200 <!-- ################################################################################# -->
201 <input type="hidden" name="op" value="add_validate" />
202 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
205 <label class="required" for="from">Start date: </label>
206 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
207 <span class="required">Required</span>
208 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
212 <label class="required" for="to">End date: </label>
213 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
214 <span class="required">Required</span>
215 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
220 <!-- ############################## -->
221 <label class="required" for="budget_period_description">Description: </label>
222 <input type="text" id="budget_period_description" name="budget_period_description"
223 size="48" maxlength="80" value="[% budget_period_description | html %]" />
224 <span class="required">Required</span>
229 <!-- ############################## -->
230 <label for="budget_period_total">Total amount: </label>
231 <input type="text" id="budget_period_total" name="budget_period_total"
232 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
237 <!-- ############################## -->
238 <label for="budget_period_active">Make budget active: </label>
239 [% 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 %]
244 <!-- ############################## -->
245 <label for="budget_period_locked">Lock budget: </label>
246 [% 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 %]
251 <fieldset class="action">
252 <!-- "save changes" button -->
253 <!-- ###################################### -->
254 <input type="submit" value="Save" />
255 [% IF ( budget_period_id ) %]
256 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
258 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
266 <!-- ####################################################################### -->
267 <!-- delete a budget period -->
268 <!-- ####################################################################### -->
270 [% IF ( delete_confirm ) %]
272 <div class="dialog message">
273 <h3>Cannot delete budget</h3>
274 <p><strong>This record is used [% total | html %] times</strong>
275 . Deletion is not possible.</p>
276 [% ELSIF ( funds_exist ) %]
277 <div class="dialog message">
278 <h3>Cannot delete budget</h3>
279 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
281 <div class="dialog alert">
282 <h3>Delete budget '[% budget_period_description | html %]'?</h3>
284 <!-- ############################################################# -->
285 <!-- "delete" and "cancel" buttons -->
286 <!-- ############################################################# -->
288 <form action="[% script_name | html %]" method="post">
289 <input type="hidden" name="op" value="delete_confirmed" />
290 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
291 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
293 <form action="[% script_name | html %]" method="post">
294 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
302 [% IF budget_periods.size == 0 %]
303 You cannot move funds of this budget, there is no active budget.
304 Please create a new active budget and retry.
305 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
306 [% ELSIF number_of_unreceived_orders == 0 %]
307 There are no unreceived orders for this budget.
308 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
310 <h3>The unreceived orders from the following funds will be moved</h3>
311 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
318 <th>Unreceived orders</th>
322 [% FOREACH budget IN budgets_to_move %]
324 <td>[% budget.budget_id | html %]</td>
325 <td>[% budget.budget_code | html %]</td>
326 <td>[% budget.budget_name | html %]</td>
327 <td>[% budget.unreceived_orders.size | html %]</td>
332 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
333 <fieldset class="rows">
336 <label class="required" for="to_budget_period_id">Select a budget</label>
337 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
338 <option value=""></option>
339 [% FOR budget_period IN budget_periods %]
340 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
345 <label for="move_remaining_unspent">Move remaining unspent funds</label>
346 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
350 <fieldset class="action">
351 <input type="hidden" name="op" value="close_confirmed" />
352 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
353 <input type="submit" value="Move unreceived orders" />
354 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
359 <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>
361 <table id="closed_report">
371 [% FOR r IN report %]
373 [% IF r.orders_moved.size > 0 %]
374 [% FOR order IN r.orders_moved %]
376 <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>
377 <td>[% order.basketname | html %]</td>
378 <td>[% order.ordernumber | html %]</td>
384 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
387 <td>There were no unreceived orders for this fund.</td>
391 [% IF r.error == 'budget_code_not_exists' %]
393 <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>
396 <td>This fund code does not exist in the destination budget.</td>
404 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
407 <!-- DEFAULT display budget periods list -->
409 <h2>Budgets administration</h2>
411 [% IF ( failed_delete_funds_exist ) %]
412 <div class="dialog message">Failed to delete budget because funds exist.</div>
415 [% INCLUDE 'budgets-active-currency.inc' %]
417 <div id="budgetsTabs" class="toptabs">
419 <li><a href="#active">Active budgets</a></li>
420 <li><a href="#inactive">Inactive budgets</a></li>
424 [% IF ( period_active_loop ) %]
425 <table id="activeperiodst">
429 <th class="title-string">Start date</th>
430 <th class="title-string">End date</th>
437 [% FOREACH period_active IN period_active_loop %]
439 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id | uri %]" title="View funds for [% period_active.budget_period_description | html %]">[% period_active.budget_period_description | html %]</a></td>
440 <td><span title="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
441 <td><span title="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
443 [% IF ( period_active.budget_period_locked ) %]
444 <span style="color:green;">Locked</span>
447 <td class="data">[% period_active.budget_period_total | $Price %]</td>
449 [% PROCESS action_menu block_budget=period_active %]
460 [% IF ( period_inactive_loop ) %]
461 <table id="inactiveperiodst">
465 <th class="title-string">Start date</th>
466 <th class="title-string">End date</th>
473 [% FOREACH period_loo IN period_inactive_loop %]
475 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id | uri %]" title="View funds for [% period_loo.budget_period_description | html %]">[% period_loo.budget_period_description | html %]</a></td>
476 <td><span title="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
477 <td><span title="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
478 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
479 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
481 [% PROCESS action_menu block_budget=period_loo %]
495 </div> <!-- /.col-sm-10.col-sm-push-2 -->
497 <div class="col-sm-2 col-sm-pull-10">
499 [% INCLUDE 'acquisitions-menu.inc' %]
501 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
502 </div> <!-- /.row -->
504 [% MACRO jsinclude BLOCK %]
505 [% INCLUDE 'calendar.inc' %]
506 [% INCLUDE 'datatables.inc' %]
508 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
510 [% Asset.js("js/acq.js") | $raw %]
512 $(document).ready(function() {
513 var tabs = $('#budgetsTabs').tabs();
515 tabs.tabs("option", "active", [% tab | html %]);
517 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
519 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
520 { "sType": "title-string", "aTargets" : [ "title-string" ] }
522 "sPaginationType": "full",
527 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
530 $("#move_form").submit(function(){
531 var budget_from = "[% budget_period_description | html %]";
532 var budget_to = $("#to_budget_period_id").find("option:selected").html();
533 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
534 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
535 return confirm ( alert_message );
539 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
540 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
541 "fnDrawCallback": function ( oSettings ) {
542 if ( oSettings.aiDisplay.length == 0 )
547 var nTrs = $('#closed_report tbody tr');
548 var iColspan = nTrs[1].getElementsByTagName('td').length;
550 for ( var i=0 ; i<nTrs.length ; i++ )
552 var iDisplayIndex = oSettings._iDisplayStart + i;
553 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
554 if ( sGroup != sLastGroup )
556 var nGroup = document.createElement( 'tr' );
557 var nCell = document.createElement( 'td' );
558 nCell.colSpan = iColspan;
559 nCell.className = "group";
560 nCell.innerHTML = sGroup;
561 nGroup.appendChild( nCell );
562 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
568 { "bVisible": false, "aTargets": [ 0, 1 ] },
569 { "bSortable": false, "aTargets": ["_all"] }
572 'aaSortingFixed': [[ 1, 'asc' ]],
574 "sPaginationType": "full_numbers"
577 $("#add_modify_budget").validate({
579 budget_period_startdate: "required",
580 budget_period_enddate: {
582 date_on_or_after: "#from"
584 budget_period_description: "required",
585 budget_period_total: {
590 budget_period_enddate: {
591 date_on_or_after: _("Budget end date must be on or after budget start date")
598 [% INCLUDE 'intranet-bottom.inc' %]