noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
Follow_Up_Detail Class Reference

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. More...

+ Collaboration diagram for Follow_Up_Detail:

Public Member Functions

 __construct ($p_cn, $p_id=0)
 
 delete ()
 
 from_array ($array, $idx)
 Fill an Action_Detail Object with the data contained in an array.
 
 get_info ()
 
 get_parameter ($p_string)
 
 insert ()
 
 load ()
 load the todo_list row thanks it's ID
 
 load_all ()
 retrieve all the details of an Follow_Up
 
 save ()
 
 set_parameter ($p_string, $p_value)
 
 update ()
 
 verify ()
 

Static Public Member Functions

static display (Follow_Up $p_follow_up, $p_view)
 

Data Fields

 $ad_id
 
 $ag_id
 
 $db
 

Static Private Attributes

static $variable
 

Detailed Description

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.

  • "id"=>"ad_id", primary key
  • "qcode"=>"f_id", quick_code
  • "text"=>"ad_text", description lines
  • "price_unit"=>"ad_pu", price by unit
  • "quantity"=>"ad_quant", quantity
  • "tva_id"=>"ad_tva_id", tva_od
  • "tva_amount"=>"ad_tva_amount", vat amount
  • "total"=>"ad_total_amount", total amount including vat
  • "ag_id"=>"ag_id" => foreign key to action_gestion
  • db is the database connection

Definition at line 41 of file follow_up_detail.class.php.

Constructor & Destructor Documentation

◆ __construct()

Follow_Up_Detail::__construct ( $p_cn,
$p_id = 0 )

Definition at line 55 of file follow_up_detail.class.php.

56 {
57 $this->db=$p_cn;
58 $this->ad_id=$p_id;
59 }
$SecUser db

References $p_id, and db.

Member Function Documentation

◆ delete()

Follow_Up_Detail::delete ( )

Definition at line 192 of file follow_up_detail.class.php.

193 {
194 $sql="delete from action_detail where ad_id=$1";
195 $this->db->exec_sql($sql,array($this->ad_id));
196 }

References $sql, and db.

◆ display()

static Follow_Up_Detail::display ( Follow_Up $p_follow_up,
$p_view )
static

Definition at line 241 of file follow_up_detail.class.php.

242 {
243 $option=$p_follow_up->db->get_value("select do_option from document_option "
244 . " where document_type_id=$1 and do_code='detail_operation'",[$p_follow_up->dt_id]);
245
246 require NOALYSS_TEMPLATE."/follow_up_detail_display.php";
247 }

◆ from_array()

Follow_Up_Detail::from_array ( $array,
$idx )

Fill an Action_Detail Object with the data contained in an array.

Parameters
$array
  • [ad_id7] => ad_id
  • [e_march7] => f_id
  • [e_march7_label] => ad_text
  • [e_march7_price] => ad_pu
  • [e_quant7] => ad_quant
  • [e_march7_tva_id] => ad_tva_id
  • [e_march7_tva_amount] => ad_tva_amount
  • [tvac_march7] => ad_total_amount
  • [ag_id] => ag_id
$idxis the idx (example 7)
Note

Definition at line 210 of file follow_up_detail.class.php.

211 {
212 $row=$array;
213 $this->ad_id=(isset($row['ad_id'.$idx]))?$row['ad_id'.$idx]:0;
214
215 $qcode=(isset($row['e_march'.$idx]))?$row['e_march'.$idx]:"";
216 if (trim($qcode)=='')
217 {
218 $this->f_id=0;
219 }
220 else
221 {
222 $tmp=new Fiche($this->db);
223 $tmp->get_by_qcode($qcode,false);
224 $this->f_id=$tmp->id;
225 }
226 $this->ad_text=(isset($row['e_march'.$idx.'_label']))?$row['e_march'.$idx.'_label']:"";
227 $this->ad_pu=(isset($row['e_march'.$idx.'_price']))?$row['e_march'.$idx.'_price']:0;
228 $this->ad_quant=(isset($row['e_quant'.$idx]))?$row['e_quant'.$idx]:0;
229 $this->ad_tva_id=(isset($row['e_march'.$idx.'_tva_id']))?$row['e_march'.$idx.'_tva_id']:0;
230 $this->ad_tva_amount=(isset($row['e_march'.$idx.'_tva_amount']))?$row['e_march'.$idx.'_tva_amount']:0;
231 $this->ad_total_amount=(isset($row['tvac_march'.$idx]))?$row['tvac_march'.$idx]:0;
232 $this->ag_id=(isset($array['ag_id']))?$array['ag_id']:0;
233 /* protect numeric */
234 if (trim($this->ad_pu)=="" || isNumber($this->ad_pu)==0) $this->ad_pu=0;
235 if (trim($this->ad_quant)=="" || isNumber($this->ad_quant)==0) $this->ad_quant=0;
236 if (trim($this->ad_tva_amount)==""||isNumber($this->ad_tva_amount)==0) $this->ad_tva_amount=0;
237 if (trim($this->ad_total_amount)==""||isNumber($this->ad_total_amount)==0) $this->ad_total_amount=0;
238 if (trim($this->ad_tva_id)=="" || isNumber($this->ad_tva_id)==0) $this->ad_tva_id=0;
239 }
isNumber($p_int)

References $array, $idx, $qcode, $row, $tmp, ag_id, db, and isNumber().

+ Here is the call graph for this function:

◆ get_info()

Follow_Up_Detail::get_info ( )

Definition at line 82 of file follow_up_detail.class.php.

83 {
84 return var_export(self::$variable,true);
85 }

◆ get_parameter()

Follow_Up_Detail::get_parameter ( $p_string)

Definition at line 60 of file follow_up_detail.class.php.

