Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 require_once ('class_gestion_table.php');
00031
00032
00033 class gestion_sold extends gestion_table
00034 {
00035 var $qs_id;
00036 var $qs_internal;
00037 var $qs_fiche;
00038 var $qs_quantite;
00039 var $qs_price;
00040 var $qs_vat;
00041 var $qs_vat_code;
00042 var $qs_client;
00043 var $qs_valid;
00044 var $j_id;
00045 var $qs_vat_sided;
00046
00047
00048
00049 function get_list()
00050 {
00051 if ($this->qs_internal=="")
00052 throw new Exception(__FILE__.__LINE__." qs_internal est vide");
00053 $sql="select qs_id,
00054 qs_internal,
00055 qs_fiche,
00056 qs_quantite,
00057 qs_price,
00058 qs_vat,
00059 tva_label,
00060 tva_rate,
00061 qs_vat_code,
00062 qs_client,
00063 j_id,
00064 qs_vat_sided
00065 from quant_sold left join tva_rate on (qs_vat_code=tva_id)
00066 where qs_internal='".$this->qs_internal."'";
00067 $ret=$this->db->exec_sql($sql);
00068
00069 $res=Database::fetch_all($ret);
00070
00071 if ( sizeof($res)==0) return null;
00072 $count=0;
00073
00074 foreach ($res as $row)
00075 {
00076 $t_gestion_sold=new gestion_sold($this->db);
00077 foreach ($row as $idx=>$value)
00078 $t_gestion_sold->$idx=$value;
00079 $array[$count]=clone $t_gestion_sold;
00080 $count++;
00081 }
00082 return $array;
00083 }
00084 function search_by_jid($p_jid)
00085 {
00086 $res=$this->db->exec_sql("select qs_id from quant_sold where j_id=".$p_jid);
00087
00088 if ( Database::num_row($res) == 1)
00089 $this->qs_id=Database::fetch_result($res,0,0);
00090 else
00091 $this->qs_id=0;
00092 }
00093 function load()
00094 {
00095 $sql=" select qs_id,
00096 qs_internal,
00097 qs_fiche,
00098 qs_quantite,
00099 qs_price,
00100 qs_vat,
00101 qs_vat_code,
00102 qs_client,
00103 j_id,
00104 qs_vat_sided
00105 from quant_sold
00106 where qs_id=$1";
00107 $ret=$this->db->exec_sql($sql,array($this->qs_id));
00108
00109 $res=Database::fetch_all($ret);
00110
00111 if ( empty($res) ) return null;
00112 foreach ($res[0] as $idx=>$value)
00113 $this->$idx=$value;
00114 }
00115 }