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