4 [%- BLOCK action_menu %]
6 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
7 Actions <b class="caret"></b>
9 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id %]">
11 <a href="[% script_name %]?op=add_form&budget_period_id=[% block_budget.budget_period_id |html %]"><i class="fa fa-pencil"></i> Edit</a>
13 [% IF block_budget.count %]
15 <a data-toggle="tooltip" data-placement="left" title="[% block_budget.count %] 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>
19 <a href="[% script_name %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-trash"></i> Delete</a>
23 <a href="[% script_name %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-copy"></i> Duplicate</a>
26 <a href="[% script_name %]?op=close_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-times-circle"></i> Close</a>
29 <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-plus"></i> Add fund</a>
35 [% INCLUDE 'doc-head-open.inc' %]
36 [% INCLUDE 'doc-head-close.inc' %]
37 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
39 <link href="[% interface %]/lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css" rel="stylesheet" type="text/css" />
43 Koha › Administration › Budgets
45 [% IF ( add_form ) %]›
46 [% IF ( budget_period_id ) %]
47 Modify budget [% budget_period_description %]
52 [% IF ( duplicate_form ) %]› Duplicate budget[% END %]
53 [% IF ( delete_confirm ) %]›
54 Delete budget '[% budget_period_description %]'?
56 [% IF ( delete_confirmed ) %]›
59 [% IF close_form %]›
60 Close budget [% budget_period_description %]
62 [% IF closed %]›
63 Budget [% budget_period_description %] closed
70 <body id="admin_aqbudgetperiods" class="admin">
72 [% INCLUDE 'header.inc' %]
73 [% INCLUDE 'budgets-admin-search.inc' %]
75 <!-- ################################################################################# -->
77 <!-- ################################################################################# -->
79 <div id="breadcrumbs">
80 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
81 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
84 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
85 [% IF ( budget_period_id ) %]
86 <span>Modify budget '[% budget_period_description %]'</span>
88 <span>Add budget</span>
91 [% IF ( delete_confirm ) %]
92 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
93 [% IF ( total || funds_exist ) %]
94 <span>Cannot delete budget '[% budget_period_description %]'</span>
96 <span>Delete budget '[% budget_period_description %]'?</span>
99 [% IF ( duplicate_form ) %]
100 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › Duplicate budget
103 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
104 <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a></span>
107 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
108 <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a> closed</span>
111 <span>Budgets administration</span>
115 <div id="doc3" class="yui-t2">
120 [% UNLESS close_form OR closed%]
121 [% INCLUDE 'budgets-admin-toolbar.inc' %]
124 [% IF ( duplicate_form ) %]
125 <h3>Duplicate budget</h3>
126 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
127 <fieldset class="rows">
128 <input type="hidden" name="op" value="duplicate_budget" />
129 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
134 <label class="required" for="from">Start date: </label>
135 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
136 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
140 <label class="required" for="to">End date: </label>
141 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
142 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
146 <label class="required" for="budget_period_description">Description</label>
147 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" />
151 <label for="amount_change_percentage">Change amounts by</label>
152 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
153 <div class="hint">(can be positive or negative)</div>
157 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
158 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
159 <div class="hint">(amounts will be rounded down)</div>
163 <label for="mark_as_inactive">Mark the original budget as inactive</label>
164 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
168 <label for="reset_all_budgets">Set all funds to zero</label>
169 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
175 <fieldset class="action">
176 <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 %]">Cancel</a>
183 [% IF ( add_form ) %]
184 <!-- add or modify a budget period -->
186 [% IF ( budget_period_id ) %]
187 <h3>Modify budget <i>[% budget_period_description %]</i></h3>
191 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
192 <fieldset class="rows">
193 <!-- ################################################################################# -->
194 <!-- display information about the budget period that must be added or modified -->
195 <!-- ################################################################################# -->
196 <input type="hidden" name="op" value="add_validate" />
197 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
200 <label class="required" for="from">Start date: </label>
201 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
202 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
206 <label class="required" for="to">End date: </label>
207 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
208 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
213 <!-- ############################## -->
214 <label class="required" for="budget_period_description">Description: </label>
215 <input type="text" id="budget_period_description" name="budget_period_description"
216 size="48" maxlength="80" value="[% budget_period_description %]" />
221 <!-- ############################## -->
222 <label for="budget_period_total">Total amount: </label>
223 <input type="text" id="budget_period_total" name="budget_period_total"
224 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
229 <!-- ############################## -->
230 <label for="budget_period_active">Make budget active: </label>
231 [% 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 %]
236 <!-- ############################## -->
237 <label for="budget_period_locked">Lock budget: </label>
238 [% 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 %]
243 <fieldset class="action">
244 <!-- "save changes" button -->
245 <!-- ###################################### -->
246 <input type="button" value="Save" onclick="Check(this.form)" />
247 <!-- <input type="submit" value="Save Changes" /> -->
248 [% IF ( budget_period_id ) %]
249 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
251 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
259 <!-- ####################################################################### -->
260 <!-- delete a budget period -->
261 <!-- ####################################################################### -->
263 [% IF ( delete_confirm ) %]
265 <div class="dialog message">
266 <h3>Cannot delete budget</h3>
267 <p><strong>This record is used [% total %] times</strong>
268 . Deletion is not possible.</p>
269 [% ELSIF ( funds_exist ) %]
270 <div class="dialog message">
271 <h3>Cannot delete budget</h3>
272 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
274 <div class="dialog alert">
275 <h3>Delete budget '[% budget_period_description %]'?</h3>
277 <!-- ############################################################# -->
278 <!-- "delete" and "cancel" buttons -->
279 <!-- ############################################################# -->
281 <form action="[% script_name %]" method="post">
282 <input type="hidden" name="op" value="delete_confirmed" />
283 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
284 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
286 <form action="[% script_name %]" method="post">
287 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
295 [% IF budget_periods.size == 0 %]
296 You cannot move funds of this budget, there is no active budget.
297 Please create a new active budget and retry.
298 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
299 [% ELSIF number_of_unreceived_orders == 0 %]
300 There are no unreceived orders for this budget.
301 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
303 <h3>The unreceived orders from the following funds will be moved</h3>
304 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a>:
311 <th>Unreceived orders</th>
315 [% FOREACH budget IN budgets_to_move %]
317 <td>[% budget.budget_id %]</td>
318 <td>[% budget.budget_code_indent %]</td>
319 <td>[% budget.budget_name %]</td>
320 <td>[% budget.unreceived_orders.size %]</td>
325 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
326 <fieldset class="rows">
329 <label class="required" for="to_budget_period_id">Select a budget</label>
330 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
331 <option value=""></option>
332 [% FOR budget_period IN budget_periods %]
333 <option value="[% budget_period.budget_period_id %]">[% budget_period.budget_period_description %]</option>
338 <label for="move_remaining_unspent">Move remaining unspent funds</label>
339 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
343 <fieldset class="action">
344 <input type="hidden" name="op" value="close_confirmed" />
345 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
346 <input type="submit" value="Move unreceived orders" />
347 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
352 <h3>Report after moving unreceived orders from budget [% from_budget_period.budget_period_description %] ([% from_budget_period.budget_period_startdate | $KohaDates %] - [% from_budget_period.budget_period_enddate | $KohaDates %]) to [% to_budget_period.budget_period_description %] ([% to_budget_period.budget_period_startdate | $KohaDates %] - [% to_budget_period.budget_period_enddate | $KohaDates%])</h3>
354 <table id="closed_report">
364 [% FOR r IN report %]
366 [% IF r.orders_moved.size > 0 %]
367 [% FOR order IN r.orders_moved %]
369 <td>[% r.budget.budget_name %] (id=[% r.budget.budget_id %]) Amount=[% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
370 <td>[% order.basketname %]</td>
371 <td>[% order.ordernumber %]</td>
377 <td>[% r.budget.budget_name %] (id=[% r.budget.budget_id %])</td>
380 <td>There were no unreceived orders for this fund.</td>
384 [% IF r.error == 'budget_code_not_exists' %]
386 <td>[% r.budget.budget_id %] [% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
389 <td>This fund code does not exist in the destination budget.</td>
397 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
400 <!-- DEFAULT display budget periods list -->
402 <h2>Budgets administration</h2>
404 [% IF ( failed_delete_funds_exist ) %]
405 <div class="dialog message">Failed to delete budget because funds exist.</div>
408 [% INCLUDE 'budgets-active-currency.inc' %]
410 <div id="budgetsTabs" class="toptabs">
412 <li><a href="#active">Active budgets</a></li>
413 <li><a href="#inactive">Inactive budgets</a></li>
417 [% IF ( period_active_loop ) %]
418 <table id="activeperiodst">
422 <th class="title-string">Start date</th>
423 <th class="title-string">End date</th>
430 [% FOREACH period_active IN period_active_loop %]
432 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_active.budget_period_id %]" title="View funds for [% period_active.budget_period_description %]">[% period_active.budget_period_description %]</a></td>
433 <td><span title="[% period_active.budget_period_startdate %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
434 <td><span title="[% period_active.budget_period_enddate %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
436 [% IF ( period_active.budget_period_locked ) %]
437 <span style="color:green;">Locked</span>
440 <td class="data">[% period_active.budget_period_total | $Price %]</td>
442 [% PROCESS action_menu block_budget=period_active %]
453 [% IF ( period_inactive_loop ) %]
454 <table id="inactiveperiodst">
458 <th class="title-string">Start date</th>
459 <th class="title-string">End date</th>
466 [% FOREACH period_loo IN period_inactive_loop %]
468 <td><a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% period_loo.budget_period_id %]" title="View funds for [% period_loo.budget_period_description %]">[% period_loo.budget_period_description %]</a></td>
469 <td><span title="[% period_loo.budget_period_startdate %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
470 <td><span title="[% period_loo.budget_period_enddate %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
471 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
472 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
474 [% PROCESS action_menu block_budget=period_loo %]
490 [% INCLUDE 'acquisitions-menu.inc' %]
494 [% MACRO jsinclude BLOCK %]
495 [% INCLUDE 'calendar.inc' %]
496 [% INCLUDE 'datatables.inc' %]
498 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/treetable/jquery.treetable.js"></script>
500 <script type="text/javascript" src="[% interface %]/[% theme %]/js/acq.js"></script>
501 <script type="text/javascript">
502 // #################################################################################
504 // #################################################################################
505 function CheckDuplicateForm(f){
509 if(!(isNotNull(f.budget_period_startdate,1))){
510 _alertString += "\n- " + _("Start date missing");
512 if (!(isNotNull(f.budget_period_enddate,1))){
513 _alertString += "\n- " + _("End date missing");
515 if( f.budget_period_startdate > f.budget_period_enddate ) {
516 _alertString += "\n- " + _("Start date must be before end date");
518 if (!(isNotNull(f.budget_period_description,1))){
519 _alertString += "\n- " + _("Budget description missing");
522 if(_alertString.length==0){
525 alertString += _("Form not submitted because of the following problem(s)");
526 alertString += "\n-----------------------------------------\n";
527 alertString += _alertString;
536 if (!(isNotNull(f.budget_period_startdate,1))) {
537 _alertString += "\n- " + _("Start date missing");
540 if (!(isNotNull(f.budget_period_enddate,1))) {
541 _alertString += "\n- " + _("End date missing");
544 if ( f.budget_period_startdate > f.budget_period_enddate ) {
545 _alertString += "\n- " + _("Start date must be before end date");
548 if (!(isNotNull(f.budget_period_description,1))) {
549 _alertString += "\n- " + _("Description missing");
552 if (!(isNum(f.budget_period_total))) {
553 _alertString += "\n- " + _("Amount must be a valid number, or empty");
556 if (_alertString.length==0) {
559 alertString2 = _("Form not submitted because of the following problem(s)");
560 alertString2 += "\n------------------------------------------------------------------------------------\n";
561 alertString2 += _alertString;
566 $(document).ready(function() {
567 var tabs = $('#budgetsTabs').tabs();
569 tabs.tabs("option", "active", [% tab %]);
571 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
573 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
574 { "sType": "title-string", "aTargets" : [ "title-string" ] }
576 "sPaginationType": "four_button",
581 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
584 $("#move_form").submit(function(){
585 var budget_from = "[% budget_period_description %]";
586 var budget_to = $("#to_budget_period_id").find("option:selected").html();
587 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
588 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
589 return confirm ( alert_message );
593 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
594 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
595 "fnDrawCallback": function ( oSettings ) {
596 if ( oSettings.aiDisplay.length == 0 )
601 var nTrs = $('#closed_report tbody tr');
602 var iColspan = nTrs[1].getElementsByTagName('td').length;
604 for ( var i=0 ; i<nTrs.length ; i++ )
606 var iDisplayIndex = oSettings._iDisplayStart + i;
607 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
608 if ( sGroup != sLastGroup )
610 var nGroup = document.createElement( 'tr' );
611 var nCell = document.createElement( 'td' );
612 nCell.colSpan = iColspan;
613 nCell.className = "group";
614 nCell.innerHTML = sGroup;
615 nGroup.appendChild( nCell );
616 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
622 { "bVisible": false, "aTargets": [ 0, 1 ] },
623 { "bSortable": false, "aTargets": ["_all"] }
626 'aaSortingFixed': [[ 1, 'asc' ]],
628 "sPaginationType": "full_numbers"
634 [% INCLUDE 'intranet-bottom.inc' %]