Plugins  LAST
 All Data Structures Files Functions Variables Pages
coprop-javascript.js
Go to the documentation of this file.
1 /*
2  * Copyright 2010 De Bontridder Dany <dany@alchimerys.be>
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 /**
21  * Modifier un copropriétaire et les lots qu'il a
22  */
23 function mod_coprop(dossier,coprop_id,plugin_code,ac)
24 {
25  waiting_box();
26  try
27  {
28  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&coprop_id="+coprop_id+'&ac='+ac+"&act=modcopro";
29  var action=new Ajax.Request ( 'ajax.php',
30  {
31  method:'get',
32  parameters:queryString,
33  onFailure:null,
34  onSuccess:function (response)
35  {
36  try
37  {
38  remove_waiting_box();
39  $('listcoprolot').hide();
40  $('ajoutcopro').hide();
41  $('divcopropmod').innerHTML=response.responseText;
42  //response.responseText.evalScripts();
43  }
44  catch(e)
45  {
46  alert_box("Réponse Ajax ="+e.message);
47  }
48  }
49  }
50  );
51  }
52  catch(e)
53  {
54  alert_box(e.message);
55  }
56 }
57 function remove_lot(plugin_code,ac,dossier,lot_id)
58 {
59  if (! confirm("Vous voulez enlever ce lot ?")) { return;}
60  waiting_box();
61  try
62  {
63  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&lot_id="+lot_id+'&ac='+ac+"&act=removelot";
64  var action=new Ajax.Request ( 'ajax.php',
65  {
66  method:'get',
67  parameters:queryString,
68  onFailure:null,
69  onSuccess:function (response)
70  {
71  try
72  {
73  remove_waiting_box();
74  $("row"+lot_id).style.color="red";
75  $("row"+lot_id).style.textDecoration="line-through";
76  $("col"+lot_id).style.textDecoration="none";
77  $("col"+lot_id).innerHTML="Effacé";
78 
79  //response.responseText.evalScripts();
80  }
81  catch(e)
82  {
83  alert_box("Réponse Ajax ="+e.message);
84  }
85  }
86  }
87  );
88  }
89  catch(e)
90  {
91  alert_box(e.message);
92  }
93 }
94 /**
95  * Ajout un lien entre copropriétaire et lot
96  */
97 function add_coprop()
98 {
99  try
100  {
101  $('listcoprolot').hide();
102  $('ajoutcopro').show();
103  }
104  catch(e)
105  {
106  alert_box(e.message);
107  }
108 }
109 function copro_show_list()
110 {
111  try
112  {
113  $('listcoprolot').show();
114  $('ajoutcopro').hide();
115  }
116  catch(e)
117  {
118  alert_box(e.message);
119  }
120 
121 }
122 /**
123  * Ajout clef + tantième lot associés
124  */
125 function add_key(dossier,plugin_code,ac)
126 {
127  $('key_list').hide();
128  waiting_box();
129  try
130  {
131  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+'&ac='+ac+"&act=addkey";
132  var action=new Ajax.Request ( 'ajax.php',
133  {
134  method:'get',
135  parameters:queryString,
136  onFailure:null,
137  onSuccess:function (response)
138  {
139  try
140  {
141  remove_waiting_box();
142  $('keydetail_div').innerHTML=response.responseText;
143  $('keydetail_div').show();
144  response.responseText.evalScripts();
145  }
146  catch(e)
147  {
148  alert_box("Réponse Ajax ="+e.message);
149  }
150  }
151  }
152  );
153  }
154  catch(e)
155  {
156  alert_box(e.message);
157  }
158 }
159 /**
160  * Modifie clef + tantième lot associés
161  */
162 function mod_key(dossier,plugin_code,ac,key_id)
163 {
164  $('key_list').hide();
165  waiting_box();
166  try
167  {
168  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&key_id="+key_id+'&ac='+ac+"&act=modkey";
169  var action=new Ajax.Request ( 'ajax.php',
170  {
171  method:'get',
172  parameters:queryString,
173  onFailure:null,
174  onSuccess:function (response)
175  {
176  try
177  {
178  remove_waiting_box();
179  $('keydetail_div').innerHTML=response.responseText;
180  $('keydetail_div').show();
181  response.responseText.evalScripts();
182 
183  }
184  catch(e)
185  {
186  alert_box("Réponse Ajax ="+e.message);
187  }
188  }
189  }
190  );
191  }
192  catch(e)
193  {
194  alert_box(e.message);
195  }
196 }
197 
198 function remove_key(plugin_code,ac,dossier,key_id)
199 {
200  if (! confirm("Vous voulez effacer cette clef ?")) { return;}
201  waiting_box();
202  try
203  {
204  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&key_id="+key_id+'&ac='+ac+"&act=removekey";
205  var action=new Ajax.Request ( 'ajax.php',
206  {
207  method:'get',
208  parameters:queryString,
209  onFailure:null,
210  onSuccess:function (response)
211  {
212  try
213  {
214  remove_waiting_box();
215  $("row"+key_id).style.color="red";
216  $("row"+key_id).style.textDecoration="line-through";
217  $("col"+key_id).innerHTML="";
218 
219  //response.responseText.evalScripts();
220  }
221  catch(e)
222  {
223  alert_box("Réponse Ajax ="+e.message);
224  }
225  }
226  }
227  );
228  }
229  catch(e)
230  {
231  alert_box(e.message);
232  }
233 }
234 function compute_key()
235 {
236  try
237  {
238  str="";
239  var array=$("fkey").getInputs('text');
240  var tot=0;
241  for (i=0;i<array.length;i++)
242  {
243  if ( array[i].name.search(/part/) > -1)
244  {
245  if (! isNaN(array[i].value)) {
246  tot+=parseFloat(array[i].value);
247  }
248  }
249  }
250  $("span_tantieme").innerHTML=Math.round(tot);
251  if ( ! isNaN($('cr_tantieme').value)) {
252  var difference=parseFloat($('cr_tantieme').value)-tot;
253  difference=Math.round(difference*100)/100;
254  if ( difference != 0 ) {
255  $('span_diff').style.backgroundColor="red";
256  } else {
257  $('span_diff').style.backgroundColor="green";
258  }
259  $('span_diff').innerHTML=difference;
260  }
261 
262  }
263  catch(e)
264  {
265  alert_box(e.message);
266  }
267 }
268 
269 function budget_detail(plugin_code,ac,dossier,bud_id)
270 {
271  waiting_box();
272  try
273  {
274  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&bud_id="+bud_id+'&ac='+ac+"&act=buddisplay";
275  var action=new Ajax.Request ( 'ajax.php',
276  {
277  method:'get',
278  parameters:queryString,
279  onFailure:null,
280  onSuccess:function (response)
281  {
282  try
283  {
284  remove_waiting_box();
285  $('divbuddetail').innerHTML=response.responseText;
286  response.responseText.evalScripts();
287  }
288  catch(e)
289  {
290  alert_box("Réponse Ajax ="+e.message);
291  }
292  }
293  }
294  );
295  }
296  catch(e)
297  {
298  alert_box(e.message);
299  }
300 }
301 function compute_budget()
302 {
303  try
304  {
305  str="";
306  var array=$("fbud_update").getInputs('text');
307  var tot=0;
308  for (i=0;i<array.length;i++)
309  {
310  if ( array[i].name.search(/bt_amount/) > -1)
311  {
312  if (! isNaN(array[i].value) && array[i].value!= "") {
313  tot+=parseFloat(array[i].value);
314  }
315  }
316  }
317  $("sbud_total").innerHTML=Math.round(tot*100)/100;
318  if ( ! isNaN($('b_amount').value)) {
319  var difference=parseFloat($('b_amount').value)-tot;
320  difference=Math.round(difference*100)/100;
321  if ( difference != 0 ) {
322  $('span_diff').style.backgroundColor="red";
323  } else {
324  $('span_diff').style.backgroundColor="green";
325  }
326  $('span_diff').innerHTML=difference;
327  }
328 
329  }
330  catch(e)
331  {
332  alert_box(e.message);
333  }
334 }
335 function budget_add(dossier,plugin_code,ac)
336 {
337  waiting_box();
338  try
339  {
340  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&bud_id=0&ac="+ac+"&act=budadd";
341  var action=new Ajax.Request ( 'ajax.php',
342  {
343  method:'get',
344  parameters:queryString,
345  onFailure:null,
346  onSuccess:function (response)
347  {
348  try
349  {
350  remove_waiting_box();
351  $('divbuddetail').innerHTML=response.responseText;
352  response.responseText.evalScripts();
353  }
354  catch(e)
355  {
356  alert_box("Réponse Ajax ="+e.message);
357  }
358  }
359  }
360  );
361  }
362  catch(e)
363  {
364  alert_box(e.message);
365  }
366 }
367 function budget_remove(plugin_code,ac,dossier,bud_id)
368 {
369  if (! confirm("Vous voulez effacer ce budget?")) { return;}
370  waiting_box();
371  try
372  {
373  var queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&bud_id="+bud_id+'&ac='+ac+"&act=removebudget";
374  var action=new Ajax.Request ( 'ajax.php',
375  {
376  method:'get',
377  parameters:queryString,
378  onFailure:null,
379  onSuccess:function (response)
380  {
381  try
382  {
383  remove_waiting_box();
384  $("row"+bud_id).style.color="red";
385  $("row"+bud_id).style.textDecoration="line-through";
386  $("col2"+bud_id).innerHTML="";
387  $("col1"+bud_id).innerHTML="";
388 
389  //response.responseText.evalScripts();
390  }
391  catch(e)
392  {
393  alert_box("Réponse Ajax ="+e.message);
394  }
395  }
396  }
397  );
398  }
399  catch(e)
400  {
401  alert_box(e.message);
402  }
403 }
404 
405 function appel_fond_show()
406 {
407  try
408  {
409  var aft=$('aft');
410  var choice=aft.options[aft.selectedIndex].value;
411  if ( choice == -1 )
412  {
413  $('appel_fond_budget').hide();
414  $('appel_fond_amount').hide();
415  return;
416  }
417  if ( choice == 1 )
418  {
419  $('appel_fond_budget').show();
420  $('appel_fond_amount').hide();
421  return;
422  }
423  if ( choice == 2 )
424  {
425  $('appel_fond_budget').hide();
426  $('appel_fond_amount').show();
427  return;
428  }
429  } catch(e)
430  {
431  alert_box(e.message);
432  }
433 
434 }
function budget_add(dossier, plugin_code, ac)
$note style
function remove_key(plugin_code, ac, dossier, key_id)
function appel_fond_show()
function budget_detail(plugin_code, ac, dossier, bud_id)
$p_year value
function add_coprop()
Ajout un lien entre copropriétaire et lot.
function mod_key(dossier, plugin_code, ac, key_id)
Modifie clef + tantième lot associés.
show($p_code, $p_desc)
function copro_show_list()
$categorie_appel name
function budget_remove(plugin_code, ac, dossier, bud_id)
function mod_coprop(dossier, coprop_id, plugin_code, ac)
Modifier un copropriétaire et les lots qu'il a.
function compute_key()
function add_key(dossier, plugin_code, ac)
Ajout clef + tantième lot associés.
function compute_budget()
function remove_lot(plugin_code, ac, dossier, lot_id)