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 require_once ('class_gestion_table.php');
00030
00031
00032 class gestion_purchase extends gestion_table
00033 {
00034 var $qp_id;
00035 var $qp_internal;
00036 var $qp_fiche;
00037 var $qp_quantite;
00038 var $qp_price;
00039 var $qp_vat;
00040 var $qp_vat_code;
00041 var $qp_nd_amount;
00042 var $qp_nd_tva;
00043 var $qp_nd_tva_recup;
00044 var $qp_supplier;
00045 var $qp_valid;
00046 var $j_id;
00047
00048 var $qp_dep_priv;
00049 var $qp_vat_sided;
00050
00051
00052
00053 function get_list()
00054 {
00055 if ($this->qp_internal=="")
00056 throw new Exception(__FILE__.__LINE__." qs_internal est vide");
00057 $sql="select qp_id,
00058 qp_internal,
00059 qp_fiche,
00060 qp_quantite,
00061 qp_price,
00062 qp_vat,
00063 qp_vat_code,
00064 tva_rate,
00065 tva_label,
00066 qp_nd_amount,
00067 qp_nd_tva,
00068 qp_nd_tva_recup,
00069 qp_supplier,
00070 j_id,
00071 qp_dep_priv,
00072 qp_vat_sided
00073 from quant_purchase left join tva_rate on (qp_vat_code=tva_id)
00074 where qp_internal='".$this->qp_internal."'";
00075 $ret=$this->db->exec_sql($sql);
00076
00077 $res=Database::fetch_all($ret);
00078
00079 if ( sizeof($res)==0) return null;
00080 $count=0;
00081 foreach ($res as $row)
00082 {
00083 $t_gestion_purchase=new gestion_purchase($this->db);
00084 foreach ($row as $idx=>$value)
00085 $t_gestion_purchase->$idx=$value;
00086 $array[$count]=clone $t_gestion_purchase;
00087 $count++;
00088 }
00089 return $array;
00090 }
00091 function search_by_jid($p_jid)
00092 {
00093 $res=$this->db->exec_sql("select qp_id from quant_purchase where j_id=".$p_jid);
00094
00095 if ( Database::num_row($res) == 1)
00096 $this->qp_id=Database::fetch_result($res,0,0);
00097 else
00098 $this->qp_id=0;
00099 }
00100 function load()
00101 {
00102 $sql="select qp_id,
00103 qp_internal,
00104 qp_fiche,
00105 qp_quantite,
00106 qp_price,
00107 qp_vat,
00108 qp_vat_code,
00109 qp_nd_amount,
00110 qp_nd_tva,
00111 qp_nd_tva_recup,
00112 qp_supplier,
00113 j_id,
00114 qp_dep_priv,
00115 qp_vat_sided
00116 from quant_purchase
00117 where qp_id=".$this->qp_id;
00118 $ret=$this->db->exec_sql($sql);
00119
00120 $res=Database::fetch_all($ret);
00121
00122 if ( empty($res) ) return null;
00123 foreach ($res[0] as $idx=>$value)
00124 $this->$idx=$value;
00125
00126 }
00127
00128 }