Les rapports tiennent compte du statut 2 et 3 des factures.
This commit is contained in:
parent
3c218d6e51
commit
5247ac10e5
@ -99,6 +99,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_soc = s.idp";
|
||||
if ($year) $sql .= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
if ($socid) $sql .= " AND f.fk_soc = $socid";
|
||||
$sql .= " GROUP BY nom";
|
||||
$sql .= " ORDER BY nom";
|
||||
|
||||
@ -204,6 +205,10 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$sql .= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'";
|
||||
}
|
||||
}
|
||||
if ($socid)
|
||||
{
|
||||
$sql .= " AND f.fk_soc = $socid";
|
||||
}
|
||||
$sql .= " GROUP BY nom, idp";
|
||||
$sql .= " ORDER BY nom, idp";
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 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
|
||||
@ -18,7 +18,6 @@
|
||||
*
|
||||
* $Id$
|
||||
* $Source$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -85,7 +84,7 @@ $html->report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT sum(f.total) 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 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)";
|
||||
} else {
|
||||
/*
|
||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||
@ -152,7 +151,7 @@ if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'CREANCES-DETTES') {
|
||||
$sql = "SELECT 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)";
|
||||
} else {
|
||||
$sql = "SELECT sum(p.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
|
||||
@ -194,7 +193,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
// TVA à payer
|
||||
$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)";
|
||||
$sql .= " GROUP BY dm DESC";
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
@ -217,7 +216,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
// TVA à récupérer
|
||||
$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)";
|
||||
$sql .= " GROUP BY dm";
|
||||
$result=$db->query($sql);
|
||||
if ($result) {
|
||||
@ -239,7 +238,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TVA payée
|
||||
// TVA réellement déja payée
|
||||
$sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."tva as t";
|
||||
$sql .= " WHERE amount > 0";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user