19 require_once NOALYSS_INCLUDE.
'/class/class_fiche.php';
20 require_once NOALYSS_INCLUDE.
'/lib/class_database.php';
47 "price_unit"=>
"ad_pu",
48 "quantity"=>
"ad_quant",
49 "tva_id"=>
"ad_tva_id",
50 "tva_amount"=>
"ad_tva_amount",
51 "total"=>
"ad_total_amount",
61 if ( array_key_exists($p_string,self::$variable) )
63 $idx=self::$variable[$p_string];
67 throw new Exception(
"Attribut inexistant $p_string");
71 if ( array_key_exists($p_string,self::$variable) )
73 $idx=self::$variable[$p_string];
77 throw new Exception(
"Attribut inexistant $p_string");
83 return var_export(self::$variable,
true);
92 if ( $this->ad_id == 0 )
100 if ( $this->
verify() != 0 )
return;
101 $sql=
'INSERT INTO action_detail('.
102 ' f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,'.
103 ' ad_total_amount, ag_id)'.
104 ' VALUES ($1, $2, $3, $4,$5,$6,$7,$8) returning ad_id';
105 $this->ad_id=$this->
db->get_value(
$sql,array(
111 $this->ad_tva_amount,
112 $this->ad_total_amount,
121 if ( $this->
verify() != 0 )
return;
123 $sql=
'UPDATE action_detail '.
124 ' SET f_id=$1, ad_text=$2, ad_pu=$3, ad_quant=$4, ad_tva_id=$5,'.
125 ' ad_tva_amount=$6, ad_total_amount=$7, ag_id=$8'.
127 $this->
id=$this->
db->exec_sql(
$sql,array(
133 $this->ad_tva_amount,
134 $this->ad_total_amount,
148 $sql=
"SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
149 ad_total_amount, ag_id FROM action_detail ".
150 " where ag_id=$1 order by ad_id";
151 $res=$this->
db->get_array(
155 if ( $this->
db->count() == 0 )
return;
157 for($i=0;$i<count(
$res);$i++)
172 $sql=
"SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
173 ad_total_amount, ag_id FROM action_detail".
176 $res=$this->
db->get_array($this->
db,
180 if ( $this->
db->count() == 0 )
return;
188 public function delete()
190 $sql=
"delete from action_detail where ad_id=$1";
191 $this->
db->exec_sql(
$sql,array($this->ad_id));
209 $this->ad_id=(isset(
$row[
'ad_id'.
$idx]))?
$row[
'ad_id'.$idx]:0;
220 $this->f_id=
$tmp->id;
222 $this->ad_text=(isset(
$row[
'e_march'.$idx.
'_label']))?
$row[
'e_march'.$idx.
'_label']:
"";
223 $this->ad_pu=(isset(
$row[
'e_march'.$idx.
'_price']))?
$row[
'e_march'.$idx.
'_price']:0;
224 $this->ad_quant=(isset(
$row[
'e_quant'.$idx]))?
$row[
'e_quant'.$idx]:0;
225 $this->ad_tva_id=(isset(
$row[
'e_march'.$idx.
'_tva_id']))?
$row[
'e_march'.$idx.
'_tva_id']:0;
226 $this->ad_tva_amount=(isset(
$row[
'e_march'.$idx.
'_tva_amount']))?
$row[
'e_march'.$idx.
'_tva_amount']:0;
227 $this->ad_total_amount=(isset(
$row[
'tvac_march'.$idx]))?
$row[
'tvac_march'.$idx]:0;
230 if (
trim($this->ad_pu)==
"" ||
isNumber($this->ad_pu)==0) $this->ad_pu=0;
231 if (
trim($this->ad_quant)==
"" ||
isNumber($this->ad_quant)==0) $this->ad_quant=0;
232 if (
trim($this->ad_tva_amount)==
""||
isNumber($this->ad_tva_amount)==0) $this->ad_tva_amount=0;
233 if (
trim($this->ad_total_amount)==
""||
isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
234 if (
trim($this->ad_tva_id)==
"" ||
isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
load_all()
retrieve all the details of an Follow_Up
Follow_Up Details are the details for an actions, it means the details of an order, delivery order, submit a quote... this class is linked to the table action_detail.
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
set_parameter($p_string, $p_value)
function trim(s)
remove trailing and heading space
__construct($p_cn, $p_id=0)
from_array($array, $idx)
Fill an Action_Detail Object with the data contained in an array.