diff --git a/html/bud_ajax.php b/html/bud_ajax.php index ca2c57606..940179eac 100644 --- a/html/bud_ajax.php +++ b/html/bud_ajax.php @@ -53,7 +53,7 @@ if ( $_POST['action'] == 'save' ) { $obj=new Bud_Data($cn); $obj->get_from_array($a); - + $obj->verify(); if ( $bd_id == 0 ) { $obj->add(); } else { diff --git a/html/js/bud_script.js b/html/js/bud_script.js index b95f60c55..e5466f496 100644 --- a/html/js/bud_script.js +++ b/html/js/bud_script.js @@ -112,4 +112,21 @@ function bud_action(p_query,p_ctl) { } ); +} + +function bud_compute_sum(p_ctl) { + var form=$('form_'+p_ctl); + var elt=form.getElements(); + var sum=0; + for (i=0; iIOValue(); } echo $button_other; - +//echo http://localhost/phpcompta-dev/phpcompta/html/budget.php?gDossier=21&bh_id=3&recherche=recherche&p_action=detail// +if ( isset ($_GET['po_id'] ) ) + $str_po_id="&po_id=".$_REQUEST['po_id']; + else + $str_po_id=""; +echo widget::button_href("Recharger","?".dossier::get()."&bh_id=".$_GET['bh_id']."&p_action=detail".$str_po_id); echo '
'; //---------------------------------------------------------------------- diff --git a/include/class_bud_data.php b/include/class_bud_data.php index eac192eaf..5b749c676 100644 --- a/include/class_bud_data.php +++ b/include/class_bud_data.php @@ -195,6 +195,8 @@ class Bud_Data { $wAccount->table=0; $wAccount->disabled=true; $wAccount->value=$this->pcm_val.' - '.$this->pcm_lib; + $wAccount->extra=$this->pcm_val; + $wBudCard=new widget('select'); $wBudCard->value=$this->load_bud_card(); $wBudCard->selected=$this->bc_id; @@ -214,14 +216,15 @@ class Bud_Data { $r.="Compte d'exploitation ".$wAccount->IOValue('account_'.$p_number); // $r.=widget::hidden('account_'.$p_number.'_hidden',$this->pcm_val); $r.="Fiche Budget ".$wBudCard->IOValue('bc_id'.$p_number); - $r.='Total : '.$tot.' '; + $r.='Total : '.$tot.' '; $r.=''; $r.=$this->header_table(); $r.=" "; foreach ($this->amount as $p_id=>$amount){ + $wAmount->javascript="onChange='bud_compute_sum(".$p_number.");'"; echo_debug(__FILE__.':'.__LINE__,' p_id '.$p_id.' - amount '.$amount); $tot+=$amount; - $r.='"; + $r.='"; } $r.=""; $r.="
'.$wAmount->IOValue('amount_'.$p_id,sprintf("%08.2f",$amount))."'.$wAmount->IOValue('amount_'.$p_id,sprintf("% 8.2f",$amount))."
"; @@ -344,6 +347,14 @@ class Bud_Data { } } + /*!\brief verify that all the amount are numeric */ + function verify() { + foreach ($this->bud_detail_periode as $obj) { + if ( isNumber($obj->bdp_amount) == 0 ) { + $obj->bdp_amount=0; + } + } + } /*!\brief delete in bud_detail */ diff --git a/include/class_widget.php b/include/class_widget.php index 0c0a9844c..21f8f4f2b 100644 --- a/include/class_widget.php +++ b/include/class_widget.php @@ -588,7 +588,7 @@ class widget { $r.=''; - $r.=''; + $r.=''; return $r; }