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