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 <h1>Duplicate budget</h1>
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="flatpickr" data-date_to="to" />
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="flatpickr" />
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 <h1>Modify budget <em>[% budget_period_description | html %]</em></h1>
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="flatpickr" data-date_to="to" />
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="flatpickr" />
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 <h1>Cannot delete budget</h1>
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 <h1>Cannot delete budget</h1>
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 <h1>Delete budget '[% budget_period_description | html %]'?</h1>
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 <h1>Close budget [% budget_period_description | html %]</h1>
359 [% IF budget_periods.size == 0 %]
360 <span>You cannot move funds of this budget, there is no active budget.
361 Please create a new active budget and retry.</span>
362 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
363 [% ELSIF number_of_unreceived_orders == 0 %]
364 <span>There are no unreceived orders for this budget.</span>
365 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
367 <h3>The unreceived orders from the following funds will be moved</h3>
368 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
375 <th>Unreceived orders</th>
379 [% FOREACH budget IN budgets_to_move %]
381 <td>[% budget.budget_id | html %]</td>
382 <td>[% budget.budget_code | html %]</td>
383 <td>[% budget.budget_name | html %]</td>
384 <td>[% budget.unreceived_orders.size | html %]</td>
389 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
390 <fieldset class="rows">
393 <label class="required" for="to_budget_period_id">Select a budget</label>
394 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
395 <option value=""></option>
396 [% FOR budget_period IN budget_periods %]
397 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
402 <label for="move_remaining_unspent">Move remaining unspent funds</label>
403 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
407 <fieldset class="action">
408 <input type="hidden" name="op" value="close_confirmed" />
409 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
410 <input type="submit" value="Move unreceived orders" />
411 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
416 <h1>Budget [% budget_period_description | html %] closed</h1>
417 <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>
419 <table id="closed_report">
429 [% FOR r IN report %]
431 [% IF r.orders_moved.size > 0 %]
432 [% FOR order IN r.orders_moved %]
434 <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>
435 <td>[% order.basketname | html %]</td>
436 <td>[% order.ordernumber | html %]</td>
442 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
445 <td>There were no unreceived orders for this fund.</td>
449 [% IF r.error == 'budget_code_not_exists' %]
451 <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>
454 <td>This fund code does not exist in the destination budget.</td>
462 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
465 <!-- DEFAULT display budget periods list -->
467 <h1>Budgets administration</h1>
469 [% IF ( failed_delete_funds_exist ) %]
470 <div class="dialog message">Failed to delete budget because funds exist.</div>
473 [% INCLUDE 'budgets-active-currency.inc' %]
475 <div id="budgetsTabs" class="toptabs">
476 <ul class="nav nav-tabs" role="tablist">
477 <li role="presentation" class="active">
478 <a href="#active" aria-controls="active" role="tab" data-toggle="tab">Active budgets</a>
480 <li role="presentation">
481 <a href="#inactive" aria-controls="inactive" role="tab" data-toggle="tab">Inactive budgets</a>
484 <div class="tab-content">
485 <div id="active" role="tabpanel" class="tab-pane active">
486 [% IF ( period_active_loop ) %]
487 <table id="activeperiodst">
495 <th class="noExport">Actions</th>
499 [% FOREACH period_active IN period_active_loop %]
501 <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>
502 <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
503 <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
505 [% IF ( period_active.budget_period_locked ) %]
506 <i class="fa fa-lock"></i> Locked</span>
509 <td class="data">[% period_active.budget_period_total | $Price %]</td>
511 [% PROCESS action_menu block_budget=period_active %]
521 <div id="inactive" role="tabpanel" class="tab-pane">
522 [% IF ( period_inactive_loop ) %]
523 <table id="inactiveperiodst">
531 <th class="noExport">Actions</th>
535 [% FOREACH period_loo IN period_inactive_loop %]
537 <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>
538 <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
539 <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
540 <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
541 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
543 [% PROCESS action_menu block_budget=period_loo %]
553 </div> <!-- /.tab-content -->
558 </div> <!-- /.col-sm-10.col-sm-push-2 -->
560 <div class="col-sm-2 col-sm-pull-10">
562 [% INCLUDE 'acquisitions-menu.inc' %]
564 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
565 </div> <!-- /.row -->
567 [% MACRO jsinclude BLOCK %]
568 [% INCLUDE 'calendar.inc' %]
569 [% INCLUDE 'datatables.inc' %]
571 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
573 [% Asset.js("js/acq.js") | $raw %]
575 $(document).ready(function() {
577 $("#budgetsTabs li:eq([% tab | html %]) a").tab("show");
580 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
582 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
584 "sPaginationType": "full",
589 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
592 $("#move_form").submit(function(){
593 var budget_from = "[% budget_period_description | html %]";
594 var budget_to = $("#to_budget_period_id").find("option:selected").html();
595 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
596 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
597 return confirm ( alert_message );
601 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
602 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
603 "fnDrawCallback": function ( oSettings ) {
604 if ( oSettings.aiDisplay.length == 0 )
609 var nTrs = $('#closed_report tbody tr');
610 var iColspan = nTrs[1].getElementsByTagName('td').length;
612 for ( var i=0 ; i<nTrs.length ; i++ )
614 var iDisplayIndex = oSettings._iDisplayStart + i;
615 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
616 if ( sGroup != sLastGroup )
618 var nGroup = document.createElement( 'tr' );
619 var nCell = document.createElement( 'td' );
620 nCell.colSpan = iColspan;
621 nCell.className = "group";
622 nCell.innerHTML = sGroup;
623 nGroup.appendChild( nCell );
624 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
630 { "bVisible": false, "aTargets": [ 0, 1 ] },
631 { "bSortable": false, "aTargets": ["_all"] }
634 'aaSortingFixed': [[ 1, 'asc' ]],
636 "sPaginationType": "full_numbers"
639 $("#add_modify_budget").validate({
641 budget_period_startdate: "required",
642 budget_period_enddate: {
644 date_on_or_after: "#from"
646 budget_period_description: "required",
647 budget_period_total: {
652 budget_period_enddate: {
653 date_on_or_after: _("Budget end date must be on or after budget start date")
660 [% INCLUDE 'intranet-bottom.inc' %]