| ';
$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)
{
$sql .= " AND f.fk_soc = $socidp";
@@ -53,7 +57,11 @@ pt($db, $sql,"Suivi cumul par mois");
print " | ";
$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)
{
$sql .= " AND f.fk_soc = $socidp";
diff --git a/htdocs/compta/stats/exercices.php b/htdocs/compta/stats/exercices.php
index d4529550940..781d5134712 100644
--- a/htdocs/compta/stats/exercices.php
+++ b/htdocs/compta/stats/exercices.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
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index 908db13f70e..c59ad29ff79 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -39,8 +39,11 @@ if ($user->societe_id > 0)
print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)");
$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)
{
$sql .= " AND f.fk_soc = $socidp";
diff --git a/htdocs/compta/stats/lib.inc.php b/htdocs/compta/stats/lib.inc.php
index 407695213af..b6102b5d64e 100644
--- a/htdocs/compta/stats/lib.inc.php
+++ b/htdocs/compta/stats/lib.inc.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
|