5 [% PROCESS 'i18n.inc' %]
7 [%- BLOCK action_menu %]
8 <div class="btn-group dropup">
9 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id | html %]" role="button" data-toggle="dropdown" href="#">
10 Actions <b class="caret"></b>
12 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id | html %]">
14 <a href="[% script_name | url %]?op=add_form&budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
16 [% IF block_budget.count %]
18 <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-can"></i> Delete</a>
22 <a href="[% script_name | url %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-trash-can"></i> Delete</a>
26 <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>
29 <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 [% IF ( block_budget.budget_period_locked ) %]
33 <a data-toggle="tooltip" data-placement="left" title="Budget is locked" href="#"><i class="fa fa-plus"></i> Add fund</a>
37 <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>
44 [% INCLUDE 'doc-head-open.inc' %]
45 [% INCLUDE 'doc-head-close.inc' %]
47 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
50 <title>[% FILTER collapse %]
52 [% IF ( budget_period_id ) %]
53 [% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
55 [% t("New budget") | html %]
58 [% IF ( duplicate_form ) %]
59 [% t("Duplicate budget") | html %] ›
61 [% IF ( delete_confirm ) %]
62 [% IF ( total || funds_exist ) %]
63 [% tx("Cannot delete budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] ›
65 [% tx("Confirm deletion of budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] ›
69 [% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %] ›
72 [% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %] ›
74 [% t("Budgets") | html %] ›
75 [% t("Administration") | html %] ›
76 [% t("Koha") | html %]
80 <body id="admin_aqbudgetperiods" class="admin">
82 [% WRAPPER 'header.inc' %]
83 [% INCLUDE 'budgets-admin-search.inc' %]
86 [% WRAPPER 'sub-header.inc' %]
87 [% WRAPPER breadcrumbs %]
88 [% WRAPPER breadcrumb_item %]
89 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
93 [% WRAPPER breadcrumb_item bc_active= 1 %]
97 [% WRAPPER breadcrumb_item %]
98 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a>
102 [% IF ( add_form ) %]
103 [% IF ( budget_period_id ) %]
104 [% WRAPPER breadcrumb_item bc_active= 1 %]
105 [% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
108 [% WRAPPER breadcrumb_item bc_active= 1 %]
109 <span>New budget</span>
114 [% IF ( delete_confirm ) %]
115 [% IF ( total || funds_exist ) %]
116 [% WRAPPER breadcrumb_item bc_active= 1 %]
117 [% tx("Cannot delete budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
120 [% WRAPPER breadcrumb_item bc_active= 1 %]
121 [% tx("Confirm deletion of budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
126 [% IF ( duplicate_form ) %]
127 [% WRAPPER breadcrumb_item bc_active= 1 %]
128 <span>Duplicate budget</span>
133 [% WRAPPER breadcrumb_item bc_active= 1 %]
134 [% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]
139 [% WRAPPER breadcrumb_item bc_active= 1 %]
140 [% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %]
143 [% END #/ WRAPPER breadcrumbs %]
144 [% END #/ WRAPPER sub-header.inc %]
146 <div class="main container-fluid">
148 <div class="col-sm-10 col-sm-push-2">
151 [% UNLESS close_form OR closed OR duplicate_form %]
152 [% INCLUDE 'budgets-admin-toolbar.inc' %]
155 [% IF ( duplicate_form ) %]
156 <h1>Duplicate budget</h1>
157 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
158 <fieldset class="rows">
159 <input type="hidden" name="op" value="duplicate_budget" />
160 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
165 <label class="required" for="from">Start date: </label>
166 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
167 <span class="required">Required</span>
168 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
172 <label class="required" for="to">End date: </label>
173 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
174 <span class="required">Required</span>
175 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
179 <label class="required" for="budget_period_description">Description</label>
180 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
181 <span class="required">Required</span>
185 <label for="amount_change_percentage">Change amounts by</label>
186 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
187 <div class="hint">(can be positive or negative)</div>
191 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
192 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
193 <div class="hint">(amounts will be rounded down)</div>
197 <label for="mark_as_inactive">Mark the original budget as inactive</label>
198 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
202 <label for="reset_all_budgets">Set all funds to zero</label>
203 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
209 <fieldset class="action">
210 <input type="submit" class="btn btn-primary" value="Save" />
211 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
218 [% IF ( add_form ) %]
219 <!-- add or modify a budget period -->
221 [% IF ( budget_period_id ) %]
222 <h1>[% tx("Modify budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]</h1>
226 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
227 <fieldset class="rows">
228 <!-- ################################################################################# -->
229 <!-- display information about the budget period that must be added or modified -->
230 <!-- ################################################################################# -->
231 <input type="hidden" name="op" value="add_validate" />
232 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
235 <label class="required" for="from">Start date: </label>
236 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | html %]" class="flatpickr" data-date_to="to" />
237 <span class="required">Required</span>
238 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
242 <label class="required" for="to">End date: </label>
243 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | html %]" class="flatpickr" />
244 <span class="required">Required</span>
245 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
250 <!-- ############################## -->
251 <label class="required" for="budget_period_description">Description: </label>
252 <input type="text" id="budget_period_description" name="budget_period_description"
253 size="48" maxlength="80" value="[% budget_period_description | html %]" />
254 <span class="required">Required</span>
259 <!-- ############################## -->
260 <label for="budget_period_total">Total amount: </label>
261 <input type="text" id="budget_period_total" name="budget_period_total"
262 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
267 <!-- ############################## -->
268 <label for="budget_period_active">Make budget active: </label>
269 [% 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 %]
274 <!-- ############################## -->
275 <label for="budget_period_locked">Lock budget: </label>
276 [% 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 %]
281 <fieldset class="action">
282 <!-- "save changes" button -->
283 <!-- ###################################### -->
284 <input type="submit" class="btn btn-primary" value="Save" />
285 [% IF ( budget_period_id ) %]
286 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
288 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
296 <!-- ####################################################################### -->
297 <!-- delete a budget period -->
298 <!-- ####################################################################### -->
300 [% IF ( delete_confirm ) %]
302 <div class="dialog message">
303 <h1>Cannot delete budget</h1>
304 <p><strong>This record is used [% total | html %] times</strong>.
305 Deletion is not possible.</p>
306 [% ELSIF ( funds_exist ) %]
307 <div class="dialog message">
308 <h1>Cannot delete budget</h1>
309 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
311 <div class="dialog alert">
312 <h1>[% tx("Confirm deletion of budget '{budget_period_description}'?", { budget_period_description = budget_period_description }) | html %]</h1>
314 <!-- ############################################################# -->
315 <!-- "delete" and "cancel" buttons -->
316 <!-- ############################################################# -->
318 <form action="[% script_name | html %]" method="post">
319 <input type="hidden" name="op" value="delete_confirmed" />
320 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
321 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
323 <form action="[% script_name | html %]" method="post">
324 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
332 <h1>[% tx("Close budget '{budget_period_description}'", { budget_period_description = budget_period_description }) | html %]</h1>
333 [% IF budget_periods.size == 0 %]
334 <div class="dialog alert">
335 <p>You cannot move funds of this budget, there is no active budget.</p>
336 <p>Please create a new active budget and retry.</p>
337 <a class="btn btn-default" href="/cgi-bin/koha/admin/aqbudgetperiods.pl"><i class="fa fa-fw fa-arrow-left"></i> Return to budgets</a>
339 [% ELSIF number_of_unreceived_orders == 0 %]
340 <div class="dialog message">
341 <h2>Cannot close budget</h2>
342 <p>There are no unreceived orders for this budget.</p>
343 <a class="btn btn-default" href="/cgi-bin/koha/admin/aqbudgetperiods.pl"><i class="fa fa-fw fa-arrow-left"></i> Return to budgets</a>
346 <div class="page-section">
347 <h3>The unreceived orders from the following funds will be moved</h3>
348 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
355 <th>Unreceived orders</th>
359 [% FOREACH budget IN budgets_to_move %]
361 <td>[% budget.budget_id | html %]</td>
362 <td>[% budget.budget_code | html %]</td>
363 <td>[% budget.budget_name | html %]</td>
364 <td>[% budget.unreceived_orders.size | html %]</td>
369 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
370 <fieldset class="rows">
373 <label class="required" for="to_budget_period_id">Select a budget</label>
374 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
375 <option value=""></option>
376 [% FOR budget_period IN budget_periods %]
377 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
382 <label for="move_remaining_unspent">Move remaining unspent funds</label>
383 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
387 <fieldset class="action">
388 <input type="hidden" name="op" value="close_confirmed" />
389 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
390 <input type="submit" class="btn btn-primary" value="Move unreceived orders" />
391 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
394 </div><!-- /.page-section -->
397 <h1>[% tx("Budget '{budget_period_description}' closed", { budget_period_description = budget_period_description }) | html %]</h1>
399 <div class="page-section">
400 <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>
402 <table id="closed_report">
412 [% FOR r IN report %]
414 [% IF r.orders_moved.size > 0 %]
415 [% FOR order IN r.orders_moved %]
417 <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>
418 <td>[% order.basketname | html %]</td>
419 <td>[% order.ordernumber | html %]</td>
425 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
428 <td>There were no unreceived orders for this fund.</td>
432 [% IF r.error == 'budget_code_not_exists' %]
434 <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>
437 <td>This fund code does not exist in the destination budget.</td>
445 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
449 <!-- DEFAULT display budget periods list -->
453 [% IF ( failed_delete_funds_exist ) %]
454 <div class="dialog message">Failed to delete budget because funds exist.</div>
457 [% INCLUDE 'budgets-active-currency.inc' %]
459 [% WRAPPER tabs id= "budgetsTabs" %]
461 [% WRAPPER tabs_nav %]
462 [% WRAPPER tab_item tabname= "active" bt_active= 1 %] <span>Active budgets</span> [% END %]
463 [% WRAPPER tab_item tabname= "inactive" %] <span>Inactive budgets</span> [% END %]
464 [% END # /WRAPPER tabs_nav %]
466 [% WRAPPER tab_panels %]
467 [% WRAPPER tab_panel tabname="active" bt_active= 1 %]
468 [% IF ( period_active_loop ) %]
469 <table id="activeperiodst">
477 <th class="noExport">Actions</th>
481 [% FOREACH period_active IN period_active_loop %]
483 <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>
484 <td data-order="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</td>
485 <td data-order="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</td>
487 [% IF ( period_active.budget_period_locked ) %]
488 <i class="fa fa-lock"></i> Locked</span>
491 <td class="data">[% period_active.budget_period_total | $Price %]</td>
493 [% PROCESS action_menu block_budget=period_active %]
496 [% END # /FOREACH period_active %]
498 </table> <!-- /#activeperiodst -->
500 <span>No active budgets</span>
501 [% END # /IF period_active_loop %]
502 [% END # /WRAPPER tab_panel#active %]
504 [% WRAPPER tab_panel tabname="inactive" %]
505 [% IF ( period_inactive_loop ) %]
506 <table id="inactiveperiodst">
514 <th class="noExport">Actions</th>
518 [% FOREACH period_loo IN period_inactive_loop %]
520 <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>
521 <td data-order="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</td>
522 <td data-order="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</td>
523 <td>[% IF ( period_loo.budget_period_locked ) %]<i class="fa fa-lock"></i> Locked[% END %]</td>
524 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
526 [% PROCESS action_menu block_budget=period_loo %]
529 [% END # /FOREACH period_loo %]
531 </table> <!-- /#inactiveperiodst -->
533 <span>No inactive budgets</span>
534 [% END # /IF inactiveperiodst %]
535 [% END # /WRAPPER tab_panel#inactive %]
536 [% END # /WRAPPER tab_panels %]
537 [% END # /WRAPPER tabs %]
542 </div> <!-- /.col-sm-10.col-sm-push-2 -->
544 <div class="col-sm-2 col-sm-pull-10">
546 [% INCLUDE 'acquisitions-menu.inc' %]
548 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
549 </div> <!-- /.row -->
551 [% MACRO jsinclude BLOCK %]
552 [% INCLUDE 'calendar.inc' %]
553 [% INCLUDE 'datatables.inc' %]
555 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
557 [% Asset.js("js/acq.js") | $raw %]
559 $(document).ready(function() {
561 $("#budgetsTabs li:eq([% tab | html %]) a").tab("show");
564 $('[data-toggle="tooltip"]').tooltip();
566 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
568 { "targets": [ -1 ], "orderable": false, "searchable": false },
570 "pagingType": "full",
575 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
578 $("#move_form").submit(function(){
579 var budget_from = "[% budget_period_description | html %]";
580 var budget_to = $("#to_budget_period_id").find("option:selected").html();
581 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
582 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
583 return confirm ( alert_message );
587 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
588 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
589 "drawCallback": function ( oSettings ) {
590 if ( oSettings.aiDisplay.length == 0 )
595 var nTrs = $('#closed_report tbody tr');
596 var iColspan = nTrs[1].getElementsByTagName('td').length;
598 for ( var i=0 ; i<nTrs.length ; i++ )
600 var iDisplayIndex = oSettings._iDisplayStart + i;
601 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
602 if ( sGroup != sLastGroup )
604 var nGroup = document.createElement( 'tr' );
605 var nCell = document.createElement( 'td' );
606 nCell.colSpan = iColspan;
607 nCell.className = "group";
608 nCell.innerHTML = sGroup;
609 nGroup.appendChild( nCell );
610 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
616 { "visible": false, "targets": [ 0, 1 ] },
617 { "orderable": false, "targets": ["_all"] }
620 "orderFixed": [[ 1, 'asc' ]],
622 "pagingType": "full_numbers"
625 $("#add_modify_budget").validate({
627 budget_period_startdate: "required",
628 budget_period_enddate: {
630 date_on_or_after: "#from"
632 budget_period_description: "required",
633 budget_period_total: {
638 budget_period_enddate: {
639 date_on_or_after: _("Budget end date must be on or after budget start date")
646 [% INCLUDE 'intranet-bottom.inc' %]