From ca0b1fb526f15b26f9c8c258ee090d135725b70a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 10 Apr 2004 19:48:28 +0000 Subject: [PATCH] bug 8531 - improve saldo present --- include/form_input.php | 19 +++++++++++++++---- include/user_action_fin.php | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/form_input.php b/include/form_input.php index d4da11ea6..269e2cedc 100644 --- a/include/form_input.php +++ b/include/form_input.php @@ -1099,7 +1099,7 @@ function RecordAchat($p_cn,$p_array,$p_user,$p_jrn) * - * return: string with the form */ -function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p_item=4) +function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p_item=4,$p_save=false) { include_once("poste.php"); if ( $p_array != null ) { @@ -1237,7 +1237,10 @@ function FormFin($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p ${"e_concerned".$i}=(isset(${"e_concerned".$i}))?${"e_concerned".$i}:""; $r.=InputType("","js_concerned","e_concerned".$i,${"e_concerned".$i},$view_only); $r.=''; - if ( $view_only == true ) $new_solde+=$tiers_amount; + // if not recorded the new amount must be recalculate + // if recorded the old amount is recalculated + if ( $view_only == true) + $new_solde=($p_save==false)?$new_solde+$tiers_amount:$new_solde-$tiers_amount; } $r.=""; @@ -1248,8 +1251,16 @@ $r.=""; // if view_only is true //Put the new saldo here (old saldo - operation) if ( $view_only==true) { - $r.=" Ancien Solde = ".$solde."
"; - $r.=" Nouveau Solde = ".$new_solde."
"; + // if not recorded the new amount must be recalculate + if ( $p_save == false) { + $r.=" Ancien Solde = ".$solde."
"; + $r.=" Nouveau Solde = ".$new_solde."
"; + } + // if recorded the old amount is recalculated + if ($p_save == true ) { + $r.=" Ancien Solde = ".$new_solde."
"; + $r.=" Nouveau Solde = ".$solde."
"; + } } return $r; diff --git a/include/user_action_fin.php b/include/user_action_fin.php index aa7003b6b..d6050b6ef 100644 --- a/include/user_action_fin.php +++ b/include/user_action_fin.php @@ -111,7 +111,7 @@ if ( $action == 'new' ) { // submit button in the form $submit='

Recorded

'; - $r.=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true, $nb_number); + $r.=FormFin($cn,$g_jrn,$g_user,$submit,$HTTP_POST_VARS,true, $nb_number,true); echo '
'; echo $r; echo "
";