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 %]
45 [% IF ( budget_period_id ) %]
46 Modify budget [% budget_period_description | html %]
49 [% END %] › [% END %]
51 [% IF ( duplicate_form ) %]
52 Duplicate budget › [% END %]
54 [% IF ( delete_confirm ) %]
55 Delete budget '[% budget_period_description | html %]'? › [% END %]
57 [% IF ( delete_confirmed ) %]
58 Data deleted › [% END %]
61 Close budget [% budget_period_description | html %] › [% END %]
64 Budget [% budget_period_description | html %] closed › [% END %]
66 Budgets › Administration › Koha
73 <body id="admin_aqbudgetperiods" class="admin">
75 [% INCLUDE 'header.inc' %]
76 [% INCLUDE 'budgets-admin-search.inc' %]
78 <!-- ################################################################################# -->
80 <!-- ################################################################################# -->
82 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
85 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
88 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
93 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
95 [% IF ( budget_period_id ) %]
97 <a href="#" aria-current="page">
98 Modify budget '[% budget_period_description | html %]'
103 <a href="#" aria-current="page">
110 [% IF ( delete_confirm ) %]
112 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
114 [% IF ( total || funds_exist ) %]
116 <a href="#" aria-current="page">
117 Cannot delete budget '[% budget_period_description | html %]'
122 <a href="#" aria-current="page">
123 Delete budget '[% budget_period_description | html %]'?
129 [% IF ( duplicate_form ) %]
131 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
134 <a href="#" aria-current="page">
142 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
145 <a href="#" aria-current="page">
146 Close budget [% budget_period_description | html %]
153 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
156 <a href="#" aria-current="page">
157 Budget [% budget_period_description | html %] closed
164 <a href="#" aria-current="page">
165 Budgets administration
172 <div class="main container-fluid">
174 <div class="col-sm-10 col-sm-push-2">
177 [% UNLESS close_form OR closed OR duplicate_form %]
178 [% INCLUDE 'budgets-admin-toolbar.inc' %]
181 [% IF ( duplicate_form ) %]
182 <h3>Duplicate budget</h3>
183 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
184 <fieldset class="rows">
185 <input type="hidden" name="op" value="duplicate_budget" />
186 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
191 <label class="required" for="from">Start date: </label>
192 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
193 <span class="required">Required</span>
194 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
198 <label class="required" for="to">End date: </label>
199 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
200 <span class="required">Required</span>
201 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
205 <label class="required" for="budget_period_description">Description</label>
206 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
207 <span class="required">Required</span>
211 <label for="amount_change_percentage">Change amounts by</label>
212 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
213 <div class="hint">(can be positive or negative)</div>
217 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
218 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
219 <div class="hint">(amounts will be rounded down)</div>
223 <label for="mark_as_inactive">Mark the original budget as inactive</label>
224 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
228 <label for="reset_all_budgets">Set all funds to zero</label>
229 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
235 <fieldset class="action">
236 <input type="submit" value="Save" />
237 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
244 [% IF ( add_form ) %]
245 <!-- add or modify a budget period -->
247 [% IF ( budget_period_id ) %]
248 <h3>Modify budget <em>[% budget_period_description | html %]</em></h3>
252 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
253 <fieldset class="rows">
254 <!-- ################################################################################# -->
255 <!-- display information about the budget period that must be added or modified -->
256 <!-- ################################################################################# -->
257 <input type="hidden" name="op" value="add_validate" />
258 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
261 <label class="required" for="from">Start date: </label>
262 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
263 <span class="required">Required</span>
264 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
268 <label class="required" for="to">End date: </label>
269 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
270 <span class="required">Required</span>
271 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
276 <!-- ############################## -->
277 <label class="required" for="budget_period_description">Description: </label>
278 <input type="text" id="budget_period_description" name="budget_period_description"
279 size="48" maxlength="80" value="[% budget_period_description | html %]" />
280 <span class="required">Required</span>
285 <!-- ############################## -->
286 <label for="budget_period_total">Total amount: </label>
287 <input type="text" id="budget_period_total" name="budget_period_total"
288 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
293 <!-- ############################## -->
294 <label for="budget_period_active">Make budget active: </label>
295 [% 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 %]
300 <!-- ############################## -->
301 <label for="budget_period_locked">Lock budget: </label>
302 [% 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 %]
307 <fieldset class="action">
308 <!-- "save changes" button -->
309 <!-- ###################################### -->
310 <input type="submit" value="Save" />
311 [% IF ( budget_period_id ) %]
312 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
314 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
322 <!-- ####################################################################### -->
323 <!-- delete a budget period -->
324 <!-- ####################################################################### -->
326 [% IF ( delete_confirm ) %]
328 <div class="dialog message">
329 <h3>Cannot delete budget</h3>
330 <p><strong>This record is used [% total | html %] times</strong>
331 . Deletion is not possible.</p>
332 [% ELSIF ( funds_exist ) %]
333 <div class="dialog message">
334 <h3>Cannot delete budget</h3>
335 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
337 <div class="dialog alert">
338 <h3>Delete budget '[% budget_period_description | html %]'?</h3>
340 <!-- ############################################################# -->
341 <!-- "delete" and "cancel" buttons -->
342 <!-- ############################################################# -->
344 <form action="[% script_name | html %]" method="post">
345 <input type="hidden" name="op" value="delete_confirmed" />
346 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
347 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
349 <form action="[% script_name | html %]" method="post">
350 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
358 [% IF budget_periods.size == 0 %]
359 You cannot move funds of this budget, there is no active budget.
360 Please create a new active budget and retry.
361 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
362 [% ELSIF number_of_unreceived_orders == 0 %]
363 There are no unreceived orders for this budget.
364 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
366 <h3>The unreceived orders from the following funds will be moved</h3>
367 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
374 <th>Unreceived orders</th>
378 [% FOREACH budget IN budgets_to_move %]
380 <td>[% budget.budget_id | html %]</td>
381 <td>[% budget.budget_code | html %]</td>
382 <td>[% budget.budget_name | html %]</td>
383 <td>[% budget.unreceived_orders.size | html %]</td>
388 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
389 <fieldset class="rows">
392 <label class="required" for="to_budget_period_id">Select a budget</label>
393 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
394 <option value=""></option>
395 [% FOR budget_period IN budget_periods %]
396 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
401 <label for="move_remaining_unspent">Move remaining unspent funds</label>
402 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
406 <fieldset class="action">
407 <input type="hidden" name="op" value="close_confirmed" />
408 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
409 <input type="submit" value="Move unreceived orders" />
410 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
415 <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>
417 <table id="closed_report">
427 [% FOR r IN report %]
429 [% IF r.orders_moved.size > 0 %]
430 [% FOR order IN r.orders_moved %]
432 <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>
433 <td>[% order.basketname | html %]</td>
434 <td>[% order.ordernumber | html %]</td>
440 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
443 <td>There were no unreceived orders for this fund.</td>
447 [% IF r.error == 'budget_code_not_exists' %]
449 <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>
452 <td>This fund code does not exist in the destination budget.</td>
460 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
463 <!-- DEFAULT display budget periods list -->
465 <h2>Budgets administration</h2>
467 [% IF ( failed_delete_funds_exist ) %]
468 <div class="dialog message">Failed to delete budget because funds exist.</div>
471 [% INCLUDE 'budgets-active-currency.inc' %]
473 <div id="budgetsTabs" class="toptabs">
475 <li><a href="#active">Active budgets</a></li>
476 <li><a href="#inactive">Inactive budgets</a></li>
480 [% IF ( period_active_loop ) %]
481 <table id="activeperiodst">
489 <th class="noExport">Actions</th>
493 [% FOREACH period_active IN period_active_loop %]
495 <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>
496 <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
497 <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
499 [% IF ( period_active.budget_period_locked ) %]
500 <i class="fa fa-lock"></i> Locked</span>
503 <td class="data">[% period_active.budget_period_total | $Price %]</td>
505 [% PROCESS action_menu block_budget=period_active %]
516 [% IF ( period_inactive_loop ) %]
517 <table id="inactiveperiodst">
525 <th class="noExport">Actions</th>
529 [% FOREACH period_loo IN period_inactive_loop %]
531 <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>
532 <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
533 <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
534 <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
535 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
537 [% PROCESS action_menu block_budget=period_loo %]
551 </div> <!-- /.col-sm-10.col-sm-push-2 -->
553 <div class="col-sm-2 col-sm-pull-10">
555 [% INCLUDE 'acquisitions-menu.inc' %]
557 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
558 </div> <!-- /.row -->
560 [% MACRO jsinclude BLOCK %]
561 [% INCLUDE 'calendar.inc' %]
562 [% INCLUDE 'datatables.inc' %]
564 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
566 [% Asset.js("js/acq.js") | $raw %]
568 $(document).ready(function() {
569 var tabs = $('#budgetsTabs').tabs();
571 tabs.tabs("option", "active", [% tab | html %]);
573 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
575 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
577 "sPaginationType": "full",
582 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
585 $("#move_form").submit(function(){
586 var budget_from = "[% budget_period_description | html %]";
587 var budget_to = $("#to_budget_period_id").find("option:selected").html();
588 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
589 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
590 return confirm ( alert_message );
594 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
595 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
596 "fnDrawCallback": function ( oSettings ) {
597 if ( oSettings.aiDisplay.length == 0 )
602 var nTrs = $('#closed_report tbody tr');
603 var iColspan = nTrs[1].getElementsByTagName('td').length;
605 for ( var i=0 ; i<nTrs.length ; i++ )
607 var iDisplayIndex = oSettings._iDisplayStart + i;
608 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
609 if ( sGroup != sLastGroup )
611 var nGroup = document.createElement( 'tr' );
612 var nCell = document.createElement( 'td' );
613 nCell.colSpan = iColspan;
614 nCell.className = "group";
615 nCell.innerHTML = sGroup;
616 nGroup.appendChild( nCell );
617 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
623 { "bVisible": false, "aTargets": [ 0, 1 ] },
624 { "bSortable": false, "aTargets": ["_all"] }
627 'aaSortingFixed': [[ 1, 'asc' ]],
629 "sPaginationType": "full_numbers"
632 $("#add_modify_budget").validate({
634 budget_period_startdate: "required",
635 budget_period_enddate: {
637 date_on_or_after: "#from"
639 budget_period_description: "required",
640 budget_period_total: {
645 budget_period_enddate: {
646 date_on_or_after: _("Budget end date must be on or after budget start date")
653 [% INCLUDE 'intranet-bottom.inc' %]