Gestion du paramètre $conf->compta->mode qui vaut 'DEPENSES-RECETTES' par défaut, sinon 'CREANCES-DETTES'. Il détermine le mode de calcul du CA.
This commit is contained in:
parent
8a29fa7a75
commit
054c6a5a81
@ -42,7 +42,10 @@ print_titre("Chiffre d'affaire par utilisateur (euros HT)");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql .= " WHERE f.fk_user_valid is not NULL AND f.fk_statut = 1";
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
@ -64,7 +67,10 @@ if ($catotal == 0) { $catotal = 1; };
|
|||||||
|
|
||||||
$sql = "SELECT u.name, u.firstname, sum(f.total) as ca";
|
$sql = "SELECT u.name, u.firstname, sum(f.total) as ca";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."user as u,".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."user as u,".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql .= " WHERE f.fk_user_valid is not NULL and f.fk_statut = 1 AND f.fk_user_author = u.rowid";
|
$sql .= " WHERE f.fk_statut = 1 AND f.fk_user_author = u.rowid";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
|||||||
@ -42,7 +42,10 @@ print_titre("Chiffre d'affaire par soci
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql = "SELECT sum(f.total) as ca FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql .= " WHERE f.fk_user_valid = 1 AND f.fk_statut = 1";
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
@ -56,6 +59,9 @@ if ($result)
|
|||||||
$catotal = $objp->ca;
|
$catotal = $objp->ca;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
print $db->error() . "<br>" . $sql;
|
||||||
|
}
|
||||||
|
|
||||||
print "<br><b>Cumul : ".price($catotal)."</b>";
|
print "<br><b>Cumul : ".price($catotal)."</b>";
|
||||||
|
|
||||||
@ -64,7 +70,10 @@ if ($catotal == 0) { $catotal = 1; };
|
|||||||
|
|
||||||
$sql = "SELECT s.nom, s.idp, sum(f.total) as ca";
|
$sql = "SELECT s.nom, s.idp, sum(f.total) as ca";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql .= " WHERE f.fk_statut = 1 and f.fk_user_valid = 1 AND f.fk_soc = s.idp";
|
$sql .= " WHERE f.fk_statut = 1 AND f.fk_soc = s.idp";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -41,7 +41,11 @@ print_titre("Chiffre d'affaire cumul
|
|||||||
print '<table width="100%"><tr><td valign="top">';
|
print '<table width="100%"><tr><td valign="top">';
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE fk_user_valid is not NULL and f.paye = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
@ -53,7 +57,11 @@ pt($db, $sql,"Suivi cumul par mois");
|
|||||||
print "</td><td valign=\"top\">";
|
print "</td><td valign=\"top\">";
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as amount, year(f.datef) as dm";
|
$sql = "SELECT sum(f.total) as amount, year(f.datef) as dm";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE fk_user_valid is not NULL and f.paye = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -39,8 +39,11 @@ if ($user->societe_id > 0)
|
|||||||
print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)");
|
print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)");
|
||||||
|
|
||||||
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
|
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1";
|
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
|
$sql .= " WHERE f.fk_statut = 1";
|
||||||
|
if ($conf->compta->mode != 'CREANCES-DETTES') {
|
||||||
|
$sql .= " AND f.paye = 1";
|
||||||
|
}
|
||||||
if ($socidp)
|
if ($socidp)
|
||||||
{
|
{
|
||||||
$sql .= " AND f.fk_soc = $socidp";
|
$sql .= " AND f.fk_soc = $socidp";
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user