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