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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
83 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
86 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
91 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
93 [% IF ( budget_period_id ) %]
95 <a href="#" aria-current="page">
96 Modify budget '[% budget_period_description | html %]'
101 <a href="#" aria-current="page">
108 [% IF ( delete_confirm ) %]
110 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
112 [% IF ( total || funds_exist ) %]
114 <a href="#" aria-current="page">
115 Cannot delete budget '[% budget_period_description | html %]'
120 <a href="#" aria-current="page">
121 Delete budget '[% budget_period_description | html %]'?
127 [% IF ( duplicate_form ) %]
129 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
132 <a href="#" aria-current="page">
140 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
143 <a href="#" aria-current="page">
144 Close budget [% budget_period_description | html %]
151 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
154 <a href="#" aria-current="page">
155 Budget [% budget_period_description | html %] closed
162 <a href="#" aria-current="page">
163 Budgets administration
170 <div class="main container-fluid">
172 <div class="col-sm-10 col-sm-push-2">
175 [% UNLESS close_form OR closed OR duplicate_form %]
176 [% INCLUDE 'budgets-admin-toolbar.inc' %]
179 [% IF ( duplicate_form ) %]
180 <h3>Duplicate budget</h3>
181 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
182 <fieldset class="rows">
183 <input type="hidden" name="op" value="duplicate_budget" />
184 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
189 <label class="required" for="from">Start date: </label>
190 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
191 <span class="required">Required</span>
192 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
196 <label class="required" for="to">End date: </label>
197 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
198 <span class="required">Required</span>
199 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
203 <label class="required" for="budget_period_description">Description</label>
204 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
205 <span class="required">Required</span>
209 <label for="amount_change_percentage">Change amounts by</label>
210 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
211 <div class="hint">(can be positive or negative)</div>
215 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
216 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
217 <div class="hint">(amounts will be rounded down)</div>
221 <label for="mark_as_inactive">Mark the original budget as inactive</label>
222 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
226 <label for="reset_all_budgets">Set all funds to zero</label>
227 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
233 <fieldset class="action">
234 <input type="submit" value="Save" />
235 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
242 [% IF ( add_form ) %]
243 <!-- add or modify a budget period -->
245 [% IF ( budget_period_id ) %]
246 <h3>Modify budget <em>[% budget_period_description | html %]</em></h3>
250 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
251 <fieldset class="rows">
252 <!-- ################################################################################# -->
253 <!-- display information about the budget period that must be added or modified -->
254 <!-- ################################################################################# -->
255 <input type="hidden" name="op" value="add_validate" />
256 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
259 <label class="required" for="from">Start date: </label>
260 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
261 <span class="required">Required</span>
262 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
266 <label class="required" for="to">End date: </label>
267 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
268 <span class="required">Required</span>
269 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
274 <!-- ############################## -->
275 <label class="required" for="budget_period_description">Description: </label>
276 <input type="text" id="budget_period_description" name="budget_period_description"
277 size="48" maxlength="80" value="[% budget_period_description | html %]" />
278 <span class="required">Required</span>
283 <!-- ############################## -->
284 <label for="budget_period_total">Total amount: </label>
285 <input type="text" id="budget_period_total" name="budget_period_total"
286 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
291 <!-- ############################## -->
292 <label for="budget_period_active">Make budget active: </label>
293 [% 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 %]
298 <!-- ############################## -->
299 <label for="budget_period_locked">Lock budget: </label>
300 [% 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 %]
305 <fieldset class="action">
306 <!-- "save changes" button -->
307 <!-- ###################################### -->
308 <input type="submit" value="Save" />
309 [% IF ( budget_period_id ) %]
310 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
312 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
320 <!-- ####################################################################### -->
321 <!-- delete a budget period -->
322 <!-- ####################################################################### -->
324 [% IF ( delete_confirm ) %]
326 <div class="dialog message">
327 <h3>Cannot delete budget</h3>
328 <p><strong>This record is used [% total | html %] times</strong>
329 . Deletion is not possible.</p>
330 [% ELSIF ( funds_exist ) %]
331 <div class="dialog message">
332 <h3>Cannot delete budget</h3>
333 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
335 <div class="dialog alert">
336 <h3>Delete budget '[% budget_period_description | html %]'?</h3>
338 <!-- ############################################################# -->
339 <!-- "delete" and "cancel" buttons -->
340 <!-- ############################################################# -->
342 <form action="[% script_name | html %]" method="post">
343 <input type="hidden" name="op" value="delete_confirmed" />
344 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
345 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
347 <form action="[% script_name | html %]" method="post">
348 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
356 [% IF budget_periods.size == 0 %]
357 You cannot move funds of this budget, there is no active budget.
358 Please create a new active budget and retry.
359 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
360 [% ELSIF number_of_unreceived_orders == 0 %]
361 There are no unreceived orders for this budget.
362 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
364 <h3>The unreceived orders from the following funds will be moved</h3>
365 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
372 <th>Unreceived orders</th>
376 [% FOREACH budget IN budgets_to_move %]
378 <td>[% budget.budget_id | html %]</td>
379 <td>[% budget.budget_code | html %]</td>
380 <td>[% budget.budget_name | html %]</td>
381 <td>[% budget.unreceived_orders.size | html %]</td>
386 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
387 <fieldset class="rows">
390 <label class="required" for="to_budget_period_id">Select a budget</label>
391 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
392 <option value=""></option>
393 [% FOR budget_period IN budget_periods %]
394 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
399 <label for="move_remaining_unspent">Move remaining unspent funds</label>
400 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
404 <fieldset class="action">
405 <input type="hidden" name="op" value="close_confirmed" />
406 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
407 <input type="submit" value="Move unreceived orders" />
408 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
413 <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>
415 <table id="closed_report">
425 [% FOR r IN report %]
427 [% IF r.orders_moved.size > 0 %]
428 [% FOR order IN r.orders_moved %]
430 <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>
431 <td>[% order.basketname | html %]</td>
432 <td>[% order.ordernumber | html %]</td>
438 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
441 <td>There were no unreceived orders for this fund.</td>
445 [% IF r.error == 'budget_code_not_exists' %]
447 <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>
450 <td>This fund code does not exist in the destination budget.</td>
458 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
461 <!-- DEFAULT display budget periods list -->
463 <h2>Budgets administration</h2>
465 [% IF ( failed_delete_funds_exist ) %]
466 <div class="dialog message">Failed to delete budget because funds exist.</div>
469 [% INCLUDE 'budgets-active-currency.inc' %]
471 <div id="budgetsTabs" class="toptabs">
473 <li><a href="#active">Active budgets</a></li>
474 <li><a href="#inactive">Inactive budgets</a></li>
478 [% IF ( period_active_loop ) %]
479 <table id="activeperiodst">
487 <th class="noExport">Actions</th>
491 [% FOREACH period_active IN period_active_loop %]
493 <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>
494 <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
495 <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
497 [% IF ( period_active.budget_period_locked ) %]
498 <i class="fa fa-lock"></i> Locked</span>
501 <td class="data">[% period_active.budget_period_total | $Price %]</td>
503 [% PROCESS action_menu block_budget=period_active %]
514 [% IF ( period_inactive_loop ) %]
515 <table id="inactiveperiodst">
523 <th class="noExport">Actions</th>
527 [% FOREACH period_loo IN period_inactive_loop %]
529 <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>
530 <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
531 <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
532 <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
533 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
535 [% PROCESS action_menu block_budget=period_loo %]
549 </div> <!-- /.col-sm-10.col-sm-push-2 -->
551 <div class="col-sm-2 col-sm-pull-10">
553 [% INCLUDE 'acquisitions-menu.inc' %]
555 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
556 </div> <!-- /.row -->
558 [% MACRO jsinclude BLOCK %]
559 [% INCLUDE 'calendar.inc' %]
560 [% INCLUDE 'datatables.inc' %]
562 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
564 [% Asset.js("js/acq.js") | $raw %]
566 $(document).ready(function() {
567 var tabs = $('#budgetsTabs').tabs();
569 tabs.tabs("option", "active", [% tab | html %]);
571 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
573 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
575 "sPaginationType": "full",
580 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
583 $("#move_form").submit(function(){
584 var budget_from = "[% budget_period_description | html %]";
585 var budget_to = $("#to_budget_period_id").find("option:selected").html();
586 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
587 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
588 return confirm ( alert_message );
592 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
593 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
594 "fnDrawCallback": function ( oSettings ) {
595 if ( oSettings.aiDisplay.length == 0 )
600 var nTrs = $('#closed_report tbody tr');
601 var iColspan = nTrs[1].getElementsByTagName('td').length;
603 for ( var i=0 ; i<nTrs.length ; i++ )
605 var iDisplayIndex = oSettings._iDisplayStart + i;
606 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
607 if ( sGroup != sLastGroup )
609 var nGroup = document.createElement( 'tr' );
610 var nCell = document.createElement( 'td' );
611 nCell.colSpan = iColspan;
612 nCell.className = "group";
613 nCell.innerHTML = sGroup;
614 nGroup.appendChild( nCell );
615 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
621 { "bVisible": false, "aTargets": [ 0, 1 ] },
622 { "bSortable": false, "aTargets": ["_all"] }
625 'aaSortingFixed': [[ 1, 'asc' ]],
627 "sPaginationType": "full_numbers"
630 $("#add_modify_budget").validate({
632 budget_period_startdate: "required",
633 budget_period_enddate: {
635 date_on_or_after: "#from"
637 budget_period_description: "required",
638 budget_period_total: {
643 budget_period_enddate: {
644 date_on_or_after: _("Budget end date must be on or after budget start date")
651 [% INCLUDE 'intranet-bottom.inc' %]