From f0cf042e144e35653e77f078c428e1b5a8747cdb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 May 2004 22:02:27 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Ajout=20d'une=20fiche=20de=20Charges=20S?= =?UTF-8?q?ociales=20permettant=20de=20modifier=20une=20saisie=20de=20char?= =?UTF-8?q?ge=20(montant,=20libell=E9)=20tant=20qu'elle=20n'est=20pas=20pa?= =?UTF-8?q?y=E9.=20Il=20reste=20=E0=20g=E9rer=20le=20paiement=20pour=20avo?= =?UTF-8?q?ir=20une=20entr=E9e=20sur=20le=20compte=20automatiquement=20(co?= =?UTF-8?q?mme=20pour=20les=20factures).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/chargesociales.class.php | 68 +++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/htdocs/chargesociales.class.php b/htdocs/chargesociales.class.php index 17887f84cfb..78cf8686198 100644 --- a/htdocs/chargesociales.class.php +++ b/htdocs/chargesociales.class.php @@ -1,5 +1,6 @@ + * Copyright (C) 2004 Laurent Destailleur * * 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 @@ -22,26 +23,69 @@ /* * La tva collectée n'est calculée que sur les factures payées. * - * - * - * - * - * - * */ class ChargeSociales { + var $id; var $db; - - var $note; - - Function ChargeSociales($DB) { - global $config; - + var $date_ech; + var $date_pai; + var $lib; + var $type; + var $lib_typ; + var $amount; + var $paye; + var $periode; + + Function ChargeSociales($DB) + { $this->db = $DB; return 1; } + /* + * + * + */ + Function fetch($id) + { + $sql = "SELECT cs.rowid,".$this->db->pdate("cs.date_ech")." as date_ech,".$this->db->pdate("cs.date_pai")." as date_pai"; + $sql .=", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, c.libelle"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs, ".MAIN_DB_PREFIX."c_chargesociales as c"; + $sql .= " WHERE cs.fk_type = c.id"; + $sql .=" AND cs.rowid = ".$id; + + if ($this->db->query($sql)) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object(0); + + $this->id = $obj->rowid; + $this->date_ech = $obj->date_ech; + $this->date_pai = $obj->date_pai; + $this->lib = $obj->lib; + $this->type = $obj->fk_type; + $this->type_libelle = $obj->libelle; + $this->amount = $obj->amount; + $this->paye = $obj->paye; + $this->periode = $obj->periode; + + return 1; + } + else + { + return 0; + } + $this->db->free(); + } + else + { + print $this->db->error(); + return 0; + } + } + Function solde($year = 0) { $sql = "SELECT sum(f.amount) as amount";