From 87f58ebe69dbf1757985f2b423aa1f81edabf3ff Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Thu, 19 Dec 2002 14:41:37 +0000 Subject: [PATCH] *** empty log message *** --- htdocs/paiement.class.php | 89 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 htdocs/paiement.class.php diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php new file mode 100644 index 00000000000..e9a1abb8a1e --- /dev/null +++ b/htdocs/paiement.class.php @@ -0,0 +1,89 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + * + */ + +require ($GLOBALS["DOCUMENT_ROOT"]."/html.form.class.php"); + +class Paiement +{ + var $id; + var $db; + var $facid; + var $datepaye; + var $amount; + var $author; + var $paiementid; // numero du paiement dans le cas ou une facture paye +ieur fois + var $num_paiement; + var $note; + /* + * + * + * + */ + Function Paiement($DB, $soc_idp="") + { + $this->db = $DB ; + } + /* + * + * + * + */ + Function create() + { + /* + * Insertion dans la base + */ + + $sql = "INSERT INTO llx_paiement (fk_facture, datec, datep, amount, author, fk_paiement, num_paiement, note)"; + $sql .= " VALUES ($this->facid, now(), $this->datepaye,$this->amount,'$this->author', $this->paiementid, '$this->num_paiement', '$this->note')"; + + $result = $this->db->query($sql); + + if ($result) + { + $label = "Facture $this->facnumber - $this->societe"; + $sql = "INSERT INTO llx_bank (datec, dateo, amount, author, label)"; + $sql .= " VALUES (now(), $this->datepaye, $this->amount,'$this->author', '$this->label')"; + $result = $this->db->query($sql); + } + else + { + print "$sql"; + } + } + /* + * + * + * + */ + Function select($name) + { + $form = new Form($this->db); + + $sql = "SELECT id, libelle FROM c_paiement ORDER BY id"; + + $form->select($name, $sql); + + } + +} +?>