Merge commit 'workbuffer.org-koha/translation' into to-push
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / aqbudgets.tmpl
1 <!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
2 <title>Koha &rsaquo; Administration &rsaquo; Budgets<!-- TMPL_IF name="add_form" --> &rsaquo; <!--TMPL_IF NAME="budget_id" -->Modify Budget<!-- TMPL_IF NAME="budget_name" --> '<!-- TMPL_VAR NAME="budget_name" -->'<!-- /TMPL_IF --><!-- TMPL_ELSE -->Add Budget <!-- /TMPL_IF --><!-- /TMPL_IF --></title>
3 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
4 <!-- TMPL_INCLUDE NAME="calendar.inc" -->
5 <script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/js/acq.js"></script>
6
7 <!-- TMPL_IF name="add_form" -->
8 <script type="text/javascript">
9 //<![CDATA[
10 //
11      var actTotal ="";
12
13     function ownerRemove(f) {
14         document.getElementById('budget_owner_name').innerHTML = '';
15     }
16
17     function Check(f) {
18         var ok=1;
19         var _alertString="";
20         var alertString2;
21
22         // var actTotal ="";
23
24         if (!(isNotNull(f.budget_code,1))) {
25             _alertString += _("- Budget code cannot be blank\n");
26         }
27
28         if (!(isNotNull(f.budget_name,1))) {
29             _alertString += _("- Budget name cannot be blank\n");
30         }
31
32         if (!(isNotNull(f.budget_amount,1))) {
33             _alertString += _("- Budget amount cannot be blank\n");
34         }
35
36         var budgetId;
37         if   (typeof(f.budget_id ) != "undefined")  {
38             budgetId = f.budget_id.value
39         }
40
41         var newBudgetParent;
42
43 //  hack to test if selected parent_id in scrolling-list...
44 //  if value == 'undef' its got a selected_parent :/
45         if(f.budget_parent_id){
46             var chkAdd   =  f.budget_parent_id.value ;
47             if  (     typeof(chkAdd ) != "undefined") {
48                 newBudgetParent  =  f.budget_parent_id.value
49             } else {
50                 newBudgetParent  =  f.budget_parent_id.item(0).value
51             }
52
53             if   (budgetId  > 0)  {  ; //its a mod ...
54                 // if parent eq curent-budget, fail...
55                 if ( newBudgetParent  ==  budgetId     ) {
56                         _alertString += _("- Budget parent is current budget\n");
57                 }
58
59                 else if (newBudgetParent) {
60                     var result = checkBudgetParent(  budgetId , newBudgetParent   );
61                     if (result) {
62                         _alertString += result;
63                     }
64                 }
65             }
66         }
67
68          // else do lookup
69         var budgetTotal = Math.abs(f.budget_amount.value);
70         var result =   budgetExceedsParent  (budgetTotal, budgetId, newBudgetParent, f.budget_period_id.value)
71         if (result) {
72             _alertString += result;
73         }
74
75         if (_alertString.length==0) {
76             document.Aform.submit();
77         } else {
78             alertString2 = _("Form not submitted because of the following problem(s)\n");
79             alertString2 += "------------------------------------------------------------------------------------\n\n";
80             alertString2 += _alertString;
81             alert(alertString2);
82         }
83     }
84 //]]>
85 </script>
86 <!-- TMPL_ELSE -->
87 <link href="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/treetable/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
88
89 <script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
90 <script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/treetable/jquery.treeTable.min.js"></script>
91 <script type="text/javascript" src="<!-- TMPL_VAR NAME="themelang" -->/lib/jquery/plugins/jquery.qtip.js"></script>
92
93 <script type="text/javascript">
94 //<![CDATA[
95     //
96     $(document).ready(function() {
97         var tooltipcontent = $(".tooltipcontent");
98         tooltipcontent.hide();
99
100         $(".tooltiped td").each(function (){
101             contentelem = $(this).parent().children().filter(".tooltipcontent");
102             if(contentelem.html() != ""){
103             $(this).qtip({
104                 content: contentelem.html(),
105                 show: "mouseover",
106                 hide: "mouseout",
107                 style: {
108                     name: "light",
109                     tip: "bottomLeft",
110                     border: {
111                         radius: 5,
112                         color: "#356CA1"
113                     }
114                 },
115                 position: {
116                     corner: {
117                         target: "topRight",
118                         tooltip: "bottomRight"
119                     }
120                 }
121             });
122             }
123         });
124         <!-- TMPL_IF NAME="notree" -->
125         $("#budgeth").tablesorter({
126             widgets : ['zebra'],
127             sortList: [[0,0]],
128             headers: { 7: { sorter: false }}
129         });
130         <!-- TMPL_ELSE -->
131         $("#budgeth").treeTable();
132         <!-- /TMPL_IF -->
133     });
134 //]]>
135 </script>
136 <!-- /TMPL_IF -->
137
138 </head>
139 <body>
140 <!-- TMPL_INCLUDE NAME="header.inc" -->
141 <!-- TMPL_INCLUDE NAME="budgets-admin-search.inc" -->
142
143 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo;
144     <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/aqbudgetperiods.pl">Root budgets</a> &rsaquo; <!-- TMPL_IF NAME="else" -->Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'<!-- /TMPL_IF --><!-- TMPL_IF name="add_form" -->
145     <a href="/cgi-bin/koha/admin/aqbudgets.pl?budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Budgets</a> &rsaquo; <!-- TMPL_IF NAME="budget_id" -->Modify budget<!-- TMPL_IF NAME="budget_name" --> '<!-- TMPL_VAR NAME="budget_name" -->'<!-- /TMPL_IF --><!-- TMPL_ELSE -->Add budget<!-- /TMPL_IF --><!-- /TMPL_IF -->  <!-- TMPL_IF name="delete_confirm" -->
146     <a href="/cgi-bin/koha/admin/aqbudgets.pl">Budgets</a> &rsaquo; Delete budget?<!-- /TMPL_IF --></div>
147
148 <div id="doc3" class="yui-t2">
149 <div id="bd">
150 <div id="yui-main">
151 <div class="yui-b">
152
153 <!-- TMPL_UNLESS name="delete_confirm" --><!-- TMPL_INCLUDE NAME="budgets-admin-toolbar.inc" --><!-- /TMPL_UNLESS -->
154 <!-- TMPL_IF name="else" -->
155
156 <!-- TMPL_UNLESS NAME="cur" --><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><!-- /TMPL_UNLESS -->
157
158 <h1>Budgets for '<!-- TMPL_VAR name="budget_period_description" -->'</h1>
159 <table id="budgeth">
160     <thead>
161         <tr>
162             <th>Budget hierarchy</th>
163             <th>Budget name</th>
164             <th>Total<br />allocated</th>
165             <th>Base-level<br />allocated</th>
166             <th>Base-level<br />spent</th>
167             <th>Base-level<br />remaining</th>
168             <th class="tooltipcontent">&nbsp;</th>
169             <th>Actions</th>
170         </tr>
171     </thead>
172 <tfoot>
173     <tr>
174     <th colspan="2" style="text-align: left;" nowrap="nowrap">Period allocated <!--TMPL_IF NAME="budget_period_total" --><!-- TMPL_VAR NAME="budget_period_total"--><!-- /TMPL_IF -->  </th>
175     <th nowrap="nowrap" class="data"> <!-- TMPL_VAR NAME="period_alloc_total"--></th>
176     <th nowrap="nowrap"  class="data"> <!-- TMPL_VAR NAME="base_alloc_total"--></th>
177     <th class="data"><!-- TMPL_VAR NAME="base_spent_total"--></th>
178     <th class="data"><!-- TMPL_VAR NAME="base_remaining_total"--></th>
179     <th class="tooltipcontent"></th>
180     <th></th>
181     </tr>
182     </tfoot>
183     <tbody>
184     <!-- TMPL_IF NAME="budget" -->
185         <!-- TMPL_LOOP name="budget" -->
186     <!-- TMPL_IF NAME="toggle" -->
187     <tr id="node-<!-- TMPL_VAR NAME="budget_id" -->" class="highlight<!-- TMPL_IF NAME="budget_parent_id" --> child-of-node-<!-- TMPL_VAR NAME="budget_parent_id" --><!-- /TMPL_IF --> tooltiped">
188     <!-- TMPL_ELSE -->
189     <tr id="node-<!-- TMPL_VAR NAME="budget_id" -->" class="tooltiped <!-- TMPL_IF NAME="budget_parent_id" --> child-of-node-<!-- TMPL_VAR NAME="budget_parent_id" --><!-- /TMPL_IF -->">
190     <!-- /TMPL_IF -->
191
192     <td><!-- TMPL_VAR NAME="budget_code_indent" --></td>
193     <td><!-- TMPL_VAR NAME="budget_name" --></td>
194     <td class="data"><!-- TMPL_VAR NAME="budget_amount_total" --></td>
195     <td class="data"><!-- TMPL_VAR NAME="budget_amount" --> </td>
196     <td class="data"><!-- TMPL_VAR NAME="budget_spent" --> </td>
197     <td class="data"
198     <!-- TMPL_IF NAME="remaining_pos" --> style="color: green;" <!-- /TMPL_IF -->
199     <!-- TMPL_IF NAME="remaining_neg" --> style="color: red;" <!-- /TMPL_IF -->   >
200     <!-- TMPL_VAR NAME="budget_remaining" --> </td>
201
202     <td class="tooltipcontent"><!-- TMPL_IF NAME="budget_owner_id" --><strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a><!-- /TMPL_IF --><!-- TMPL_IF NAME="budget_branchcode" --><br /><strong>Library: </strong><!-- TMPL_VAR NAME="budget_branchcode" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="budget_notes" --><br /><strong>Notes: </strong><!-- TMPL_VAR NAME="budget_notes" --><!-- /TMPL_IF --></td>
203     <!-- TMPL_IF NAME="budget_lock"-->
204         <td> <span style="color: gray;" > Edit Delete </span> </td>
205     <!-- TMPL_ELSE -->
206         <td>
207             <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->" >Edit</a>
208             <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=delete_confirm&amp;budget_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Delete</a>
209             <a href="/cgi-bin/koha/admin/aqbudgets.pl?op=add_form&amp;budget_parent_id=<!-- TMPL_VAR NAME="budget_id" -->&amp;budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->">Add Sub-Budget</a>
210         </td>
211     <!-- /TMPL_IF -->
212     </tr>
213         <!-- /TMPL_LOOP -->
214     <!-- TMPL_ELSE -->
215         <tr><td colspan="12">No budget found</td></tr>
216     <!-- /TMPL_IF -->
217     </tbody>
218 </table>
219
220 <!-- TMPL_IF name="cur" --><p><b>Currency = <!-- TMPL_VAR NAME="cur" --> <!-- TMPL_VAR NAME="cur_format" --></b></p><!-- /TMPL_IF -->
221 <!-- TMPL_IF NAME="pagination_bar" --><div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div><!-- /TMPL_IF -->
222 <!-- /TMPL_IF --> <!-- else -->
223
224 <!-- ********************************************************************************************** -->
225 <!-- create add/mod entry form -->
226 <!-- TMPL_IF name="add_form" -->
227
228 <form action="/cgi-bin/koha/admin/aqbudgets.pl" name="Aform" method="post">
229     <fieldset class="rows">
230     <legend><!-- TMPL_IF NAME="budget_id" -->Modify<!-- TMPL_ELSE -->Add<!-- /TMPL_IF --> Budget
231     <!-- TMPL_IF NAME="budget_period_description" -->
232         <!-- TMPL_VAR NAME="budget_name" --> for period <!-- TMPL_VAR NAME="budget_period_description" -->
233     <!-- /TMPL_IF -->
234     </legend>
235
236     <input type="hidden" name="op" value="add_validate" />
237     <input type="hidden" name="checked" value="0" />
238     <ol>
239     <!-- TMPL_IF NAME="budget_parent_id" -->
240     <li>
241         <span class="label">Budget Parent: </span>
242         <!-- TMPL_VAR NAME="budget_parent_name" -->
243         <!-- TMPL_VAR NAME="budget_parent_id" --> - <!-- TMPL_VAR NAME="budget_parent_name" -->
244         <input type="hidden" name="budget_parent_id" value="<!-- TMPL_VAR NAME="budget_parent_id" -->" />
245     </li>
246     <!-- /TMPL_IF -->
247     <li>
248     <label class="required"  for="budget_code">Budget Code: </label>
249     <input type="text" name="budget_code" id="budget_code" value="<!-- TMPL_VAR NAME="budget_code" -->" size="30" />
250     </li>
251
252     <li>
253     <label class="required" for="budget_name">Budget Name: </label>
254     <input type="text" name="budget_name" id="budget_name" value="<!-- TMPL_VAR NAME="budget_name" -->" size="60" />
255     </li>
256
257     <li>
258     <label style="white-space: nowrap;" for="budget_amount" class="required">Amount: </label>
259     <input type="text" name="budget_amount" id="budget_amount" value="<!-- TMPL_VAR NAME="budget_amount" -->" size="8" />
260     </li>
261
262     <li>
263     <label for="budget_encumb">Encumbrance: </label>
264     <input type="text" name="budget_encumb" id="budget_encumb" value="<!-- TMPL_VAR NAME="budget_encumb" -->" size="8" />
265     </li>
266
267     <li>
268     <label for="budget_expend">Expenditure: </label>
269     <input type="text" name="budget_expend" id="budget_expend" value="<!-- TMPL_VAR NAME="budget_expend" -->" size="8" /><input type="hidden" name="budget_owner_id" id="budget_owner_id" value="<!-- TMPL_VAR NAME="budget_owner_id" -->" />
270     </li>
271
272     <li>
273     <span class="label">Owner: </span>
274     <span  id="budget_owner_name">
275     <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a>
276     </span>
277
278     <!-- FIXME: hardcoded button positions :/ -->
279     <input style="" type="button" id="edit_owner" value="Edit owner" onclick="ownerPopup(); return false;" />
280     <input style=""  type="button" id="remove_owner" value="Remove owner" onclick="ownerRemove(this.form); return false;" />
281     </li>
282
283     <li>
284     <label for="budget_branchcode">Library: </label>
285     <select name="budget_branchcode" id="budget_branchcode">
286     <option value=""></option>
287     <!-- TMPL_LOOP name="branchloop_select" -->
288         <!-- TMPL_IF name="selected" --> <option value="<!-- TMPL_VAR name="value" -->" > <!--TMPL_ELSE--> <option value="<!-- TMPL_VAR name="value" -->" selected="selected"> <!-- /TMPL_IF --> <!-- TMPL_VAR name="branchname" --></option>
289     <!-- /TMPL_LOOP -->
290     </select>
291     </li>
292
293     <li>
294     <label for="budget_permission">Restrict access to: </label>
295     <!-- TMPL_VAR name="budget_perm_dropbox" -->
296     </li>
297
298     <li>
299     <label for="budget_notes">Notes: </label>
300     <textarea name="budget_notes" id="budget_notes"  cols="80" rows="6"><!-- TMPL_VAR NAME="budget_notes" --></textarea>
301     </li>
302
303     <li>
304     <label  style="white-space: nowrap;" for="authorised_value_category1">Planning Category1: </label>
305         <select name="sort1_authcat" id="authorised_value_category1">
306             <option value=""></option>
307             <!-- TMPL_LOOP name="authorised_value_categories1" -->
308                 <!-- TMPL_IF name="selected" -->
309                     <option value="<!-- TMPL_VAR name="category" -->" selected="selected">
310                         <!-- TMPL_VAR name="category" -->
311                     </option>
312                 <!-- TMPL_ELSE -->
313                     <option value="<!-- TMPL_VAR name="category" -->">
314                         <!-- TMPL_VAR name="category" -->
315                     </option>
316                 <!-- /TMPL_IF -->
317             <!-- /TMPL_LOOP -->
318         </select>
319     </li>
320     <li>
321     <label  style="white-space: nowrap;" for="authorised_value_category2">Planning Category2: </label>
322         <select name="sort2_authcat" id="authorised_value_category2">
323             <option value=""></option>
324             <!-- TMPL_LOOP name="authorised_value_categories2" -->
325                 <!-- TMPL_IF name="selected" -->
326                     <option value="<!-- TMPL_VAR name="category" -->" selected="selected">
327                         <!-- TMPL_VAR name="category" -->
328                     </option>
329                 <!-- TMPL_ELSE -->
330                     <option value="<!-- TMPL_VAR name="category" -->">
331                         <!-- TMPL_VAR name="category" -->
332                     </option>
333                 <!-- /TMPL_IF -->
334             <!-- /TMPL_LOOP -->
335         </select>
336     </li>
337     </ol>
338
339     <!-- TMPL_IF NAME="budget_id" -->
340         <input type="hidden" name="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" />
341     <!-- /TMPL_IF -->
342     </fieldset>
343
344     <fieldset class="action">
345         <input type="submit" value="Submit" onclick="Check(this.form); return false;" /> <a class="cancel" href="/cgi-bin/koha/admin/aqbudgets.pl">Cancel</a>
346         <input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR name="budget_period_id" -->" />
347     </fieldset>
348 </form>
349
350 <!-- /TMPL_IF --> <!-- add_form -->
351
352 <!-- TMPL_IF name="delete_confirm" -->
353 <div class="dialog alert"> <h3>Delete Budget <!-- TMPL_VAR NAME="budget_name" -->?</h3>
354 <table>
355     <tr>
356     <th scope="row">Budget Amount:</th>
357     <td><!-- TMPL_VAR NAME="budget_amount" --></td>
358     </tr>
359 </table>
360
361 <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
362     <input type="hidden" name="op" value="delete_confirmed" />
363     <input type="hidden" name="budget_id" value="<!-- TMPL_VAR NAME="budget_id" -->" />
364     <input type="hidden" name="budget_period_id" value="<!-- TMPL_VAR NAME="budget_period_id" -->" />
365     <input type="submit" value="Delete this budget" class="approve" />
366 </form>
367
368 <form action="<!-- TMPL_VAR NAME="action" -->" method="get">
369     <input type="submit" class="deny" value="No, Do Not Delete" />
370 </form>
371 </div>
372 <!-- /TMPL_IF -->
373
374 </div>
375 </div>
376 <div class="yui-b">
377 <!-- TMPL_IF NAME="else" --><form action="/cgi-bin/koha/admin/aqbudgets.pl" method="get">
378     <fieldset class="brief">
379     <h4>Budget filters</h4>
380         <ol>
381         <li>
382             <label for="filter_budgetbranch2">Library: </label>
383             <select name="filter_budgetbranch" id="filter_budgetbranch2" style="width:10em;">
384                 <option value=""></option>
385                 <!-- TMPL_LOOP name="branchloop" -->
386                 <option value="<!-- TMPL_VAR name="value" -->" <!-- TMPL_IF name="selected" -->selected<!-- /TMPL_IF -->><!-- TMPL_VAR name="branchname" --></option>
387                 <!-- /TMPL_LOOP -->
388             </select>
389         </li>
390         <li class="radio">
391
392         <label for="show_mine">Show my<br /> budgets only</label>
393             <!-- TMPL_IF NAME="show_mine" -->
394                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" checked="checked" />
395             <!-- TMPL_ELSE -->
396                 <input type="checkbox" id="show_mine"  name="show_mine" value="1" />
397         <!-- /TMPL_IF -->
398         </li>
399         </ol>
400
401         <input type="hidden" name="show" value="1" />
402         <input type="hidden"  name="budget_period_id" value="<!-- TMPL_VAR NAME="budget_period_id" -->" />
403         <input type="submit" class="submit" name="filter" value="Go" />
404     </fieldset>
405 </form><!-- /TMPL_IF -->
406
407 </div>
408 </div>
409 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->