From 9c76f276e4c68d45339e2f6efb5b3a8a75c22bb8 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Tue, 13 Apr 2004 12:37:05 +0000 Subject: [PATCH] Set filter for ODS and problem of rounded amount --- include/form_input.php | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/include/form_input.php b/include/form_input.php index eb75a37da..7bc79ab48 100644 --- a/include/form_input.php +++ b/include/form_input.php @@ -156,6 +156,8 @@ function InputType($p_label,$p_type,$p_name,$p_value,$p_viewonly=false,$p_list=n // input type == js_search_poste => button search for the account if ( strtolower($p_type)=="js_search_poste") { $l_sessid=(isset ($_POST['PHPSESSID']))?$_POST['PHPSESSID']:$_GET['PHPSESSID']; + + if ( $p_list == null ) { // no filter $r=sprintf(' %s @@ -169,9 +171,25 @@ function InputType($p_label,$p_type,$p_name,$p_value,$p_viewonly=false,$p_list=n $p_value ); - + } else { // $p_list is not null, so we have a filter + $r=sprintf(' + + %s + + + ', + $l_sessid, + $p_name, + $p_list, + $p_label, + $p_name, + $p_value + ); + + } } + // input type == js_tva if ( strtolower($p_type)=="js_tva") { if ( strlen(trim($p_label)) != 0 ) @@ -1454,7 +1472,16 @@ function FormODS($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p ${"e_account$i"."_amount"}=0; } // code - $r.=''.InputType("","js_search_poste","e_account".$i,$account,$view_only); + // Do we need a filter ? + $l_line=GetJrnProperty($p_cn,$p_jrn); + if( strlen(trim ($l_line['jrn_def_class_cred']) ) > 0 or + strlen(trim ($l_line['jrn_def_class_deb']) ) > 0 ) { + $filter=1; + } + else + $filter=null; + + $r.=''.InputType("","js_search_poste","e_account".$i,$account,$view_only,$filter); //libelle $r.=" $lib "; //amount @@ -1484,8 +1511,10 @@ function FormODS($p_cn,$p_jrn,$p_user,$p_submit,$p_array=null,$view_only=true,$p // $r.=""; $r.=""; //TODO if view only show total - if ( $sum_deb != $sum_cred and $view_only==true) { - $msg=sprintf("Montant non correspondant credit = %.2f debit = %.2f diff = %.2f", + $tmp= abs($sum_deb-$sum_cred); + echo_debug("Diff = ".$tmp); + if ( abs($sum_deb-$sum_cred) > 0.0001 and $view_only==true) { + $msg=sprintf("Montant non correspondant credit = %.5f debit = %.5f diff = %.5f", $sum_cred,$sum_deb,$sum_cred-$sum_deb); echo ""; return null;