From 157ec79ca6ef5895d0a7a1e5d37dccd576eab477 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 16 Feb 2004 21:20:42 +0000 Subject: [PATCH] =?UTF-8?q?Ajout=20du=20pourcentage=20d'=E9colution=20par?= =?UTF-8?q?=20rapport=20=E0=20la=20p=E9riode=20pr=E9c=E9dente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/stats/index.php | 75 +++++++++++++++++++++++++++++++---- 1 file changed, 68 insertions(+), 7 deletions(-) diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index c59ad29ff79..6b1da1bec9d 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -36,7 +36,10 @@ if ($user->societe_id > 0) $socidp = $user->societe_id; } -print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT)"); +$mode='recettes'; +if ($conf->compta->mode == 'CREANCES-DETTES') { $mode='creances'; } + +print_titre("Chiffre d'affaire (".MAIN_MONNAIE." HT, ".$mode.")"); $sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; @@ -63,8 +66,8 @@ if ($result) } } -print ''; -print ''; +print '
 
'; +print ''; $year_current = strftime("%Y",time()); $nbyears = 3; @@ -82,9 +85,18 @@ else for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print ''; + +print ''; +for ($annee = $year_start ; $annee <= $year_end ; $annee++) +{ + print ''; + print ''; +} +print ''; + for ($mois = 1 ; $mois < 13 ; $mois++) { $var=!$var; @@ -93,13 +105,41 @@ for ($mois = 1 ; $mois < 13 ; $mois++) print ""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print '"; + // Pourcentage evol + if ($cum[$caseprev]) { + if ($case <= $casenow) { + if ($cum[$caseprev]) + print ''; + else + print ''; + } + else { + print ''; + } + } else { + if ($case <= $casenow) { + print ''; + } + else { + print ''; + } + } + $total[$annee]+=$cum[$case]; } @@ -107,10 +147,31 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) } // Affiche total -print ""; +print ""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { print ""; + + // Pourcentage evol + if ($total[$annee-1]) { + if ($annee <= $year_current) { + if ($total[$annee-1]) + print ''; + else + print ''; + } + else { + print ''; + } + } else { + if ($annee <= $year_current) { + print ''; + } + else { + print ''; + } + } + } print "\n";
Mois'.$annee.''.$annee.'
ValeurDelta
".strftime("%B",mktime(1,1,1,$mois,1,2000))." '; + $casenow = strftime("%Y-%m",mktime()); $case = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee)); - if ($cum[$case]>0) + $caseprev = strftime("%Y-%m",mktime(1,1,1,$mois,1,$annee-1)); + + // Valeur CA + print ''; + if ($cum[$case]) { print price($cum[$case]); } + else { + if ($case <= $casenow) { print '0'; } + else { print ' '; } + } print "'.(round(($cum[$case]-$cum[$caseprev])/$cum[$caseprev],4)*100).'%+Inf% - 
Total :
Total :".($total[$annee]?$total[$annee]:" ")."'.(round(($total[$annee]-$total[$annee-1])/$total[$annee-1],4)*100).'%+Inf% -