noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
class_gestion_sold.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief definition of the class gestion_sold
00024  */
00025 
00026 /*! \brief this object handles the table quant_sold
00027  *
00028  */
00029 
00030 require_once ('class_gestion_table.php');
00031 
00032 
00033 class gestion_sold extends gestion_table
00034 {
00035     var $qs_id;                                         /*!< $qs_id primary key */
00036     var $qs_internal;                           /*!< qs_internal */
00037     var $qs_fiche;                              /*!< f_id code  */
00038     var $qs_quantite;                           /*!< quantity of the card */
00039     var $qs_price;                              /*!< price */
00040     var $qs_vat;                                        /*!< vat_amount */
00041     var $qs_vat_code;                           /*!< vat_code */
00042     var $qs_client;                             /*!< f_id of the customer */
00043     var $qs_valid;                              /*!< will not be used */
00044     var $j_id;                                  /*!< jrnx.j_id */
00045     var $qs_vat_sided;
00046     /*!\brief return an array of gestion_table, the object are
00047      * retrieved thanks the qs_internal
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         // $res contains all the line
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         // $res contains all the line
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 }
 All Data Structures Namespaces Files Functions Variables Enumerations