61 {
62 if ( array_key_exists($p_string,self::$variable) )
63 {
64 $idx=self::$variable[$p_string];
65 return $this->$idx;
66 }
67 else
68 throw new Exception("Attribut inexistant $p_string");
69 }

References $idx.

◆ insert()

Follow_Up_Detail::insert ( )

Definition at line 99 of file follow_up_detail.class.php.

100 {
101 if ( $this->verify() != 0 ) return;
102 $sql='INSERT INTO action_detail('.
103 ' f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,'.
104 ' ad_total_amount, ag_id)'.
105 ' VALUES ($1, $2, $3, $4,$5,$6,$7,$8) returning ad_id';
106 $this->ad_id=$this->db->get_value($sql,array(
107 $this->f_id,
108 $this->ad_text,
109 $this->ad_pu,
110 $this->ad_quant,
111 $this->ad_tva_id,
112 $this->ad_tva_amount,
113 $this->ad_total_amount,
114 $this->ag_id
115 )
116 );
117
118 }

References $sql, ag_id, db, and verify().

Referenced by save().

+ Here is the call graph for this function:

◆ load()

Follow_Up_Detail::load ( )

load the todo_list row thanks it's ID

Returns
boolean true if found else false

Definition at line 174 of file follow_up_detail.class.php.

174 :bool
175 {
176 $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
177 ad_total_amount, ag_id FROM action_detail".
178 " where ad_id=$1";
179
180 $res=$this->db->get_array(
181 $sql,
182 array($this->ad_id)
183 );
184 if ( $this->db->count() == 0 ) return false;
185 $row=$res[0];
186 foreach (self::$variable as $idx)
187 {
188 $this->$idx=$row[$idx];
189 }
190 return true;
191 }

References $idx, $res, $row, $sql, and db.

◆ load_all()

Follow_Up_Detail::load_all ( )

retrieve all the details of an Follow_Up

Returns
array of Action_Detail
See also
Follow_Up\get

Definition at line 147 of file follow_up_detail.class.php.

148 {
149 $sql="SELECT ad_id, f_id, ad_text, ad_pu, ad_quant, ad_tva_id, ad_tva_amount,
150 ad_total_amount, ag_id FROM action_detail ".
151 " where ag_id=$1 order by ad_id";
152 $res=$this->db->get_array(
153 $sql,
154 array($this->ag_id)
155 );
156 if ( $this->db->count() == 0 ) return array();
157 $aRet=array();
158 for($i=0;$i<count($res);$i++)
159 {
160 $a=new Follow_Up_Detail($this->db);
161 $row=$res[$i];
162 foreach ($row as $idx=>$value)
163 {
164 $a->$idx=$value;
165 }
166 $aRet[$i]=clone $a;
167 }
168 return $aRet;
169 }

References $a, $i, $idx, $res, $row, $sql, $value, ag_id, and db.

◆ save()

Follow_Up_Detail::save ( )

Definition at line 91 of file follow_up_detail.class.php.

92 {
93 if ( $this->ad_id == 0 )
94 $this->insert();
95 else
96 $this->update();
97 }

References insert(), and update().

+ Here is the call graph for this function:

◆ set_parameter()

Follow_Up_Detail::set_parameter ( $p_string,
$p_value )

Definition at line 70 of file follow_up_detail.class.php.

71 {
72 if ( array_key_exists($p_string,self::$variable) )
73 {
74 $idx=self::$variable[$p_string];
75 $this->$idx=$p_value;
76 }
77 else
78 throw new Exception("Attribut inexistant $p_string");
79
80
81 }

References $idx.

◆ update()

Follow_Up_Detail::update ( )

Definition at line 120 of file follow_up_detail.class.php.

121 {
122 if ( $this->verify() != 0 ) return;
123
124 $sql='UPDATE action_detail '.
125 ' SET f_id=$1, ad_text=$2, ad_pu=$3, ad_quant=$4, ad_tva_id=$5,'.
126 ' ad_tva_amount=$6, ad_total_amount=$7, ag_id=$8'.
127 ' WHERE ad_id=$9';
128 $this->id=$this->db->exec_sql($sql,array(
129 $this->f_id,
130 $this->ad_text,
131 $this->ad_pu,
132 $this->ad_quant,
133 $this->ad_tva_id,
134 $this->ad_tva_amount,
135 $this->ad_total_amount,
136 $this->ag_id,
137 $this->ad_id
138 )
139 );
140
141
142 }

References $sql, ag_id, db, and verify().

Referenced by save().

+ Here is the call graph for this function:

◆ verify()

Follow_Up_Detail::verify ( )

Definition at line 86 of file follow_up_detail.class.php.

87 {
88 // Verify that the elt we want to add is correct
89 return 0;
90 }

Referenced by insert(), and update().

Field Documentation

◆ $ad_id

Follow_Up_Detail::$ad_id

Definition at line 54 of file follow_up_detail.class.php.

◆ $ag_id

Follow_Up_Detail::$ag_id

Definition at line 54 of file follow_up_detail.class.php.

◆ $db

Follow_Up_Detail::$db

Definition at line 54 of file follow_up_detail.class.php.

◆ $variable

Follow_Up_Detail::$variable
staticprivate
Initial value:
=array(
"id"=>"ad_id",
"qcode"=>"f_id",
"text"=>"ad_text",
"price_unit"=>"ad_pu",
"quantity"=>"ad_quant",
"tva_id"=>"ad_tva_id",
"tva_amount"=>"ad_tva_amount",
"total"=>"ad_total_amount",
"ag_id"=>"ag_id"
)

Definition at line 43 of file follow_up_detail.class.php.


The documentation for this class was generated from the following file: