From 7774c3ac598c6288d2990bf1c852cf2845588e2a Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sun, 29 Jun 2003 09:27:45 +0000 Subject: [PATCH] bugfix --- htdocs/compta/stats/comp.php | 41 ++++++++++++++++++--------------- htdocs/compta/stats/lib.inc.php | 2 +- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index 76079aa8974..ef516364edb 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -221,7 +221,8 @@ function pt ($db, $sql, $year) { } } -function ppt ($db, $year, $socidp) { +function ppt ($db, $year, $socidp) +{ global $bc; print ""; @@ -234,11 +235,12 @@ function ppt ($db, $year, $socidp) { print "\n"; $var = 1 ; - for ($b = 1 ; $b <= 12 ; $b++) { - $var=!$var; - - $delta = $ca[$b] - $prev[$b]; - $deltat = $deltat + $delta ; - print ""; - print "\n"; - print "\n"; - print "\n"; - } + for ($b = 1 ; $b <= 12 ; $b++) + { + $var=!$var; + $delta = $ca[$b] - $prev[$b]; + $deltat = $deltat + $delta ; + print ""; + print "\n"; + print "\n"; + print "\n"; + } + $ayear = $year - 1; $acat = get_ca($db, $ayear, $socidp) - get_ca_propal($db, $ayear, $socidp); diff --git a/htdocs/compta/stats/lib.inc.php b/htdocs/compta/stats/lib.inc.php index 1efa57518a9..cc9b9d0cd98 100644 --- a/htdocs/compta/stats/lib.inc.php +++ b/htdocs/compta/stats/lib.inc.php @@ -23,7 +23,7 @@ function get_ca_propal ($db, $year, $socidp) { - $sql = "SELECT sum(f.price - f.remise) as sum FROM llx_propal as f WHERE fk_statut in (1,2) AND date_format(f.datep, '%Y') = $year "; + $sql = "SELECT sum(f.price - f.remise) as sum FROM llx_propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year "; if ($socidp) { $sql .= " AND f.fk_soc = $socidp";
"; $sql = "SELECT sum(f.price - f.remise) as sum, round(date_format(f.datep,'%m')) as dm"; - $sql .= " FROM llx_propal as f WHERE fk_statut in (1,2) AND date_format(f.datep,'%Y') = $year "; + $sql .= " FROM llx_propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep,'%Y') = $year "; - if ($socidp) { - $sql .= " AND f.fk_soc = $socidp"; - } + if ($socidp) + { + $sql .= " AND f.fk_soc = $socidp"; + } $sql .= " GROUP BY dm"; @@ -248,10 +250,10 @@ function ppt ($db, $year, $socidp) { $sql = "SELECT sum(f.amount) as sum, round(date_format(f.datef, '%m')) as dm"; $sql .= " FROM llx_facture as f WHERE f.paye = 1 AND date_format(f.datef,'%Y') = $year "; - - if ($socidp) { - $sql .= " AND f.fk_soc = $socidp"; - } + if ($socidp) + { + $sql .= " AND f.fk_soc = $socidp"; + } $sql .= " GROUP BY dm"; $ca = pt($db, $sql, $year); @@ -265,17 +267,18 @@ function ppt ($db, $year, $socidp) { print "
".strftime("%B",mktime(12,0,0,$b, 1, $year))."".price($delta)."
".strftime("%B",mktime(12,0,0,$b, 1, $year))."".price($delta)."