Bug 12164: follow-up: various fixes
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqplan.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description %] by [% authcat %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
5 <script type="text/javascript" src="[% themelang %]/js/acq.js"></script>
6 <script type="text/javascript">
7 //<![CDATA[
8     function Check(f) {
9             var ok=1;
10             var _alertString="";
11             var alertString2;
12             var arr = document.getElementsByName('est_total')
13
14             for ( var i=0, len=arr.length; i<len; ++i ){
15                     var tot = arr[i].innerHTML;
16
17                     if (tot == 'NaN') {
18                         _alertString += "\n- " + _("One or more cell values is non-numeric");
19                     }
20             }
21
22             if (_alertString.length==0) {
23
24                 var op  = document.createElement('input');
25                 op.setAttribute("type","hidden");
26                 op.setAttribute("name","op");
27                 op.setAttribute("value","save");   //ohh the pain...
28
29                 document.Aform.appendChild(op);
30                 document.Aform.submit()
31
32             } else {
33                     alertString2  = _("Form not submitted because of the following problem(s)");
34                     alertString2 += "\n------------------------------------------------------------------------------------\n";
35                     alertString2 += _alertString;
36                     alert(alertString2);
37             }
38     }
39     $(document).ready(function() {
40         $("#selections input").on("change",function(e){
41             var num = $(this).attr("id");
42             if(num == 'showall'){
43                 showAllColumns();
44                 e.stopPropagation();
45             } else if(num == 'hideall'){
46                 hideAllColumns();
47                 e.stopPropagation();
48             } else {
49                 if($(this).attr("checked")){
50                     showColumn(num);
51                 } else {
52                     hideColumn(num);
53                 }
54             }
55         });
56     });
57 //]]>
58 </script>
59 <style type="text/css">td.locked { background-image: url('[% interface %]/[% theme %]/img/locked.png'); padding-left : 20px; background-repeat: no-repeat; background-position: 5px 5px; } a.control { font-size:85%;text-decoration:none; }</style>
60 </head>
61 <body id="admin_aqplan" class="admin">
62 [% INCLUDE 'header.inc' %]
63 [% INCLUDE 'budgets-admin-search.inc' %]
64
65 <div id="breadcrumbs">
66     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
67     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
68     <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; 
69     <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo;
70     <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]">Planning</a> &rsaquo;
71 </div>
72
73 <div id="doc3" class="yui-t2">
74 <div id="bd">
75 <div id="yui-main">
76 <div class="yui-b">
77
78 [% INCLUDE 'budgets-admin-toolbar.inc' %]
79
80 <form method="post" id="Aform" name="Aform"  action="/cgi-bin/koha/admin/aqplan.pl">
81 <h3>Planning for [% budget_period_description %] by [% authcat %]</h3>
82 <input type="hidden" name="authcat" value="[% authcat %]" />
83 <!-- Budget Lines -->
84
85     [% IF ( budget_lines ) %]
86
87     [% IF ( currency ) %]<p><b>Currency = [% currency %]</b>.
88     [% IF ( show_actual ) %]
89         <b>Each cell contain both actual and estimated values.</b>
90     [% ELSE %]
91         <b>Cells contain estimated values only.</b>
92     [% END %]
93     </p>[% ELSE %]<div class="dialog alert"><h3>No active currency is defined</h3><p>Please <a href="/cgi-bin/koha/admin/currency.pl">specify an active currency</a>.</p></div>
94 [% IF ( show_actual ) %]
95         <p><b>Each cell contain both actual and estimated values.</b></p>
96     [% ELSE %]
97         <p><b>Cells contain estimated values only.</b></p>
98     [% END %]
99     [% END %]
100     <p id="selections">
101         <strong>Show/hide columns:</strong> <span class="selected"><input type="checkbox" checked="checked" id="showall"/><label for="showall">Show all columns</label></span> <span><input type="checkbox" id="hideall"/><label for="hideall">Hide all columns</label></span>
102         [% FOREACH authvals_ro IN authvals_row %]
103             <span class="selected"><label><input type="checkbox" checked="checked" id="col[% authvals_ro.colnum %]">[% authvals_ro.code %]</label></span>
104         [% END %]
105     </p>
106     <table id="plan">
107     <thead>
108     <tr>
109     <th>Fund name</th>
110     <th>Fund total</th>
111
112     [% FOREACH authvals_ro IN authvals_row %]
113          [% IF ( authvals_ro.display ) %]
114             <th id="col[% authvals_ro.code %]" class="[% authvals_ro.colnum %]">
115         [% ELSE %]
116             <th id="col[% authvals_ro.code %]" style="display:none;" class="[% authvals_ro.colnum %]">
117         [% END %]
118
119     [% authvals_ro.code %]</th>
120     [% END %]
121
122     <th class="remaining">Fund remaining</th><th>&nbsp;</th>
123     </tr>
124     </thead>
125
126     <tbody>
127     [% FOREACH budget_line IN budget_lines %]
128     [% UNLESS ( loop.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %]
129         [% IF ( budget_line.budget_lock ) %]
130             <td class="locked" title="Fund locked">
131         [% ELSE %]
132             <td>
133         [% END %]
134         <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget_line.budget_id %]&amp;budget_period_id=[% budget_line.budget_period_id %]">[% budget_line.budget_name_indent %]</a></td>
135         <td><span id="budget_tot_formatted_[% budget_line.budget_id %]">[% budget_line.budget_amount_formatted %]&nbsp;</span>
136
137
138         <!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
139         <div style="display:none;" id="budget_tot_[% budget_line.budget_id %]">[% budget_line.budget_amount %]</div></td>
140
141         [% FOREACH line IN budget_line.lines %]
142             [% IF ( line.display ) %]
143                 <td class="[% line.colnum %]">
144             [% ELSE %]
145                 <td style="display:none;" class="[% line.colnum %]">
146             [% END %]
147             <table class="invis">
148                 <tr>
149                     [% IF ( line.show_actual ) %]
150                         <td    >[% line.actual_amount %]</td>
151                     [% END %]
152                 <td>
153
154                 [% IF ( line.budget_lock ) %]
155                     [% line.estimated_amount %]&nbsp;
156                     <input type="hidden" style="text-align: right;"  name="[% line.cell_name %]" value="[% line.estimated_amount %]"   />
157                 [% ELSE %]
158                     <input type="text" style="text-align: right;  width:90%; " size="6" name="[% line.cell_name %]"  value="[% line.estimated_amount %]"  id="budget_[% line.budget_id %][% line.colnum %]" class="plan_entry_[% line.budget_id %]" onchange="calcTotalRow(this);" />
159                 [% END %]
160
161                 </td></tr>
162             </table>
163             </td>
164         [% END %]
165
166         <td>
167         <table class="invis">
168             <tr>
169        [% IF ( budget_line.show_actual ) %]
170             [% IF ( budget_line.act_negative ) %]
171                 <td style="color: red;">
172             [% ELSIF ( budget_line.act_positive ) %]
173                 <td style="color: green;">
174             [% ELSE %]
175                 <td>
176             [% END %]
177                     [% budget_line.budget_act_remain %]
178             </td>
179         [% END %]
180
181         [% IF ( budget_line.est_negative ) %]
182             <td style="color: red;" id="budget_est_[% budget_line.budget_id %]">
183         [% ELSIF ( budget_line.est_positive ) %]
184             <td style="color: green;" id="budget_est_[% budget_line.budget_id %]">
185         [% ELSE %]
186             <td id="budget_est_[% budget_line.budget_id %]">
187         [% END %] 
188                 [% budget_line.budget_est_remain %]&nbsp;
189             </td>
190             </tr>
191         </table>
192         </td>
193
194         <td>
195              [% UNLESS ( budget_line.budget_lock ) %]
196                     <input type="button"  onclick="autoFillRow('[% budget_line.budget_id %]')" value="Auto-fill row"/>
197             [% ELSE %]
198              <div style="color:red;">not owned</div>
199             [% END %]
200         </td>
201         </tr>
202     [% END %]
203     </tbody>
204     </table>
205
206     [% IF ( budget_period_locked ) %]
207         <!-- <input STYLE="background: gray;"   type="submit" value="Save" disabled="disabled"/> -->
208     [% ELSE %]
209         <fieldset class="action"><input type="button"  onclick="Check(this.form)" value="Save"/></fieldset>
210     [% END %]
211
212
213 <div id="hide_div">
214     [% FOREACH authvals_ro IN authvals_row %]
215
216      [% UNLESS ( authvals_ro.display ) %]
217         <input type="hidden" value="[% authvals_ro.code %]"  name="hide_cols"/>
218      [% END %]
219     [% END %]
220
221  </div>
222
223
224 </form>
225
226         [% ELSE %]
227 <div class="dialog message">No funds to display for this search criteria</div>
228         [% END %]
229
230
231 </div>
232 </div>
233 <div class="yui-b">
234
235 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
236 <fieldset class="brief">
237 <h4>Filter</h4>
238
239 <ol>
240     <li>
241         <label for="authcat"> Select planning type:</label>
242         [% authcat_dropbox %]
243     </li>
244     <li class="radio">
245     [% IF ( show_mine ) %]
246         <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
247     [% ELSE %]
248         <input type="checkbox" id="show_mine"  name="show_mine" value="1"  />
249     [% END %]
250     <label for="show_mine">Show my funds only</label>
251     </li>
252
253     <li class="radio">
254     [% IF ( show_active ) %]
255         <input type="checkbox" id="show_active" name="show_active" value="1" checked="checked" />
256     [% ELSE %]
257         <input type="checkbox" id="show_active" name="show_active" value="1" />
258         [% END %]
259     <label for="show_active">Show active funds only</label>
260     </li>
261
262
263     <li class="radio">
264         [% IF ( show_actual ) %]
265             <input type="checkbox" id="show_actual" name="show_actual" value="1" checked="checked" />
266         [% ELSE %]
267             <input type="checkbox" id="show_actual" name="show_actual" value="1"  />
268         [% END %]
269         <label for="show_actual">Show actual/estimated values</label>
270     </li>
271     </ol>
272 <fieldset class="action">
273         <input type="submit" name="option_submit" value="Submit" /></fieldset>
274 </fieldset>
275 </form>
276 [% IF ( budget_lines ) %]
277 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
278 <h4>Export</h4>
279 <fieldset class="brief">
280     <ol>
281     <li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /></li>
282     <li><label class="inline" for="MIME">Into an application
283     </label>[% CGIextChoice %]
284     [% CGIsepChoice %]</li>
285     </ol>
286     <fieldset class="action">    <input type="submit" value="Submit"/>
287     <input type="hidden" name="report_name" value="[% report_name %]" />
288     <input type="hidden" name="output" value="file" /></fieldset>
289     </fieldset>
290 </form>
291 [% END %]
292
293 [% INCLUDE 'acquisitions-menu.inc' %]
294 </div>
295 </div>
296 [% INCLUDE 'intranet-bottom.inc' %]