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