qp_internal=="") throw new Exception(__FILE__.__LINE__." qs_internal est vide"); $sql="select qp_id, qp_internal, qp_fiche, qp_quantite, qp_price, qp_vat, qp_vat_code, tva_rate, tva_label, qp_nd_amount, qp_nd_tva, qp_nd_tva_recup, qp_supplier, j_id, qp_dep_priv, qp_vat_sided from quant_purchase left join tva_rate on (qp_vat_code=tva_id) where qp_internal='".$this->qp_internal."'"; $ret=$this->db->exec_sql($sql); // $res contains all the line $res=Database::fetch_all($ret); if ( sizeof($res)==0) return null; $count=0; foreach ($res as $row) { $t_gestion_purchase=new gestion_purchase($this->db); foreach ($row as $idx=>$value) $t_gestion_purchase->$idx=$value; $array[$count]=clone $t_gestion_purchase; $count++; } return $array; } function search_by_jid($p_jid) { $res=$this->db->exec_sql("select qp_id from quant_purchase where j_id=".$p_jid); if ( Database::num_row($res) == 1) $this->qp_id=Database::fetch_result($res,0,0); else $this->qp_id=0; } function load() { $sql="select qp_id, qp_internal, qp_fiche, qp_quantite, qp_price, qp_vat, qp_vat_code, qp_nd_amount, qp_nd_tva, qp_nd_tva_recup, qp_supplier, j_id, qp_dep_priv, qp_vat_sided from quant_purchase where qp_id=".$this->qp_id; $ret=$this->db->exec_sql($sql); // $res contains all the line $res=Database::fetch_all($ret); if ( empty($res) ) return null; foreach ($res[0] as $idx=>$value) $this->$idx=$value; } }