29 require_once NOALYSS_INCLUDE.
'/lib/class_database.php';
30 require_once NOALYSS_INCLUDE.
'/lib/ac_common.php';
40 protected $variable=array(
"ad_id"=>
"ad_id",
"ad_percentage"=>
"ad_percentage"
42 ,
"ad_amount"=>
"ad_amount"
53 foreach ($this->variable as
$key=>$value) $this->$value=
'';
65 if ( array_key_exists($p_string,$this->variable) )
67 $idx=$this->variable[$p_string];
71 throw new Exception (__FILE__.
":".__LINE__.$p_string.
'Erreur attribut inexistant');
75 if ( array_key_exists($p_string,$this->variable) )
77 $idx=$this->variable[$p_string];
81 throw new Exception (__FILE__.
":".__LINE__.$p_string.
'Erreur attribut inexistant');
85 return var_export($this,
true);
91 if ( settype($this->ad_percentage,
'float') ==
false )
92 throw new Exception(
'DATATYPE ad_percentage $this->ad_percentage non numerique');
93 if ( settype($this->ad_year,
'float') ==
false )
94 throw new Exception(
'DATATYPE ad_year $this->ad_year non numerique');
95 if ( settype($this->ad_amount,
'float') ==
false )
96 throw new Exception(
'DATATYPE ad_amount $this->ad_amount non numerique');
97 if ( settype($this->
a_id,
'float') ==
false )
98 throw new Exception(
'DATATYPE a_id $this->a_id non numerique');
105 if ( $this->ad_id == -1 )
118 public function seek($cond=
'',$p_array=null)
120 $sql=
"select * from amortissement.amortissement_detail $cond";
124 $size=$this->cn->count();
125 if ( $size == 0 )
return $aobj;
126 for ($i=0; $i<$size; $i++)
129 foreach (
$array[$i] as $idx=>$value)
139 if ( $this->
verify() != 0 )
return;
140 if ( $this->ad_id==-1 )
143 $sql=
"insert into amortissement.amortissement_detail(ad_percentage
153 $this->ad_id=$this->cn->get_value(
155 array( $this->ad_percentage
164 $sql=
"insert into amortissement.amortissement_detail(ad_percentage
175 $this->ad_id=$this->cn->get_value(
177 array( $this->ad_percentage
190 if ( $this->
verify() != 0 )
return;
192 $sql=
" update amortissement.amortissement_detail set ad_percentage = $1
197 $res=$this->cn->exec_sql(
199 array($this->ad_percentage
214 $sql=
"select ad_percentage
218 from amortissement.amortissement_detail where ad_id=$1";
220 $res=$this->cn->get_array(
225 if ( count(
$res) == 0 )
228 foreach ($this->variable as
$key=>$value) $this->
$key=
'';
232 foreach (
$res[0] as $idx=>$value)
239 public function delete()
241 $sql=
"delete from amortissement.amortissement_detail where ad_id=$1";
242 $res=$this->cn->exec_sql(
$sql,array($this->ad_id));
Manage the table amortissement.amortissement_detail.
if(isset($_POST['remove'])) $array
__construct(&$p_cn, $p_id=-1)
seek($cond='', $p_array=null)
retrieve array of object thanks a condition
if($p_number->value==0) l les annuités seront recalculées et l pct[] ad_year[] select h_amount from amortissement amortissement_histo where a_id
set_parameter($p_string, $p_value)
static test_me()
Unit test for the class.