[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r263 - in trunk/coprop: . include include/template
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r263 - in trunk/coprop: . include include/template |
Date: |
Thu, 5 Jan 2012 23:22:17 +0100 (CET) |
Author: danydb
Date: 2012-01-05 23:22:16 +0100 (Thu, 05 Jan 2012)
New Revision: 263
Modified:
trunk/coprop/coprop-javascript.js
trunk/coprop/include/ajax_add_key.php
trunk/coprop/include/ajax_mod_key.php
trunk/coprop/include/template/key_detail.php
Log:
0000498: CLEF : calculer le total des tanti?\195?\168mes lors de la saisie
Modified: trunk/coprop/coprop-javascript.js
===================================================================
--- trunk/coprop/coprop-javascript.js 2012-01-05 21:07:26 UTC (rev 262)
+++ trunk/coprop/coprop-javascript.js 2012-01-05 22:22:16 UTC (rev 263)
@@ -213,32 +213,33 @@
alert(e.message);
}
}
-function budget_detail(plugin_code,ac,dossier,bud_id)
+function compute_key()
{
- waiting_box();
try
{
- var
queryString="plugin_code="+plugin_code+"&gDossier="+dossier+"&bud_id="+bud_id+'&ac='+ac+"&act=buddisplay";
- var action=new Ajax.Request ( 'ajax.php',
- {
- method:'get',
- parameters:queryString,
- onFailure:null,
- onSuccess:function (response)
+ str="";
+ var array=$("fkey").getInputs('text');
+ var tot=0;
+ for (i=0;i<array.length;i++)
{
- try
+ if ( array[i].name.search(/part/) > -1)
{
- remove_waiting_box();
-
$('divbuddetail').innerHTML=response.responseText;
- response.responseText.evalScripts();
+ if (! isNaN(array[i].value)) {
+ tot+=parseFloat(array[i].value);
+ }
}
- catch(e)
- {
- alert("RĂ©ponse Ajax ="+e.message);
+ }
+ $("span_tantieme").innerHTML=Math.round(tot);
+ if ( ! isNaN($('cr_tantieme').value)) {
+ var difference=parseFloat($('cr_tantieme').value)-tot;
+ if ( difference != 0 ) {
+ $('span_diff').style.color="red";
+ } else {
+ $('span_diff').style.color="green";
}
- }
+ $('span_diff').innerHTML=difference;
}
- );
+
}
catch(e)
{
Modified: trunk/coprop/include/ajax_add_key.php
===================================================================
--- trunk/coprop/include/ajax_add_key.php 2012-01-05 21:07:26 UTC (rev
262)
+++ trunk/coprop/include/ajax_add_key.php 2012-01-05 22:22:16 UTC (rev
263)
@@ -33,14 +33,14 @@
$name=new IText('cr_name');
$name->size=60;
$tantieme=new INum('cr_tantieme');
-$tantieme->javascript='onchange="format_number(this,0);"';
+$tantieme->javascript='onchange="format_number(this,0);compute_key();"';
$tantieme->value=0;
$str_message="Ajout d'une clef de répartition";
$alot=$cn->get_array("select f_id,vw_name as name,quick_code as qcode,
vw_description as desc, 0 as l_part
from vw_fiche_attr where
fd_id=$1",array($g_copro_parameter->categorie_lot));
$init_tantieme=0;
-echo '<form method="post">';
+echo '<form id="fkey" method="post">';
require_once 'template/key_detail.php';
echo HtmlInput::submit("add_key","Ajouter",' onclick="return confirm (\'Vous
confirmez?\')"');
echo '</form>';
Modified: trunk/coprop/include/ajax_mod_key.php
===================================================================
--- trunk/coprop/include/ajax_mod_key.php 2012-01-05 21:07:26 UTC (rev
262)
+++ trunk/coprop/include/ajax_mod_key.php 2012-01-05 22:22:16 UTC (rev
263)
@@ -43,7 +43,7 @@
$name->size=60;
$tantieme=new INum('cr_tantieme');
-$tantieme->javascript='onchange="format_number(this,0);"';
+$tantieme->javascript='onchange="format_number(this,0);compute_key();"';
$tantieme->value=round($key[0]['cr_tantieme']);
$alot=$cn->get_array("select lot_fk as f_id,
@@ -60,11 +60,11 @@
from vw_fiche_attr where fd_id=$2
and f_id not in (select lot_fk from coprop.clef_repartition_detail
where cr_id=$1)",array($key_id,$g_copro_parameter->categorie_lot));
-$init_tantieme=$cn->get_value("select sum(crd_amount) from
+$init_tantieme=$cn->get_value("select sum(crd_amount) from
coprop.clef_repartition_detail
where cr_id=$1",array($key_id));
-echo '<form method="post">';
+echo '<form id="fkey" method="post">';
echo HtmlInput::hidden('cr_id',$key_id);
require_once 'template/key_detail.php';
echo HtmlInput::submit("mod_key","Modifier",' onclick="return confirm (\'Vous
confirmez?\')"');
Modified: trunk/coprop/include/template/key_detail.php
===================================================================
--- trunk/coprop/include/template/key_detail.php 2012-01-05 21:07:26 UTC
(rev 262)
+++ trunk/coprop/include/template/key_detail.php 2012-01-05 22:22:16 UTC
(rev 263)
@@ -68,7 +68,7 @@
<td>
<?
$num=new INum('part'.$alot[$i]['f_id']);
- $num->javascript='onchange="format_number(this,0);"';
+
$num->javascript='onchange="format_number(this,0);compute_key();"';
$num->value=round($alot[$i]['l_part'],0);
echo $num->input();
?>
@@ -97,5 +97,6 @@
<?
endif;
?>
+
</p>
</div>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r263 - in trunk/coprop: . include include/template,
phpcompta-dev <=