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 [% WRAPPER 'header.inc' %]
76 [% INCLUDE 'budgets-admin-search.inc' %]
79 [% WRAPPER 'sub-header.inc' %]
80 [% WRAPPER breadcrumbs %]
81 [% WRAPPER breadcrumb_item %]
82 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
86 [% WRAPPER breadcrumb_item bc_active= 1 %]
87 <span>Budgets administration</span>
90 [% WRAPPER breadcrumb_item %]
91 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
96 [% IF ( budget_period_id ) %]
97 [% WRAPPER breadcrumb_item bc_active= 1 %]
98 <span>Modify budget '[% budget_period_description | html %]'</span>
101 [% WRAPPER breadcrumb_item bc_active= 1 %]
102 <span>Add budget</span>
107 [% IF ( delete_confirm ) %]
108 [% IF ( total || funds_exist ) %]
109 [% WRAPPER breadcrumb_item bc_active= 1 %]
110 <span>Cannot delete budget '[% budget_period_description | html %]'</span>
113 [% WRAPPER breadcrumb_item bc_active= 1 %]
114 <span>Delete budget '[% budget_period_description | html %]'?</span>
119 [% IF ( duplicate_form ) %]
120 [% WRAPPER breadcrumb_item bc_active= 1 %]
121 <span>Duplicate budget</span>
126 [% WRAPPER breadcrumb_item bc_active= 1 %]
127 <span>Close budget [% budget_period_description | html %]</span>
132 [% WRAPPER breadcrumb_item bc_active= 1 %]
133 <span>Budget [% budget_period_description | html %] closed</span>
136 [% END #/ WRAPPER breadcrumbs %]
137 [% END #/ WRAPPER sub-header.inc %]
139 <div class="main container-fluid">
141 <div class="col-sm-10 col-sm-push-2">
144 [% UNLESS close_form OR closed OR duplicate_form %]
145 [% INCLUDE 'budgets-admin-toolbar.inc' %]
148 [% IF ( duplicate_form ) %]
149 <h1>Duplicate budget</h1>
150 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
151 <fieldset class="rows">
152 <input type="hidden" name="op" value="duplicate_budget" />
153 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
158 <label class="required" for="from">Start date: </label>
159 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
160 <span class="required">Required</span>
161 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
165 <label class="required" for="to">End date: </label>
166 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
167 <span class="required">Required</span>
168 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
172 <label class="required" for="budget_period_description">Description</label>
173 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
174 <span class="required">Required</span>
178 <label for="amount_change_percentage">Change amounts by</label>
179 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
180 <div class="hint">(can be positive or negative)</div>
184 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
185 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
186 <div class="hint">(amounts will be rounded down)</div>
190 <label for="mark_as_inactive">Mark the original budget as inactive</label>
191 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
195 <label for="reset_all_budgets">Set all funds to zero</label>
196 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
202 <fieldset class="action">
203 <input type="submit" class="btn btn-primary" value="Save" />
204 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
211 [% IF ( add_form ) %]
212 <!-- add or modify a budget period -->
214 [% IF ( budget_period_id ) %]
215 <h1>Modify budget <em>[% budget_period_description | html %]</em></h1>
219 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
220 <fieldset class="rows">
221 <!-- ################################################################################# -->
222 <!-- display information about the budget period that must be added or modified -->
223 <!-- ################################################################################# -->
224 <input type="hidden" name="op" value="add_validate" />
225 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
228 <label class="required" for="from">Start date: </label>
229 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
230 <span class="required">Required</span>
231 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
235 <label class="required" for="to">End date: </label>
236 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
237 <span class="required">Required</span>
238 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
243 <!-- ############################## -->
244 <label class="required" for="budget_period_description">Description: </label>
245 <input type="text" id="budget_period_description" name="budget_period_description"
246 size="48" maxlength="80" value="[% budget_period_description | html %]" />
247 <span class="required">Required</span>
252 <!-- ############################## -->
253 <label for="budget_period_total">Total amount: </label>
254 <input type="text" id="budget_period_total" name="budget_period_total"
255 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
260 <!-- ############################## -->
261 <label for="budget_period_active">Make budget active: </label>
262 [% 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 %]
267 <!-- ############################## -->
268 <label for="budget_period_locked">Lock budget: </label>
269 [% 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 %]
274 <fieldset class="action">
275 <!-- "save changes" button -->
276 <!-- ###################################### -->
277 <input type="submit" class="btn btn-primary" value="Save" />
278 [% IF ( budget_period_id ) %]
279 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
281 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
289 <!-- ####################################################################### -->
290 <!-- delete a budget period -->
291 <!-- ####################################################################### -->
293 [% IF ( delete_confirm ) %]
295 <div class="dialog message">
296 <h1>Cannot delete budget</h1>
297 <p><strong>This record is used [% total | html %] times</strong>
298 . Deletion is not possible.</p>
299 [% ELSIF ( funds_exist ) %]
300 <div class="dialog message">
301 <h1>Cannot delete budget</h1>
302 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
304 <div class="dialog alert">
305 <h1>Delete budget '[% budget_period_description | html %]'?</h1>
307 <!-- ############################################################# -->
308 <!-- "delete" and "cancel" buttons -->
309 <!-- ############################################################# -->
311 <form action="[% script_name | html %]" method="post">
312 <input type="hidden" name="op" value="delete_confirmed" />
313 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
314 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
316 <form action="[% script_name | html %]" method="post">
317 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
325 <h1>Close budget [% budget_period_description | html %]</h1>
326 [% IF budget_periods.size == 0 %]
327 <span>You cannot move funds of this budget, there is no active budget.
328 Please create a new active budget and retry.</span>
329 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
330 [% ELSIF number_of_unreceived_orders == 0 %]
331 <span>There are no unreceived orders for this budget.</span>
332 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
334 <div class="page-section">
335 <h3>The unreceived orders from the following funds will be moved</h3>
336 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
343 <th>Unreceived orders</th>
347 [% FOREACH budget IN budgets_to_move %]
349 <td>[% budget.budget_id | html %]</td>
350 <td>[% budget.budget_code | html %]</td>
351 <td>[% budget.budget_name | html %]</td>
352 <td>[% budget.unreceived_orders.size | html %]</td>
357 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
358 <fieldset class="rows">
361 <label class="required" for="to_budget_period_id">Select a budget</label>
362 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
363 <option value=""></option>
364 [% FOR budget_period IN budget_periods %]
365 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
370 <label for="move_remaining_unspent">Move remaining unspent funds</label>
371 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
375 <fieldset class="action">
376 <input type="hidden" name="op" value="close_confirmed" />
377 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
378 <input type="submit" class="btn btn-primary" value="Move unreceived orders" />
379 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
382 </div><!-- /.page-section -->
385 <h1>Budget [% budget_period_description | html %] closed</h1>
387 <div class="page-section">
388 <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>
390 <table id="closed_report">
400 [% FOR r IN report %]
402 [% IF r.orders_moved.size > 0 %]
403 [% FOR order IN r.orders_moved %]
405 <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>
406 <td>[% order.basketname | html %]</td>
407 <td>[% order.ordernumber | html %]</td>
413 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
416 <td>There were no unreceived orders for this fund.</td>
420 [% IF r.error == 'budget_code_not_exists' %]
422 <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>
425 <td>This fund code does not exist in the destination budget.</td>
433 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
437 <!-- DEFAULT display budget periods list -->
439 <h1>Budgets administration</h1>
441 [% IF ( failed_delete_funds_exist ) %]
442 <div class="dialog message">Failed to delete budget because funds exist.</div>
445 [% INCLUDE 'budgets-active-currency.inc' %]
447 [% WRAPPER tabs id= "budgetsTabs" %]
449 [% WRAPPER tabs_nav %]
450 [% WRAPPER tab_item tabname= "active" bt_active= 1 %] <span>Active budgets</span> [% END %]
451 [% WRAPPER tab_item tabname= "inactive" %] <span>Inactive budgets</span> [% END %]
452 [% END # /WRAPPER tabs_nav %]
454 [% WRAPPER tab_panels %]
455 [% WRAPPER tab_panel tabname="active" bt_active= 1 %]
456 [% IF ( period_active_loop ) %]
457 <table id="activeperiodst">
465 <th class="noExport">Actions</th>
469 [% FOREACH period_active IN period_active_loop %]
471 <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>
472 <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
473 <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
475 [% IF ( period_active.budget_period_locked ) %]
476 <i class="fa fa-lock"></i> Locked</span>
479 <td class="data">[% period_active.budget_period_total | $Price %]</td>
481 [% PROCESS action_menu block_budget=period_active %]
484 [% END # /FOREACH period_active %]
486 </table> <!-- /#activeperiodst -->
488 <span>No active budgets</span>
489 [% END # /IF period_active_loop %]
490 [% END # /WRAPPER tab_panel#active %]
492 [% WRAPPER tab_panel tabname="inactive" %]
493 [% IF ( period_inactive_loop ) %]
494 <table id="inactiveperiodst">
502 <th class="noExport">Actions</th>
506 [% FOREACH period_loo IN period_inactive_loop %]
508 <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>
509 <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
510 <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
511 <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
512 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
514 [% PROCESS action_menu block_budget=period_loo %]
517 [% END # /FOREACH period_loo %]
519 </table> <!-- /#inactiveperiodst -->
521 <span>No inactive budgets</span>
522 [% END # /IF inactiveperiodst %]
523 [% END # /WRAPPER tab_panel#inactive %]
524 [% END # /WRAPPER tab_panels %]
525 [% END # /WRAPPER tabs %]
530 </div> <!-- /.col-sm-10.col-sm-push-2 -->
532 <div class="col-sm-2 col-sm-pull-10">
534 [% INCLUDE 'acquisitions-menu.inc' %]
536 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
537 </div> <!-- /.row -->
539 [% MACRO jsinclude BLOCK %]
540 [% INCLUDE 'calendar.inc' %]
541 [% INCLUDE 'datatables.inc' %]
543 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
545 [% Asset.js("js/acq.js") | $raw %]
547 $(document).ready(function() {
549 $("#budgetsTabs li:eq([% tab | html %]) a").tab("show");
552 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
554 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
556 "sPaginationType": "full",
561 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
564 $("#move_form").submit(function(){
565 var budget_from = "[% budget_period_description | html %]";
566 var budget_to = $("#to_budget_period_id").find("option:selected").html();
567 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
568 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
569 return confirm ( alert_message );
573 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
574 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
575 "fnDrawCallback": function ( oSettings ) {
576 if ( oSettings.aiDisplay.length == 0 )
581 var nTrs = $('#closed_report tbody tr');
582 var iColspan = nTrs[1].getElementsByTagName('td').length;
584 for ( var i=0 ; i<nTrs.length ; i++ )
586 var iDisplayIndex = oSettings._iDisplayStart + i;
587 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
588 if ( sGroup != sLastGroup )
590 var nGroup = document.createElement( 'tr' );
591 var nCell = document.createElement( 'td' );
592 nCell.colSpan = iColspan;
593 nCell.className = "group";
594 nCell.innerHTML = sGroup;
595 nGroup.appendChild( nCell );
596 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
602 { "bVisible": false, "aTargets": [ 0, 1 ] },
603 { "bSortable": false, "aTargets": ["_all"] }
606 'aaSortingFixed': [[ 1, 'asc' ]],
608 "sPaginationType": "full_numbers"
611 $("#add_modify_budget").validate({
613 budget_period_startdate: "required",
614 budget_period_enddate: {
616 date_on_or_after: "#from"
618 budget_period_description: "required",
619 budget_period_total: {
624 budget_period_enddate: {
625 date_on_or_after: _("Budget end date must be on or after budget start date")
632 [% INCLUDE 'intranet-bottom.inc' %]