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