diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 3a858ea46a4..827b6f11f85 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2007 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 @@ -87,7 +87,7 @@ print 'Facturation clients'; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT s.nom, s.idp, sum(f.total) as amount_ht, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut = 1"; + $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut in (1,2)"; if ($year) $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } else { /* @@ -129,7 +129,8 @@ if ($result) { } // On ajoute les paiements clients anciennes version, non liés par paiement_facture -if ($modecompta != 'CREANCES-DETTES') { +if ($modecompta != 'CREANCES-DETTES') +{ $sql = "SELECT 'Autres' as nom, '0' as idp, sum(p.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; @@ -183,10 +184,11 @@ print ''; /* * Frais, factures fournisseurs. */ -if ($modecompta == 'CREANCES-DETTES') { +if ($modecompta == 'CREANCES-DETTES') +{ $sql = "SELECT s.nom, s.idp, sum(f.total_ht) as amount_ht, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f"; - $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut = 1"; + $sql .= " WHERE f.fk_soc = s.idp AND f.fk_statut in (1,2)"; if ($year) { $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } @@ -262,7 +264,7 @@ if ($modecompta == 'CREANCES-DETTES') $amount=0; $sql = "SELECT sum(f.tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_statut = 1"; + $sql .= " WHERE f.fk_statut in (1,2)"; if ($year) { $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } @@ -298,7 +300,7 @@ if ($modecompta == 'CREANCES-DETTES') $amount=0; $sql = "SELECT sum(f.total_tva) as amount, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; - $sql .= " WHERE f.fk_statut = 1"; + $sql .= " WHERE f.fk_statut in (1,2)"; if ($year) { $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 422ea69da92..226571836c2 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2007 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 @@ -77,7 +77,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT u.rowid as rowid, u.name as name, u.firstname as firstname, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u,".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_statut = 1 AND f.fk_user_author = u.rowid"; + $sql .= " WHERE f.fk_statut in (1,2) AND f.fk_user_author = u.rowid"; if ($year) $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } else diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index a58328696c0..d8acb0f7bbb 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -1,8 +1,8 @@ - * Copyright (C) 2004-2005 Laurent Destailleur - * Copyright (C) 2006 Laurent Destailleur - * Copyright (C) 2007 Franky Van Liedekerke +/* Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2006-2007 Laurent Destailleur + * Copyright (C) 2007 Franky Van Liedekerke * * 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 @@ -78,7 +78,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT s.idp as rowid, s.nom as name, sum(f.total) as amount, sum(f.total_ttc) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_statut = 1 AND f.fk_soc = s.idp"; + $sql .= " WHERE f.fk_statut in (1,2) AND f.fk_soc = s.idp"; if ($year) $sql .= " AND f.datef between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } else diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 3851d414aa6..1d5250fe63c 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2007 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 @@ -79,7 +79,7 @@ $html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$ if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT sum(f.total) as amount, sum(f.total_ttc) as amount_ttc, date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_statut = 1"; + $sql .= " WHERE f.fk_statut in (1,2)"; } else { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les