Bug 25499: Fix fund code column when closing a budget
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgetperiods.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% SET footerjs = 1 %]
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>
10         </a>
11         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="budgetmenu_[% block_budget.budget_period_id | html %]">
12               <li>
13                   <a href="[% script_name | url %]?op=add_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-pencil"></i> Edit</a>
14               </li>
15               [% IF block_budget.count %]
16                   <li class="disabled">
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>
18                   </li>
19               [% ELSE %]
20                   <li>
21                       <a href="[% script_name | url %]?op=delete_confirm&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-trash"></i> Delete</a>
22                   </li>
23               [% END %]
24               <li>
25                   <a href="[% script_name | url %]?op=duplicate_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-copy"></i> Duplicate</a>
26               </li>
27               <li>
28                   <a href="[% script_name | url %]?op=close_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-times-circle"></i> Close</a>
29               </li>
30               <li>
31                   <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_period_id=[% block_budget.budget_period_id | uri %]"><i class="fa fa-plus"></i> Add fund</a>
32               </li>
33         </ul>
34     </div>
35 [% END -%]
36
37 [% INCLUDE 'doc-head-open.inc' %]
38 [% INCLUDE 'doc-head-close.inc' %]
39 [% IF close_form %]
40     [% Asset.css("lib/jquery/plugins/treetable/stylesheets/jquery.treetable.css") | $raw %]
41 [% END %]
42
43 <title>
44     Koha &rsaquo; Administration &rsaquo; Budgets
45
46     [% IF ( add_form ) %]&rsaquo;
47         [% IF ( budget_period_id ) %]
48             Modify budget [% budget_period_description | html %]
49         [% ELSE %]
50             Add budget
51         [% END %]
52     [% END %]
53     [% IF ( duplicate_form ) %]&rsaquo; Duplicate budget[% END %]
54     [% IF ( delete_confirm ) %]&rsaquo;
55             Delete budget '[% budget_period_description | html %]'?
56     [% END %]
57     [% IF ( delete_confirmed ) %]&rsaquo;
58         Data deleted
59     [% END %]
60     [% IF close_form %]&rsaquo;
61       Close budget [% budget_period_description | html %]
62     [% END %]
63     [% IF closed %]&rsaquo;
64       Budget [% budget_period_description | html %] closed
65     [% END %]
66 </title>
67
68
69 </head>
70
71 <body id="admin_aqbudgetperiods" class="admin">
72
73 [% INCLUDE 'header.inc' %]
74 [% INCLUDE 'budgets-admin-search.inc' %]
75
76 <!-- ################################################################################# -->
77 <!-- BREADCRUMBS -->
78 <!-- ################################################################################# -->
79
80 <div id="breadcrumbs">
81     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
82     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
83
84     [% IF ( add_form ) %]
85         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
86         [% IF ( budget_period_id ) %]
87             <span>Modify budget '[% budget_period_description | html %]'</span>
88         [% ELSE %]
89             <span>Add budget</span>
90         [% END %]
91     [% END %]
92     [% IF ( delete_confirm ) %]
93         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
94         [% IF ( total || funds_exist ) %]
95             <span>Cannot delete budget '[% budget_period_description | html %]'</span>
96         [% ELSE %]
97             <span>Delete budget '[% budget_period_description | html %]'?</span>
98         [% END %]
99     [% END %]
100     [% IF ( duplicate_form ) %]
101         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; Duplicate budget
102     [% END %]
103     [% IF close_form %]
104         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
105         <span>Close budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a></span>
106     [% END %]
107     [% IF closed %]
108         <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo;
109         <span>Budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a> closed</span>
110     [% END %]
111     [% IF ( else ) %]
112         <span>Budgets administration</span>
113     [% END %]
114 </div>
115
116 <div class="main container-fluid">
117     <div class="row">
118         <div class="col-sm-10 col-sm-push-2">
119             <main>
120
121 [% UNLESS close_form OR closed OR duplicate_form %]
122   [% INCLUDE 'budgets-admin-toolbar.inc' %]
123 [% END %]
124
125 [% IF ( duplicate_form ) %]
126 <h3>Duplicate budget</h3>
127 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" 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 | html %]" />
131
132     <ol>
133
134     <li>
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         <span class="required">Required</span>
138         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
139     </li>
140     <li>
141
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         <span class="required">Required</span>
145         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
146     </li>
147
148     <li>
149     <label class="required" for="budget_period_description">Description</label>
150     <input type="text" id="budget_period_description" name="budget_period_description" value="[% budgetperiod.budget_period_description | html %]" />
151         <span class="required">Required</span>
152     </li>
153
154     <li>
155       <label for="amount_change_percentage">Change amounts by</label>
156       <input type="text" id="amount_change_percentage" name="amount_change_percentage" /> %
157       <div class="hint">(can be positive or negative)</div>
158     </li>
159
160     <li>
161       <label for="amount_change_round_increment">If amounts changed, round to a multiple of</label>
162       <input type="text" id="amount_change_round_increment" name="amount_change_round_increment" />
163       <div class="hint">(amounts will be rounded down)</div>
164     </li>
165
166     <li>
167       <label for="mark_as_inactive">Mark the original budget as inactive</label>
168       <input type="checkbox" id="mark_as_inactive" name="mark_original_budget_as_inactive" />
169     </li>
170
171     <li>
172       <label for="reset_all_budgets">Set all funds to zero</label>
173       <input type="checkbox" id="reset_all_budgets" name="reset_all_budgets" />
174     </li>
175
176     </ol>
177     </fieldset>
178
179     <fieldset class="action">
180         <input type="submit" value="Save" />
181         <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | html %]">Cancel</a>
182     </fieldset>
183
184 </form>
185
186 [% END %]
187
188 [% IF ( add_form ) %]
189     <!--  add or modify a budget period   -->
190
191     [% IF ( budget_period_id ) %]
192         <h3>Modify budget <i>[% budget_period_description | html %]</i></h3>
193     [% ELSE %]
194         <h3>Add budget</h3>
195         [% END %]
196 <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" id="add_modify_budget" name="f" method="post">
197     <fieldset class="rows">
198     <!-- ################################################################################# -->
199     <!-- display information about the budget period that must be added or modified -->
200     <!-- ################################################################################# -->
201     <input type="hidden" name="op" value="add_validate" />
202     <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
203     <ol>
204     <li>
205     <label class="required" for="from">Start date: </label>
206     <input type="text" size="10" id="from" name="budget_period_startdate" value="[% budget_period_startdate | $KohaDates %]" class="datepickerfrom" />
207         <span class="required">Required</span>
208         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
209     </li>
210     <li>
211
212     <label class="required" for="to">End date: </label>
213     <input type="text" size="10" id="to" name="budget_period_enddate" value="[% budget_period_enddate | $KohaDates %]" class="datepickerto" />
214         <span class="required">Required</span>
215         <div class="hint">[% INCLUDE 'date-format.inc' %]</div>
216     </li>
217
218     <li>
219         <!-- DESCRIPTION -->
220         <!-- ############################## -->
221         <label class="required" for="budget_period_description">Description: </label>
222         <input type="text" id="budget_period_description" name="budget_period_description"
223         size="48" maxlength="80" value="[% budget_period_description | html %]" />
224             <span class="required">Required</span>
225     </li>
226
227     <li>
228         <!-- TOTAL -->
229         <!-- ############################## -->
230         <label for="budget_period_total">Total amount: </label>
231         <input type="text" id="budget_period_total" name="budget_period_total"
232         size="10" maxlength="80" value="[% budget_period_total | $Price on_editing => 1 %]" />
233     </li>
234
235     <li>
236         <!-- ACTIVE -->
237         <!-- ############################## -->
238         <label for="budget_period_active">Make budget active: </label>
239         [% 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 %]
240     </li>
241
242     <li>
243         <!-- LOCK  -->
244         <!-- ############################## -->
245         <label for="budget_period_locked">Lock budget: </label>
246         [% 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 %]
247     </li>
248     </ol>
249     </fieldset>
250
251     <fieldset class="action">
252         <!-- "save changes" button -->
253         <!-- ###################################### -->
254         <input type="submit" value="Save" />
255         [% IF ( budget_period_id ) %]
256             <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]" class="cancel">Cancel</a>
257         [% ELSE %]
258             <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl" class="cancel">Cancel</a>
259         [% END %]
260     </fieldset>
261
262 </form>
263
264 [% END %]
265
266 <!-- ####################################################################### -->
267 <!-- delete a budget period -->
268 <!-- ####################################################################### -->
269
270 [% IF ( delete_confirm ) %]
271     [% IF ( total ) %]
272         <div class="dialog message">
273         <h3>Cannot delete budget</h3>
274         <p><strong>This record is used [% total | html %] times</strong>
275         . Deletion is not possible.</p>
276     [% ELSIF ( funds_exist ) %]
277         <div class="dialog message">
278         <h3>Cannot delete budget</h3>
279         <p>This budget has funds attached. You must delete all attached funds before you can delete this budget.</p>
280     [% ELSE %]
281         <div class="dialog alert">
282         <h3>Delete budget '[% budget_period_description | html %]'?</h3>
283
284     <!-- ############################################################# -->
285     <!-- "delete" and "cancel" buttons    -->
286     <!-- ############################################################# -->
287
288     <form action="[% script_name | html %]" method="post">
289         <input type="hidden" name="op" value="delete_confirmed" />
290         <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
291         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
292     </form>
293     <form action="[% script_name | html %]" method="post">
294         <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
295     </form>
296     [% END %]
297
298     </div>
299 [% END %]
300
301 [% IF close_form %]
302   [% IF budget_periods.size == 0 %]
303     You cannot move funds of this budget, there is no active budget.
304     Please create a new active budget and retry.
305     <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
306   [% ELSIF number_of_unreceived_orders == 0 %]
307     There are no unreceived orders for this budget.
308     <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
309   [% ELSE %]
310     <h3>The unreceived orders from the following funds will be moved</h3>
311       Fund list of budget <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id | uri %]">[% budget_period_description | html %]</a>:
312     <table id="budgeth">
313       <thead>
314         <tr>
315             <th>Fund ID</th>
316             <th>Fund code</th>
317             <th>Fund name</th>
318             <th>Unreceived orders</th>
319         </tr>
320       </thead>
321       <tbody>
322         [% FOREACH budget IN budgets_to_move %]
323           <tr>
324             <td>[% budget.budget_id | html %]</td>
325             <td>[% budget.budget_code | html %]</td>
326             <td>[% budget.budget_name | html %]</td>
327             <td>[% budget.unreceived_orders.size | html %]</td>
328           </tr>
329         [% END %]
330       </tbody>
331     </table>
332     <form action="/cgi-bin/koha/admin/aqbudgetperiods.pl" name="f" method="post" id="move_form">
333       <fieldset class="rows">
334         <ol>
335           <li>
336             <label class="required" for="to_budget_period_id">Select a budget</label>
337             <select name="to_budget_period_id" id="to_budget_period_id" required="required">
338               <option value=""></option>
339               [% FOR budget_period IN budget_periods %]
340                 <option value="[% budget_period.budget_period_id | html %]">[% budget_period.budget_period_description | html %]</option>
341               [% END %]
342             </select>
343           </li>
344           <li>
345           <label for="move_remaining_unspent">Move remaining unspent funds</label>
346             <input type="checkbox" name="move_remaining_unspent" id="move_remaining_unspent" />
347           </li>
348         </ol>
349       </fieldset>
350       <fieldset class="action">
351           <input type="hidden" name="op" value="close_confirmed" />
352           <input type="hidden" name="budget_period_id" value="[% budget_period_id | html %]" />
353           <input type="submit" value="Move unreceived orders" />
354           <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Cancel</a>
355       </fieldset>
356     </form>
357   [% END %]
358 [% ELSIF closed %]
359   <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>
360
361   <table id="closed_report">
362     <thead>
363       <tr>
364         <td>Budget id</td>
365         <td>Basket</td>
366         <td>Ordernumber</td>
367         <td>Details</td>
368       </tr>
369     </thead>
370     <tbody>
371       [% FOR r IN report %]
372           [% IF r.moved %]
373             [% IF r.orders_moved.size > 0 %]
374               [% FOR order IN r.orders_moved %]
375                 <tr>
376                   <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>
377                   <td>[% order.basketname | html %]</td>
378                   <td>[% order.ordernumber | html %]</td>
379                   <td>Moved!</td>
380                 </tr>
381               [% END %]
382             [% ELSE %]
383               <tr>
384                 <td>[% r.budget.budget_name | html %] (id=[% r.budget.budget_id | html %])</td>
385                 <td></td>
386                 <td></td>
387                 <td>There were no unreceived orders for this fund.</td>
388               </tr>
389             [% END %]
390           [% ELSE %]
391             [% IF r.error == 'budget_code_not_exists' %]
392               <tr>
393                 <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>
394                 <td></td>
395                 <td></td>
396                 <td>This fund code does not exist in the destination budget.</td>
397               </tr>
398             [% END %]
399           [% END %]
400         </tr>
401       [% END %]
402     </tbody>
403   </table>
404   <a class="cancel" href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Back</a>
405 [% END %]
406
407 <!--  DEFAULT  display budget periods list -->
408 [% IF ( else ) %]
409   <h2>Budgets administration</h2>
410
411     [% IF ( failed_delete_funds_exist ) %]
412         <div class="dialog message">Failed to delete budget because funds exist.</div>
413     [% END %]
414
415   [% INCLUDE 'budgets-active-currency.inc' %]
416
417   <div id="budgetsTabs" class="toptabs">
418     <ul>
419         <li><a href="#active">Active budgets</a></li>
420         <li><a href="#inactive">Inactive budgets</a></li>
421     </ul>
422
423     <div id="active">
424       [% IF ( period_active_loop ) %]
425         <table id="activeperiodst">
426           <thead>
427             <tr>
428               <th>Budget name</th>
429               <th class="title-string">Start date</th>
430               <th class="title-string">End date</th>
431               <th>Locked</th>
432               <th>Total</th>
433               <th>Actions</th>
434             </tr>
435           </thead>
436           <tbody>
437               [% FOREACH period_active IN period_active_loop %]
438                 <tr>
439                 <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>
440                 <td><span title="[% period_active.budget_period_startdate | html %]">[% period_active.budget_period_startdate | $KohaDates %]</span></td>
441                 <td><span title="[% period_active.budget_period_enddate | html %]">[% period_active.budget_period_enddate | $KohaDates %]</span></td>
442                 <td>
443                   [% IF ( period_active.budget_period_locked ) %]
444                     <span style="color:green;">Locked</span>&nbsp;
445                   [% END %]
446                 </td>
447                 <td class="data">[% period_active.budget_period_total | $Price %]</td>
448                 <td>
449                     [% PROCESS action_menu block_budget=period_active %]
450                 </td>
451                 </tr>
452               [% END %]
453           </tbody>
454         </table>
455       [% ELSE %]
456         No active budgets
457       [% END %]
458     </div>
459     <div id="inactive">
460       [% IF ( period_inactive_loop ) %]
461         <table id="inactiveperiodst">
462           <thead>
463               <tr>
464                   <th>Budget name</th>
465                   <th class="title-string">Start date</th>
466                   <th class="title-string">End date</th>
467                   <th>Locked</th>
468                   <th>Total</th>
469                   <th>Actions</th>
470               </tr>
471           </thead>
472           <tbody>
473               [% FOREACH period_loo IN period_inactive_loop %]
474                   <tr>
475                   <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>
476                   <td><span title="[% period_loo.budget_period_startdate | html %]">[% period_loo.budget_period_startdate | $KohaDates %]</span></td>
477                   <td><span title="[% period_loo.budget_period_enddate | html %]">[% period_loo.budget_period_enddate | $KohaDates %]</span></td>
478                   <td> [% IF ( period_loo.budget_period_locked ) %]<span style="color:green;">Locked</span>&nbsp;[% ELSE %][% END %] </td>
479                   <td class="data">[% period_loo.budget_period_total | $Price %]</td>
480                   <td>
481                         [% PROCESS action_menu block_budget=period_loo %]
482                   </td>
483                   </tr>
484               [% END %]
485           </tbody>
486         </table>
487       [% ELSE %]
488         No inactive budgets
489       [% END %]
490     </div>
491   </div>
492 [% END %]
493
494             </main>
495         </div> <!-- /.col-sm-10.col-sm-push-2 -->
496
497         <div class="col-sm-2 col-sm-pull-10">
498             <aside>
499                 [% INCLUDE 'acquisitions-menu.inc' %]
500             </aside>
501         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
502      </div> <!-- /.row -->
503
504 [% MACRO jsinclude BLOCK %]
505     [% INCLUDE 'calendar.inc' %]
506     [% INCLUDE 'datatables.inc' %]
507     [% IF close_form %]
508         [% Asset.js("lib/jquery/plugins/treetable/jquery.treetable.js") | $raw %]
509     [% END %]
510     [% Asset.js("js/acq.js") | $raw %]
511     <script>
512         $(document).ready(function() {
513             var tabs = $('#budgetsTabs').tabs();
514             [% IF ( tab ) %]
515                 tabs.tabs("option", "active", [% tab | html %]);
516             [% END %]
517             $("#activeperiodst,#inactiveperiodst").dataTable($.extend(true, {}, dataTablesDefaults, {
518                 "aoColumnDefs": [
519                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
520                     { "sType": "title-string", "aTargets" : [ "title-string" ] }
521                 ],
522                 "sPaginationType": "full",
523                 'bAutoWidth': false
524             } ) );
525
526             [% IF close_form %]
527               $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, {
528                 sDom: "t"
529               }));
530               $("#move_form").submit(function(){
531                 var budget_from = "[% budget_period_description | html %]";
532                 var budget_to = $("#to_budget_period_id").find("option:selected").html();
533                 var alert_message = _("You have chosen to move all unreceived orders from '%s' to '%s'.").format(budget_from, budget_to);
534                 alert_message += "\n" + _("This action cannot be reversed. Do you wish to continue?");
535                 return confirm ( alert_message );
536               });
537             [% END %]
538             [% IF closed %]
539               var oTable = $("#closed_report").dataTable($.extend(true, {}, dataTablesDefaults, {
540                 // The following is a c/p from aqbudgets.tt and is a candidate for refactoring.
541                 "fnDrawCallback": function ( oSettings ) {
542                     if ( oSettings.aiDisplay.length == 0 )
543                     {
544                         return;
545                     }
546
547                     var nTrs = $('#closed_report tbody tr');
548                     var iColspan = nTrs[1].getElementsByTagName('td').length;
549                     var sLastGroup = "";
550                     for ( var i=0 ; i<nTrs.length ; i++ )
551                     {
552                         var iDisplayIndex = oSettings._iDisplayStart + i;
553                         var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[0];
554                         if ( sGroup != sLastGroup )
555                         {
556                             var nGroup = document.createElement( 'tr' );
557                             var nCell = document.createElement( 'td' );
558                             nCell.colSpan = iColspan;
559                             nCell.className = "group";
560                             nCell.innerHTML = sGroup;
561                             nGroup.appendChild( nCell );
562                             nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] );
563                             sLastGroup = sGroup;
564                         }
565                     }
566                 },
567                 "aoColumnDefs": [
568                     { "bVisible": false, "aTargets": [ 0, 1 ] },
569                     { "bSortable": false, "aTargets": ["_all"] }
570                 ],
571                 'bSort': true,
572                 'aaSortingFixed': [[ 1, 'asc' ]],
573                 "bAutoWidth": false,
574                 "sPaginationType": "full_numbers"
575               }));
576             [% END %]
577             $("#add_modify_budget").validate({
578                 rules: {
579                     budget_period_startdate: "required",
580                     budget_period_enddate: {
581                         required: true,
582                         date_on_or_after: "#from"
583                     },
584                     budget_period_description: "required",
585                     budget_period_total: {
586                         number: true
587                     }
588                 },
589                 messages: {
590                     budget_period_enddate: {
591                         date_on_or_after: _("Budget end date must be on or after budget start date")
592                     }
593                 }
594             });
595         });
596     </script>
597 [% END %]
598 [% INCLUDE 'intranet-bottom.inc' %]