From 20f1fefcd1b6088af54b9370902f057a1ca65506 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Wed, 26 Jun 2002 00:03:47 +0000 Subject: [PATCH] . --- htdocs/compta/pre.inc.php3 | 18 ++++++++++++++---- htdocs/main.inc.php3 | 14 +++++--------- htdocs/menu.class.php3 | 11 ++++++----- htdocs/tva.class.php3 | 37 +++++++++++++++++++++++++++++++++++-- 4 files changed, 60 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/pre.inc.php3 b/htdocs/compta/pre.inc.php3 index c1dd5126ce3..e633ddd1fdb 100644 --- a/htdocs/compta/pre.inc.php3 +++ b/htdocs/compta/pre.inc.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ * * 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 @@ -18,6 +15,9 @@ * 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("../main.inc.php3"); @@ -35,7 +35,6 @@ function llxHeader($head = "") { $menu->add("/compta/facture.php3","Factures"); $menu->add_submenu("paiement.php3","Paiements"); - // $menu->add_submenu("fac.php3","admin fac"); $menu->add("charges/index.php3","Charges"); $menu->add_submenu("sociales/","Prest. Sociales"); @@ -68,6 +67,17 @@ function llxHeader($head = "") { $menu->add_submenu("ligne.php3","Lignes"); $menu->add_submenu("config.php3","Configuration"); + + if ($user->compta > 0) { + + } else { + $menu->clear(); + $menu->add("/index.php3","Accueil"); + + + + } + left_menu($menu->liste); } diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3 index 88a3e8133a7..c856f0c6632 100644 --- a/htdocs/main.inc.php3 +++ b/htdocs/main.inc.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ * * 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 @@ -18,19 +15,18 @@ * 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"]."/conf/conf.class.php3"); require ($GLOBALS["DOCUMENT_ROOT"]."/lib/mysql.lib.php3"); - require ($GLOBALS["DOCUMENT_ROOT"]."/lib/functions.inc.php3"); - -require ($GLOBALS["DOCUMENT_ROOT"]."/user.class.php3"); require ($GLOBALS["DOCUMENT_ROOT"]."/lib/product.class.php3"); - +require ($GLOBALS["DOCUMENT_ROOT"]."/user.class.php3"); require ($GLOBALS["DOCUMENT_ROOT"]."/menu.class.php3"); - -require($GLOBALS["DOCUMENT_ROOT"]."/societe.class.php3"); +require ($GLOBALS["DOCUMENT_ROOT"]."/societe.class.php3"); $conf = new Conf(); diff --git a/htdocs/menu.class.php3 b/htdocs/menu.class.php3 index f448e4d517c..67c95048645 100644 --- a/htdocs/menu.class.php3 +++ b/htdocs/menu.class.php3 @@ -1,8 +1,5 @@ - * - * $Id$ - * $Source$ * * 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 @@ -18,6 +15,9 @@ * 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$ + * */ class Menu { @@ -25,7 +25,10 @@ class Menu { Function Menu() { $this->liste = array(); + } + Function clear() { + $this->liste = array(); } @@ -45,8 +48,6 @@ class Menu { $this->liste[$i][$j] = $url; $this->liste[$i][$j+1] = $titre; - } - } diff --git a/htdocs/tva.class.php3 b/htdocs/tva.class.php3 index d97b858c1a7..eb4e124048f 100644 --- a/htdocs/tva.class.php3 +++ b/htdocs/tva.class.php3 @@ -44,10 +44,12 @@ class Tva { */ Function solde($year = 0) { + $reglee = $this->tva_sum_reglee($year); + $payee = $this->tva_sum_payee($year); $collectee = $this->tva_sum_collectee($year); - $solde = $payee - $collectee; + $solde = $reglee - ($collectee - $payee) ; return $solde; } @@ -84,11 +86,42 @@ class Tva { } /* * Tva payée - * Total de la TVA payee aupres de qui de droit + * * */ Function tva_sum_payee($year = 0) { + $sql = "SELECT sum(f.amount) as amount"; + $sql .= " FROM llx_facture_fourn as f"; + + if ($year) { + $sql .= " WHERE f.datef >= '$year-01-01' AND f.datef <= '$year-12-31' "; + } + + $result = $this->db->query($sql); + + if ($result) { + if ($this->db->num_rows()) { + $obj = $this->db->fetch_object(0); + return $obj->amount; + } else { + return 0; + } + + $this->db->free(); + + } else { + print $this->db->error(); + return -1; + } + } + /* + * Tva réglée + * Total de la TVA réglee aupres de qui de droit + * + */ + Function tva_sum_reglee($year = 0) { + $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM llx_tva as f";