noalyss  Version-6.9.1.8
 All Data Structures Namespaces Files Functions Variables Pages
class_gestion_sold.php
Go to the documentation of this file.
1 <?php
2 /*
3  * This file is part of NOALYSS.
4  *
5  * NOALYSS is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * NOALYSS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with NOALYSS; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 // Copyright Author Dany De Bontridder danydb@aevalys.eu
21 
22 /*!\file
23  * \brief definition of the class gestion_sold
24  */
25 
26 /*! \brief this object handles the table quant_sold
27  *
28  */
29 
30 require_once NOALYSS_INCLUDE.'/class/class_gestion_table.php';
31 
32 
34 {
35  var $qs_id; /*!< $qs_id primary key */
36  var $qs_internal; /*!< qs_internal */
37  var $qs_fiche; /*!< f_id code */
38  var $qs_quantite; /*!< quantity of the card */
39  var $qs_price; /*!< price */
40  var $qs_vat; /*!< vat_amount */
41  var $qs_vat_code; /*!< vat_code */
42  var $qs_client; /*!< f_id of the customer */
43  var $qs_valid; /*!< will not be used */
44  var $j_id; /*!< jrnx.j_id */
46  /*!\brief return an array of gestion_table, the object are
47  * retrieved thanks the qs_internal
48  */
49  function get_list()
50  {
51  if ($this->qs_internal=="")
52  throw new Exception(__FILE__.__LINE__." qs_internal est vide");
53  $sql="select qs_id,
54  qs_internal,
55  qs_fiche,
56  qs_quantite,
57  qs_price,
58  qs_vat,
59  tva_label,
60  tva_rate,
61  qs_vat_code,
62  qs_client,
63  j_id,
64  qs_vat_sided
65  from quant_sold left join tva_rate on (qs_vat_code=tva_id)
66  where qs_internal='".$this->qs_internal."'";
67  $ret=$this->db->exec_sql($sql);
68  // $res contains all the line
70 
71  if ( sizeof($res)==0) return null;
72  $count=0;
73 
74  foreach ($res as $row)
75  {
76  $t_gestion_sold=new gestion_sold($this->db);
77  foreach ($row as $idx=>$value)
78  $t_gestion_sold->$idx=$value;
79  $array[$count]=clone $t_gestion_sold;
80  $count++;
81  }
82  return $array;
83  }
84  function search_by_jid($p_jid)
85  {
86  $res=$this->db->exec_sql("select qs_id from quant_sold where j_id=".$p_jid);
87 
88  if ( Database::num_row($res) == 1)
89  $this->qs_id=Database::fetch_result($res,0,0);
90  else
91  $this->qs_id=0;
92  }
93  function load()
94  {
95  $sql=" select qs_id,
96  qs_internal,
97  qs_fiche,
98  qs_quantite,
99  qs_price,
100  qs_vat,
101  qs_vat_code,
102  qs_client,
103  j_id,
104  qs_vat_sided
105  from quant_sold
106  where qs_id=$1";
107  $ret=$this->db->exec_sql($sql,array($this->qs_id));
108  // $res contains all the line
110 
111  if ( empty($res) ) return null;
112  foreach ($res[0] as $idx=>$value)
113  $this->$idx=$value;
114  }
115 }
static fetch_all($ret)
wrapper for the function pg_fetch_all
mother class for gestion
static num_row($ret)
wrapper for the function pg_NumRows
$value
$idx
function clone(object)
get_list()
return an array of gestion_table, the object are retrieved thanks the qs_internal ...
static fetch_result($ret, $p_row=0, $p_col=0)
wrapper for the function pg_fetch_all
$count
Definition: modele.inc.php:255
$SecUser db
this object handles the table quant_sold