This commit is contained in:
Rodolphe Quiedeville 2002-06-26 00:03:47 +00:00
parent 7d41814d70
commit 20f1fefcd1
4 changed files with 60 additions and 20 deletions

View File

@ -1,8 +1,5 @@
<?PHP
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $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);
}

View File

@ -1,8 +1,5 @@
<?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $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();

View File

@ -1,8 +1,5 @@
<?PHP
/* Copyright (C) 2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* $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;
}
}

View File

@ -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";