Bug 20538: Remove the need of writing [% KOHA_VERSION %] everywhere
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqplan.tt
blob324e08946c1db5cc127e9609ab9bdd99c4cb763b
1 [% USE Asset %]
2 [% USE Price %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo; Budgets &rsaquo; Funds &rsaquo; Planning for [% budget_period_description %] by [% authcat %]</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <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>
8 </head>
10 <body id="admin_aqplan" class="admin">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'budgets-admin-search.inc' %]
14 <div id="breadcrumbs">
15     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
16     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
17     <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Budgets</a> &rsaquo; 
18     <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=[% budget_period_id %]">Funds</a> &rsaquo;
19     <a href="/cgi-bin/koha/admin/aqplan.pl?budget_period_id=[% budget_period_id %]">Planning</a> &rsaquo;
20 </div>
22 <div id="doc3" class="yui-t2">
23 <div id="bd">
24 <div id="yui-main">
25 <div class="yui-b">
27 [% INCLUDE 'budgets-admin-toolbar.inc' %]
29 <form method="post" id="Aform" name="Aform"  action="/cgi-bin/koha/admin/aqplan.pl">
30 <h3>Planning for [% budget_period_description %] by [% authcat %]</h3>
31 <input type="hidden" name="authcat" value="[% authcat %]" />
32 <!-- Budget Lines -->
34     [% IF ( budget_lines ) %]
36         [% INCLUDE 'budgets-active-currency.inc' %]
37         [% IF ( show_actual ) %]
38             <p><b>Each cell contain both actual and estimated values.</b></p>
39         [% ELSE %]
40             <p><b>Cells contain estimated values only.</b></p>
41         [% END %]
43     <p id="selections">
44         <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>
45         [% FOREACH authvals_ro IN authvals_row %]
46             <span class="selected"><label><input type="checkbox" checked="checked" id="col[% authvals_ro.colnum %]">[% authvals_ro.code %]</label></span>
47         [% END %]
48     </p>
49     <table id="plan">
50     <thead>
51     <tr>
52     <th>Fund name</th>
53     <th>Fund total</th>
55     [% FOREACH authvals_ro IN authvals_row %]
56          [% IF ( authvals_ro.display ) %]
57             <th id="col[% authvals_ro.code %]" class="[% authvals_ro.colnum %]">
58         [% ELSE %]
59             <th id="col[% authvals_ro.code %]" style="display:none;" class="[% authvals_ro.colnum %]">
60         [% END %]
62     [% authvals_ro.code %]</th>
63     [% END %]
65     <th class="remaining">Fund remaining</th><th>&nbsp;</th>
66     </tr>
67     </thead>
69     <tbody>
70     [% FOREACH budget_line IN budget_lines %]
71     <tr>
72         [% IF ( budget_line.budget_lock ) %]
73             <td class="locked" title="Fund locked">
74         [% ELSE %]
75             <td>
76         [% END %]
77         <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=[% budget_line.budget_id %]&amp;budget_period_id=[% budget_period_id %]">[% budget_line.budget_name %]</a></td>
78         <td><span id="[% budget_line.budget_amount %]">[% budget_line.budget_amount | $Price %]&nbsp;</span>
81         <!-- NEXT DIV ELEMENT IS USED BY JS FOR CALC-ING AUTO-FILL AND ESTIMATED AMOUNTS -->
82         <div style="display:none;" id="budget_tot_[% budget_line.budget_id %]">[% budget_line.budget_amount %]</div></td>
84         [% FOREACH line IN budget_line.lines %]
85             [% IF ( line.display ) %]
86                 <td class="[% line.colnum %]">
87             [% ELSE %]
88                 <td style="display:none;" class="[% line.colnum %]">
89             [% END %]
90             <table class="invis">
91                 <tr>
92                     [% IF show_actual %]
93                         <td    >[% line.actual_amount %]</td>
94                     [% END %]
95                 <td>
97                 [% IF ( line.budget_lock ) %]
98                     [% line.estimated_amount %]&nbsp;
99                     <input type="hidden" style="text-align: right;"  name="[% line.cell_name %]" value="[% line.estimated_amount %]"   />
100                 [% ELSE %]
101                     <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);" />
102                 [% END %]
104                 </td></tr>
105             </table>
106             </td>
107         [% END %]
109         <td>
110         <table class="invis">
111             <tr>
112        [% IF show_actual %]
113             [% IF ( budget_line.act_negative ) %]
114                 <td style="color: red;">
115             [% ELSIF ( budget_line.act_positive ) %]
116                 <td style="color: green;">
117             [% ELSE %]
118                 <td>
119             [% END %]
120                     [% budget_line.budget_act_remain %]
121             </td>
122         [% END %]
124         [% IF ( budget_line.est_negative ) %]
125             <td style="color: red;" id="budget_est_[% budget_line.budget_id %]">
126         [% ELSIF ( budget_line.est_positive ) %]
127             <td style="color: green;" id="budget_est_[% budget_line.budget_id %]">
128         [% ELSE %]
129             <td id="budget_est_[% budget_line.budget_id %]">
130         [% END %] 
131                 [% budget_line.budget_est_remain | $Price %]&nbsp;
132             </td>
133             </tr>
134         </table>
135         </td>
137         <td>
138              [% UNLESS ( budget_line.budget_lock ) %]
139                     <input type="button"  onclick="autoFillRow('[% budget_line.budget_id %]')" value="Auto-fill row"/>
140             [% ELSE %]
141              <div style="color:red;">not owned</div>
142             [% END %]
143         </td>
144         </tr>
145     [% END %]
146     </tbody>
147     </table>
149     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
150     [% IF ( budget_period_locked ) %]
151         <!-- <input STYLE="background: gray;"   type="submit" value="Save" disabled="disabled"/> -->
152     [% ELSE %]
153         <fieldset class="action"><input type="button"  onclick="Check(this.form)" value="Save"/></fieldset>
154     [% END %]
157 <div id="hide_div">
158     [% FOREACH authvals_ro IN authvals_row %]
160      [% UNLESS ( authvals_ro.display ) %]
161         <input type="hidden" value="[% authvals_ro.code %]"  name="hide_cols"/>
162      [% END %]
163     [% END %]
165  </div>
168 </form>
170         [% ELSIF not budget_period_id %]
171 <div class="dialog alert">That budget does not exist! Please select a budget to continue.</div>
172         [% ELSE %]
173 <div class="dialog message">No funds to display for this search criteria</div>
174         [% END %]
177 </div>
178 </div>
179 <div class="yui-b">
181 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
182     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
183 <fieldset class="brief">
184 <h4>Filter</h4>
185 [% BLOCK planning_types %]
186 [%   SWITCH type %]
187 [%     CASE 'MONTHS'    %]<span>by months</span>
188 [%     CASE 'ITEMTYPES' %]<span>by item types</span>
189 [%     CASE 'BRANCHES'  %]<span>by libraries</span>
190 [%     CASE             %]<span>by [% type %]</span>
191 [%   END %]
192 [% END %]
193 <ol>
194     <li>
195         <label for="authcat"> Select planning type:</label>
196         <select name="authcat" id="authcat" size="1">
197         [% FOREACH value IN authcat_dropbox.values %]
198             [% IF ( value == authcat_dropbox.default ) %]
199             <option value="[% value %]" selected="selected">[% PROCESS planning_types type=value %]</option>
200             [% ELSE %]
201             <option value="[% value %]">[% PROCESS planning_types type=value %]</option>
202             [% END %]
203         [% END %]
204         </select>
205     </li>
206     <li class="radio">
207     [% IF ( show_mine ) %]
208         <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
209     [% ELSE %]
210         <input type="checkbox" id="show_mine"  name="show_mine" value="1"  />
211     [% END %]
212     <label for="show_mine">Show my funds only</label>
213     </li>
215     <li class="radio">
216     [% IF ( show_active ) %]
217         <input type="checkbox" id="show_active" name="show_active" value="1" checked="checked" />
218     [% ELSE %]
219         <input type="checkbox" id="show_active" name="show_active" value="1" />
220         [% END %]
221     <label for="show_active">Show active funds only</label>
222     </li>
225     <li class="radio">
226         [% IF ( show_actual ) %]
227             <input type="checkbox" id="show_actual" name="show_actual" value="1" checked="checked" />
228         [% ELSE %]
229             <input type="checkbox" id="show_actual" name="show_actual" value="1"  />
230         [% END %]
231         <label for="show_actual">Show actual/estimated values</label>
232     </li>
233     </ol>
234     <fieldset class="action">
235         <input type="submit" name="option_submit" value="Submit" />
236         <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
237     </fieldset>
238 </fieldset>
239 </form>
240 [% IF ( budget_lines ) %]
241 <form method="post" action="/cgi-bin/koha/admin/aqplan.pl">
242 <fieldset class="brief">
243 <h4>Export</h4>
244     <ol>
245         <li><label for="basename">Output to a file named: </label><input type="text" name="basename" id="basename" value="Export" /></li>
246         <li><label class="inline" for="MIME">Into an application</label>
247             <select name="MIME" id="MIME" size="1">
248             [% FOREACH value IN CGIextChoice %]
249                 <option value="[% value %]">[% value %]</option>
250             [% END %]
251             </select>
252             <select name="sep" id="sep" size="1">
253             [% FOREACH value IN CGIsepChoice %]
254                 <option value="[% value %]">[% value %]</option>
255             [% END %]
256             </select>
257         </li>
258     </ol>
259     <fieldset class="action">    <input type="submit" value="Submit"/>
260     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
261     <input type="hidden" name="report_name" value="[% report_name %]" />
262     <input type="hidden" name="output" value="file" /></fieldset>
263     <input type="hidden" name="budget_period_id" value="[% budget_period_id %]" />
264     <input type="hidden" name="authcat" value="[% authcat %]" />
265     </fieldset>
266 </form>
267 [% END %]
269 [% INCLUDE 'acquisitions-menu.inc' %]
270 </div>
271 </div>
272 [% MACRO jsinclude BLOCK %]
273     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") %]
274     [% Asset.js("js/acq.js") %]
275     <script type="text/javascript">
276     //<![CDATA[
277         function Check(f) {
278                 var ok=1;
279                 var _alertString="";
280                 var alertString2;
281                 var arr = document.getElementsByName('est_total')
283                 for ( var i=0, len=arr.length; i<len; ++i ){
284                         var tot = arr[i].innerHTML;
286                         if (tot == 'NaN') {
287                             _alertString += "\n- " + _("One or more cell values is non-numeric");
288                         }
289                 }
291                 if (_alertString.length==0) {
293                     var op  = document.createElement('input');
294                     op.setAttribute("type","hidden");
295                     op.setAttribute("name","op");
296                     op.setAttribute("value","save");   //ohh the pain...
298                     document.Aform.appendChild(op);
299                     document.Aform.submit()
301                 } else {
302                         alertString2  = _("Form not submitted because of the following problem(s)");
303                         alertString2 += "\n------------------------------------------------------------------------------------\n";
304                         alertString2 += _alertString;
305                         alert(alertString2);
306                 }
307         }
308         $(document).ready(function() {
309             $("#selections input").on("change",function(e){
310                 var num = $(this).attr("id");
311                 if(num == 'showall'){
312                     showAllColumns();
313                     e.stopPropagation();
314                 } else if(num == 'hideall'){
315                     hideAllColumns();
316                     e.stopPropagation();
317                 } else {
318                     if($(this).prop("checked")){
319                         showColumn(num);
320                     } else {
321                         hideColumn(num);
322                     }
323                 }
324             });
325         });
326     //]]>
327     </script>
328 [% END %]
329 [% INCLUDE 'intranet-bottom.inc' %]