noalyss Version-9
supplier.class.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// Copyright Author Dany De Bontridder danydb@aevalys.eu
20require_once NOALYSS_INCLUDE.'/constant.php';
21require_once NOALYSS_INCLUDE.'/lib/user_common.php';
22/*! \file
23 * \brief Derived from class fiche Supplier are a specific kind of card
24 */
25/*!
26 * \brief class Supplier are a specific kind of card
27 */
28
29// Use the view vw_supplier
30//
31class Supplier extends Fiche
32{
33
34 var $poste; /*!< $poste poste comptable */
35 var $name; /*!< $name name of the company */
36 var $street; /*!< $street Street */
37 var $country; /*!< $country Country */
38 var $cp; /*!< $cp Zip code */
39 var $vat_number; /*!< $vat_number vat number */
40
41 /*! \brief Constructor
42 /* only a db connection is needed */
43 function __construct($p_cn,$p_id=0)
44 {
45 $this->fiche_def_ref=FICHE_TYPE_FOURNISSEUR;
46 parent::__construct($p_cn,$p_id) ;
47
48 }
49 /*! \brief Get all info contains in the view
50 * thanks to the poste elt (account)
51 */
52 function get_by_account($p_poste=0)
53 {
54 $this->poste=($p_poste==0)?$this->poste:$p_poste;
55 $sql="select * from vw_supplier where poste_comptable=".$this->poste;
56 $Res=$this->cn->exec_sql($sql);
57 if ( Database::num_row($Res) == 0) return null;
58 // There is only _one_ row by supplier
60 $this->name=$row['name'];
61 $this->id=$row['f_id'];
62 $this->street=$row['rue'];
63 $this->cp=$row['code_postal'];
64 $this->country=$row['pays'];
65 $this->vat_number=$row['tva_num'];
66
67 }
68
69
70
71}
72
73?>
$input_from cn
Definition: balance.inc.php:66
$from_poste name
static fetch_array($ret, $p_indice=0, $p_mode=PGSQL_ASSOC)
wrapper for the function pg_fetch_array
static num_row($ret)
wrapper for the function pg_num_rows
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
class Supplier are a specific kind of card
get_by_account($p_poste=0)
Get all info contains in the view thanks to the poste elt (account)
__construct($p_cn, $p_id=0)
Constructor /* only a db connection is needed.
const FICHE_TYPE_FOURNISSEUR
Definition: constant.php:249
$Res