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