5 [%- BLOCK action_menu %]
7 <a class="btn btn-default btn-xs dropdown-toggle" id="budgetmenu_[% block_budget.budget_period_id %]" role="button" data-toggle="dropdown" href="#">
8 Actions <b class="caret"></b>
10 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id %]">
12 <a href="[% script_name %]?op=add_form&budget_period_id=[% block_budget.budget_period_id |html %]"><i class="fa fa-pencil"></i> Edit</a>
14 [% IF block_budget.count %]
16 <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>
20 <a href="[% script_name %]?op=delete_confirm&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-trash"></i> Delete</a>
24 <a href="[% script_name %]?op=duplicate_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-copy"></i> Duplicate</a>
27 <a href="[% script_name %]?op=close_form&budget_period_id=[% block_budget.budget_period_id %]"><i class="fa fa-times-circle"></i> Close</a>
30 <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>
36 [% INCLUDE 'doc-head-open.inc' %]
37 [% INCLUDE 'doc-head-close.inc' %]
38 [% Asset.css("css/datatables.css") %]
40 [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") %]
44 Koha › Administration › Budgets
46 [% IF ( add_form ) %]›
47 [% IF ( budget_period_id ) %]
48 Modify budget [% budget_period_description %]
53 [% IF ( duplicate_form ) %]› Duplicate budget[% END %]
54 [% IF ( delete_confirm ) %]›
55 Delete budget '[% budget_period_description %]'?
57 [% IF ( delete_confirmed ) %]›
60 [% IF close_form %]›
61 Close budget [% budget_period_description %]
63 [% IF closed %]›
64 Budget [% budget_period_description %] closed
71 <body id="admin_aqbudgetperiods" class="admin">
73 [% INCLUDE 'header.inc' %]
74 [% INCLUDE 'budgets-admin-search.inc' %]
76 <!-- ################################################################################# -->
78 <!-- ################################################################################# -->
80 <div id="breadcrumbs">
81 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
82 <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> ›
85 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
86 [% IF ( budget_period_id ) %]
87 <span>Modify budget '[% budget_period_description %]'</span>
89 <span>Add budget</span>
92 [% IF ( delete_confirm ) %]
93 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
94 [% IF ( total || funds_exist ) %]
95 <span>Cannot delete budget '[% budget_period_description %]'</span>
97 <span>Delete budget '[% budget_period_description %]'?</span>
100 [% IF ( duplicate_form ) %]
101 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> › Duplicate budget
104 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
105 <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a></span>
108 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> ›
109 <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a> closed</span>
112 <span>Budgets administration</span>
116 <div id="doc3" class="yui-t2">
121 [% UNLESS close_form OR closed%]
122 [% INCLUDE 'budgets-admin-toolbar.inc' %]
125 [% IF ( duplicate_form ) %]
126 <h3>Duplicate budget</h3>
127 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
128 <fieldset class="rows">
129 <input type="hidden" name="op" value="duplicate_budget" />
130 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
135 <label class="required" for="from">Start date: </label>
136 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
137 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
141 <label class="required" for="to">End date: </label>
142 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
143 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
147 <label class="required" for="budget_period_description">Description</label>
148 <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description %]" />
152 <label for="amount_change_percentage">Change amounts by</label>
153 <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
154 <div class="hint">(can be positive or negative)</div>
158 <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
159 <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
160 <div class="hint">(amounts will be rounded down)</div>
164 <label for="mark_as_inactive">Mark the original budget as inactive</label>
165 <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
169 <label for="reset_all_budgets">Set all funds to zero</label>
170 <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
176 <fieldset class="action">
177 <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>
184 [% IF ( add_form ) %]
185 <!-- add or modify a budget period -->
187 [% IF ( budget_period_id ) %]
188 <h3>Modify budget <i>[% budget_period_description %]</i></h3>
192 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post">
193 <fieldset class="rows">
194 <!-- ################################################################################# -->
195 <!-- display information about the budget period that must be added or modified -->
196 <!-- ################################################################################# -->
197 <input type="hidden" name="op" value="add_validate" />
198 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
201 <label class="required" for="from">Start date: </label>
202 <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
203 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
207 <label class="required" for="to">End date: </label>
208 <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
209 <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
214 <!-- ############################## -->
215 <label class="required" for="budget_period_description">Description: </label>
216 <input type="text" id="budget_period_description" name="budget_period_description"
217 size="48" maxlength="80" value="[% budget_period_description %]" />
222 <!-- ############################## -->
223 <label for="budget_period_total">Total amount: </label>
224 <input type="text" id="budget_period_total" name="budget_period_total"
225 size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
230 <!-- ############################## -->
231 <label for="budget_period_active">Make budget active: </label>
232 [% 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 %]
237 <!-- ############################## -->
238 <label for="budget_period_locked">Lock budget: </label>
239 [% 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 %]
244 <fieldset class="action">
245 <!-- "save changes" button -->
246 <!-- ###################################### -->
247 <input type="button" value="Save" onclick="Check(this.form)" />
248 <!-- <input type="submit" value="Save Changes" /> -->
249 [% IF ( budget_period_id ) %]
250 <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]" class="cancel">Cancel</a>
252 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
260 <!-- ####################################################################### -->
261 <!-- delete a budget period -->
262 <!-- ####################################################################### -->
264 [% IF ( delete_confirm ) %]
266 <div class="dialog message">
267 <h3>Cannot delete budget</h3>
268 <p><strong>This record is used [% total %] times</strong>
269 . Deletion is not possible.</p>
270 [% ELSIF ( funds_exist ) %]
271 <div class="dialog message">
272 <h3>Cannot delete budget</h3>
273 <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
275 <div class="dialog alert">
276 <h3>Delete budget '[% budget_period_description %]'?</h3>
278 <!-- ############################################################# -->
279 <!-- "delete" and "cancel" buttons -->
280 <!-- ############################################################# -->
282 <form action="[% script_name %]" method="post">
283 <input type="hidden" name="op" value="delete_confirmed" />
284 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
285 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
287 <form action="[% script_name %]" method="post">
288 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
296 [% IF budget_periods.size == 0 %]
297 You cannot move funds of this budget, there is no active budget.
298 Please create a new active budget and retry.
299 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
300 [% ELSIF number_of_unreceived_orders == 0 %]
301 There are no unreceived orders for this budget.
302 <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
304 <h3>The unreceived orders from the following funds will be moved</h3>
305 Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">[% budget_period_description %]</a>:
312 <th>Unreceived orders</th>
316 [% FOREACH budget IN budgets_to_move %]
318 <td>[% budget.budget_id %]</td>
319 <td>[% budget.budget_code_indent %]</td>
320 <td>[% budget.budget_name %]</td>
321 <td>[% budget.unreceived_orders.size %]</td>
326 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
327 <fieldset class="rows">
330 <label class="required" for="to_budget_period_id">Select a budget</label>
331 <select name="to_budget_period_id" id="to_budget_period_id" required="required">
332 <option value=""></option>
333 [% FOR budget_period IN budget_periods %]
334 <option value="[% budget_period.budget_period_id %]">[% budget_period.budget_period_description %]</option>
339 <label for="move_remaining_unspent">Move remaining unspent funds</label>
340 <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
344 <fieldset class="action">
345 <input type="hidden" name="op" value="close_confirmed" />
346 <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
347 <input type="submit" value="Move unreceived orders" />
348 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
353 <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>
355 <table id="closed_report">
365 [% FOR r IN report %]
367 [% IF r.orders_moved.size > 0 %]
368 [% FOR order IN r.orders_moved %]
370 <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>
371 <td>[% order.basketname %]</td>
372 <td>[% order.ordernumber %]</td>
378 <td>[% r.budget.budget_name %] (id=[% r.budget.budget_id %])</td>
381 <td>There were no unreceived orders for this fund.</td>
385 [% IF r.error == 'budget_code_not_exists' %]
387 <td>[% r.budget.budget_id %] [% r.budget.budget_amount | $Price %][% IF r.unspent_moved %] ([% r.unspent_moved | $Price %] remaining has been moved)[% END %]</td>
390 <td>This fund code does not exist in the destination budget.</td>
398 <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
401 <!-- DEFAULT display budget periods list -->
403 <h2>Budgets administration</h2>
405 [% IF ( failed_delete_funds_exist ) %]
406 <div class="dialog message">Failed to delete budget because funds exist.</div>
409 [% INCLUDE 'budgets-active-currency.inc' %]
411 <div id="budgetsTabs" class="toptabs">
413 <li><a href="#active">Active budgets</a></li>
414 <li><a href="#inactive">Inactive budgets</a></li>
418 [% IF ( period_active_loop ) %]
419 <table id="activeperiodst">
423 <th class="title-string">Start date</th>
424 <th class="title-string">End date</th>
431 [% FOREACH period_active IN period_active_loop %]
433 <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>
434 <td><span title="[% period_active.budget_period_startdate %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
435 <td><span title="[% period_active.budget_period_enddate %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
437 [% IF ( period_active.budget_period_locked ) %]
438 <span style="color:green;">Locked</span>
441 <td class="data">[% period_active.budget_period_total | $Price %]</td>
443 [% PROCESS action_menu block_budget=period_active %]
454 [% IF ( period_inactive_loop ) %]
455 <table id="inactiveperiodst">
459 <th class="title-string">Start date</th>
460 <th class="title-string">End date</th>
467 [% FOREACH period_loo IN period_inactive_loop %]
469 <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>
470 <td><span title="[% period_loo.budget_period_startdate %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
471 <td><span title="[% period_loo.budget_period_enddate %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
472 <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span> [% ELSE %][% END %] </td>
473 <td class="data">[% period_loo.budget_period_total | $Price %]</td>
475 [% PROCESS action_menu block_budget=period_loo %]
491 [% INCLUDE 'acquisitions-menu.inc' %]
495 [% MACRO jsinclude BLOCK %]
496 [% INCLUDE 'calendar.inc' %]
497 [% INCLUDE 'datatables.inc' %]
499 [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") %]
501 [% Asset.js("js/acq.js") %]
502 <script type="text/javascript">
503 // #################################################################################
505 // #################################################################################
506 function CheckDuplicateForm(f){
510 if(!(isNotNull(f.budget_period_startdate,1))){
511 _alertString += "\n- " + _("Start date missing");
513 if (!(isNotNull(f.budget_period_enddate,1))){
514 _alertString += "\n- " + _("End date missing");
516 if( f.budget_period_startdate > f.budget_period_enddate ) {
517 _alertString += "\n- " + _("Start date must be before end date");
519 if (!(isNotNull(f.budget_period_description,1))){
520 _alertString += "\n- " + _("Budget description missing");
523 if(_alertString.length==0){
526 alertString += _("Form not submitted because of the following problem(s)");
527 alertString += "\n-----------------------------------------\n";
528 alertString += _alertString;
537 if (!(isNotNull(f.budget_period_startdate,1))) {
538 _alertString += "\n- " + _("Start date missing");
541 if (!(isNotNull(f.budget_period_enddate,1))) {
542 _alertString += "\n- " + _("End date missing");
545 if ( f.budget_period_startdate > f.budget_period_enddate ) {
546 _alertString += "\n- " + _("Start date must be before end date");
549 if (!(isNotNull(f.budget_period_description,1))) {
550 _alertString += "\n- " + _("Description missing");
553 if (!(isNum(f.budget_period_total))) {
554 _alertString += "\n- " + _("Amount must be a valid number, or empty");
557 if (_alertString.length==0) {
560 alertString2 = _("Form not submitted because of the following problem(s)");
561 alertString2 += "\n------------------------------------------------------------------------------------\n";
562 alertString2 += _alertString;
567 $(document).ready(function() {
568 var tabs = $('#budgetsTabs').tabs();
570 tabs.tabs("option", "active", [% tab %]);
572 $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
574 { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
575 { "sType": "title-string", "aTargets" : [ "title-string" ] }
577 "sPaginationType": "four_button",
582 $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
585 $("#move_form").submit(function(){
586 var budget_from = "[% budget_period_description %]";
587 var budget_to = $("#to_budget_period_id").find("option:selected").html();
588 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
589 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
590 return confirm ( alert_message );
594 var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
595 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
596 "fnDrawCallback": function ( oSettings ) {
597 if ( oSettings.aiDisplay.length == 0 )
602 var nTrs = $('#closed_report tbody tr');
603 var iColspan = nTrs[1].getElementsByTagName('td').length;
605 for ( var i=0 ; i<nTrs.length ; i++ )
607 var iDisplayIndex = oSettings._iDisplayStart + i;
608 var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
609 if ( sGroup != sLastGroup )
611 var nGroup = document.createElement( 'tr' );
612 var nCell = document.createElement( 'td' );
613 nCell.colSpan = iColspan;
614 nCell.className = "group";
615 nCell.innerHTML = sGroup;
616 nGroup.appendChild( nCell );
617 nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
623 { "bVisible": false, "aTargets": [ 0, 1 ] },
624 { "bSortable": false, "aTargets": ["_all"] }
627 'aaSortingFixed': [[ 1, 'asc' ]],
629 "sPaginationType": "full_numbers"
635 [% INCLUDE 'intranet-bottom.inc' %]