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