Les rapports tiennent compte du statut 2 et 3 des factures.

This commit is contained in:
Laurent Destailleur 2007-02-28 09:06:11 +00:00
parent a36e89e585
commit 3c218d6e51
4 changed files with 18 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 '<tr><td colspan="4">Facturation clients</td></tr>';
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 '</tr>';
/*
* 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'";
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
*
* 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

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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