noalyss Version-10
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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///@brief Use the view vw_supplier and the trait Trait_Card
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 use Trait_Card;
42
43
44 /*! \brief Constructor
45 * only a db connection is needed */
46 function __construct($p_cn,$p_id=0)
47 {
48 $this->fiche_def_ref=FICHE_TYPE_FOURNISSEUR;
49 parent::__construct($p_cn,$p_id) ;
50
51 }
52 /*! \brief Get all info contains in the view
53 * thanks to the poste elt (account)
54 */
55 function get_by_account($p_poste=0)
56 {
57 $this->poste=($p_poste==0)?$this->poste:$p_poste;
58 $sql="select * from vw_supplier where poste_comptable=".$this->poste;
59 $Res=$this->cn->exec_sql($sql);
60 if ( Database::num_row($Res) == 0) return null;
61 // There is only _one_ row by supplier
63 $this->name=$row['name'];
64 $this->id=$row['f_id'];
65 $this->street=$row['rue'];
66 $this->cp=$row['code_postal'];
67 $this->country=$row['pays'];
68 $this->vat_number=$row['tva_num'];
69
70 }
71
72
73
74}
75
76?>
$input_from cn
$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...
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:261