6 [%- BLOCK action_menu %]
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 | html %]?op=add_form&budget_period_id=[% block_budget.budget_period_id | html %]"><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 | html %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-trash"></i> Delete</a>
25 <a href="[% script_name | html %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id | html %]"><i class="fa fa-copy"></i> Duplicate</a>
28 <a href="[% script_name | html %]?op=close_form&budget_period_id=[% block_budget.budget_period_id | html %]"><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 | html %]"><i class="fa fa-plus"></i> Add fund</a>
37 [% INCLUDE 'doc-head-open.inc' %]
38 [% INCLUDE 'doc-head-close.inc' %]
39 [% Asset.css("css/datatables.css") | $raw %]
41 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
45 Koha › Administration › Budgets
47 [% IF ( add_form ) %]›
48 [% IF ( budget_period_id ) %]
49 Modify budget [% budget_period_description | html %]
54 [% IF ( duplicate_form ) %]› Duplicate budget[% END %]
55 [% IF ( delete_confirm ) %]›
56 Delete budget '[% budget_period_description | html %]'?
58 [% IF ( delete_confirmed ) %]›
61 [% IF close_form %]›
62 Close budget [% budget_period_description | html %]
64 [% IF closed %]›
65 Budget [% budget_period_description | html %] closed
72 <body id="admin_aqbudgetperiods" class="admin">
74 [% INCLUDE 'header.inc' %]
75 [% INCLUDE 'budgets-admin-search.inc' %]
77 <!-- ################################################################################# -->
79 <!-- ################################################################################# -->
81 <div id="breadcrumbs">
82 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
83 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
86 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
87 [% IF ( budget_period_id ) %]
88 <span>Modify budget '[% budget_period_description | html %]'</span>
90 <span>Add budget</span>
93 [% IF ( delete_confirm ) %]
94 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
95 [% IF ( total || funds_exist ) %]
96 <span>Cannot delete budget '[% budget_period_description | html %]'</span>
98 <span>Delete budget '[% budget_period_description | html %]'?</span>
101 [% IF ( duplicate_form ) %]
102 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › Duplicate budget
105 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
106 <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a></span>
109 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
110 <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a> closed</span>
113 <span>Budgets administration</span>
117 <div id="doc3" class="yui-t2">
122 [% UNLESS close_form OR closed%]
123 [% INCLUDE 'budgets-admin-toolbar.inc' %]
126 [% IF ( duplicate_form ) %]
127 <h3>Duplicate budget</h3>
128 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
129 <fieldset class="rows">
130 <input type="hidden" name="op" value="duplicate_budget" />
131 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
136 <label class="required" for="from">Start date: </label>
137 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
138 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
142 <label class="required" for="to">End date: </label>
143 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
144 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
148 <label class="required" for="budget_period_description">Description</label>
149 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
153 <label for="amount_change_percentage">Change amounts by</label>
154 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
155 <div class="hint">(can be positive or negative)</div>
159 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
160 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
161 <div class="hint">(amounts will be rounded down)</div>
165 <label for="mark_as_inactive">Mark the original budget as inactive</label>
166 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
170 <label for="reset_all_budgets">Set all funds to zero</label>
171 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
177 <fieldset class="action">
178 <input type="button" value="Save Changes" onclick="CheckDuplicateForm(this.form)" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
185 [% IF ( add_form ) %]
186 <!-- add or modify a budget period -->
188 [% IF ( budget_period_id ) %]
189 <h3>Modify budget <i>[% budget_period_description | html %]</i></h3>
193 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
194 <fieldset class="rows">
195 <!-- ################################################################################# -->
196 <!-- display information about the budget period that must be added or modified -->
197 <!-- ################################################################################# -->
198 <input type="hidden" name="op" value="add_validate" />
199 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
202 <label class="required" for="from">Start date: </label>
203 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
204 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
208 <label class="required" for="to">End date: </label>
209 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
210 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
215 <!-- ############################## -->
216 <label class="required" for="budget_period_description">Description: </label>
217 <input type="text" id="budget_period_description" name="budget_period_description"
218 size="48" maxlength="80" value="[% budget_period_description | html %]" />
223 <!-- ############################## -->
224 <label for="budget_period_total">Total amount: </label>
225 <input type="text" id="budget_period_total" name="budget_period_total"
226 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 | html %]" />
231 <!-- ############################## -->
232 <label for="budget_period_active">Make budget active: </label>
233 [% 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 %]
238 <!-- ############################## -->
239 <label for="budget_period_locked">Lock budget: </label>
240 [% 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 %]
245 <fieldset class="action">
246 <!-- "save changes" button -->
247 <!-- ###################################### -->
248 <input type="button" value="Save" onclick="Check(this.form)" />
249 <!-- <input type="submit" value="Save Changes" /> -->
250 [% IF ( budget_period_id ) %]
251 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]" class="cancel">Cancel</a>
253 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
261 <!-- ####################################################################### -->
262 <!-- delete a budget period -->
263 <!-- ####################################################################### -->
265 [% IF ( delete_confirm ) %]
267 <div class="dialog message">
268 <h3>Cannot delete budget</h3>
269 <p><strong>This record is used [% total | html %] times</strong>
270 . Deletion is not possible.</p>
271 [% ELSIF ( funds_exist ) %]
272 <div class="dialog message">
273 <h3>Cannot delete budget</h3>
274 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
276 <div class="dialog alert">
277 <h3>Delete budget '[% budget_period_description | html %]'?</h3>
279 <!-- ############################################################# -->
280 <!-- "delete" and "cancel" buttons -->
281 <!-- ############################################################# -->
283 <form action="[% script_name | html %]" method="post">
284 <input type="hidden" name="op" value="delete_confirmed" />
285 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
286 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
288 <form action="[% script_name | html %]" method="post">
289 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
297 [% IF budget_periods.size == 0 %]
298 You cannot move funds of this budget, there is no active budget.
299 Please create a new active budget and retry.
300 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
301 [% ELSIF number_of_unreceived_orders == 0 %]
302 There are no unreceived orders for this budget.
303 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
305 <h3>The unreceived orders from the following funds will be moved</h3>
306 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">[% budget_period_description | html %]</a>:
313 <th>Unreceived orders</th>
317 [% FOREACH budget IN budgets_to_move %]
319 <td>[% budget.budget_id | html %]</td>
320 <td>[% budget.budget_code_indent | html %]</td>
321 <td>[% budget.budget_name | html %]</td>
322 <td>[% budget.unreceived_orders.size | html %]</td>
327 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
328 <fieldset class="rows">
331 <label class="required" for="to_budget_period_id">Select a budget</label>
332 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
333 <option value=""></option>
334 [% FOR budget_period IN budget_periods %]
335 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
340 <label for="move_remaining_unspent">Move remaining unspent funds</label>
341 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
345 <fieldset class="action">
346 <input type="hidden" name="op" value="close_confirmed" />
347 <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
348 <input type="submit" value="Move unreceived orders" />
349 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
354 <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>
356 <table id="closed_report">
366 [% FOR r IN report %]
368 [% IF r.orders_moved.size > 0 %]
369 [% FOR order IN r.orders_moved %]
371 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %]) Amount=[% r.budget.budget_amount | $Price | html %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price | html %] remaining has been moved)[% END %]</td>
372 <td>[% order.basketname | html %]</td>
373 <td>[% order.ordernumber | html %]</td>
379 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
382 <td>There were no unreceived orders for this fund.</td>
386 [% IF r.error == 'budget_code_not_exists' %]
388 <td>[% r.budget.budget_id | html %] [% r.budget.budget_amount | $Price | html %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price | html %] remaining has been moved)[% END %]</td>
391 <td>This fund code does not exist in the destination budget.</td>
399 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
402 <!-- DEFAULT display budget periods list -->
404 <h2>Budgets administration</h2>
406 [% IF ( failed_delete_funds_exist ) %]
407 <div class="dialog message">Failed to delete budget because funds exist.</div>
410 [% INCLUDE 'budgets-active-currency.inc' %]
412 <div id="budgetsTabs" class="toptabs">
414 <li><a href="#active">Active budgets</a></li>
415 <li><a href="#inactive">Inactive budgets</a></li>
419 [% IF ( period_active_loop ) %]
420 <table id="activeperiodst">
424 <th class="title-string">Start date</th>
425 <th class="title-string">End date</th>
432 [% FOREACH period_active IN period_active_loop %]
434 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id | html %]" title="View funds for [% period_active.budget_period_description | html %]">[% period_active.budget_period_description | html %]</a></td>
435 <td><span title="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
436 <td><span title="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
438 [% IF ( period_active.budget_period_locked ) %]
439 <span style="color:green;">Locked</span>
442 <td class="data">[% period_active.budget_period_total | $Price | html %]</td>
444 [% PROCESS action_menu block_budget=period_active %]
455 [% IF ( period_inactive_loop ) %]
456 <table id="inactiveperiodst">
460 <th class="title-string">Start date</th>
461 <th class="title-string">End date</th>
468 [% FOREACH period_loo IN period_inactive_loop %]
470 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id | html %]" title="View funds for [% period_loo.budget_period_description | html %]">[% period_loo.budget_period_description | html %]</a></td>
471 <td><span title="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
472 <td><span title="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
473 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
474 <td class="data">[% period_loo.budget_period_total | $Price | html %]</td>
476 [% PROCESS action_menu block_budget=period_loo %]
492 [% INCLUDE 'acquisitions-menu.inc' %]
496 [% MACRO jsinclude BLOCK %]
497 [% INCLUDE 'calendar.inc' %]
498 [% INCLUDE 'datatables.inc' %]
500 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
502 [% Asset.js("js/acq.js") | $raw %]
503 <script type="text/javascript">
504 // #################################################################################
506 // #################################################################################
507 function CheckDuplicateForm(f){
511 if(!(isNotNull(f.budget_period_startdate,1))){
512 _alertString += "\n- " + _("Start date missing");
514 if (!(isNotNull(f.budget_period_enddate,1))){
515 _alertString += "\n- " + _("End date missing");
517 if( f.budget_period_startdate > f.budget_period_enddate ) {
518 _alertString += "\n- " + _("Start date must be before end date");
520 if (!(isNotNull(f.budget_period_description,1))){
521 _alertString += "\n- " + _("Budget description missing");
524 if(_alertString.length==0){
527 alertString += _("Form not submitted because of the following problem(s)");
528 alertString += "\n-----------------------------------------\n";
529 alertString += _alertString;
538 if (!(isNotNull(f.budget_period_startdate,1))) {
539 _alertString += "\n- " + _("Start date missing");
542 if (!(isNotNull(f.budget_period_enddate,1))) {
543 _alertString += "\n- " + _("End date missing");
546 if ( f.budget_period_startdate > f.budget_period_enddate ) {
547 _alertString += "\n- " + _("Start date must be before end date");
550 if (!(isNotNull(f.budget_period_description,1))) {
551 _alertString += "\n- " + _("Description missing");
554 if (!(isNum(f.budget_period_total))) {
555 _alertString += "\n- " + _("Amount must be a valid number, or empty");
558 if (_alertString.length==0) {
561 alertString2 = _("Form not submitted because of the following problem(s)");
562 alertString2 += "\n------------------------------------------------------------------------------------\n";
563 alertString2 += _alertString;
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 },
576 { "sType": "title-string", "aTargets" : [ "title-string" ] }
578 "sPaginationType": "four_button",
583 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
586 $("#move_form").submit(function(){
587 var budget_from = "[% budget_period_description | html %]";
588 var budget_to = $("#to_budget_period_id").find("option:selected").html();
589 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
590 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
591 return confirm ( alert_message );
595 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
596 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
597 "fnDrawCallback": function ( oSettings ) {
598 if ( oSettings.aiDisplay.length == 0 )
603 var nTrs = $('#closed_report tbody tr');
604 var iColspan = nTrs[1].getElementsByTagName('td').length;
606 for ( var i=0 ; i<nTrs.length ; i++ )
608 var iDisplayIndex = oSettings._iDisplayStart + i;
609 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
610 if ( sGroup != sLastGroup )
612 var nGroup = document.createElement( 'tr' );
613 var nCell = document.createElement( 'td' );
614 nCell.colSpan = iColspan;
615 nCell.className = "group";
616 nCell.innerHTML = sGroup;
617 nGroup.appendChild( nCell );
618 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
624 { "bVisible": false, "aTargets": [ 0, 1 ] },
625 { "bSortable": false, "aTargets": ["_all"] }
628 'aaSortingFixed': [[ 1, 'asc' ]],
630 "sPaginationType": "full_numbers"
636 [% INCLUDE 'intranet-bottom.inc' %]