diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index c3035128d5c..44b9266f5e5 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -20,11 +20,25 @@
* $Source$
*
*/
+
+/**
+ \file htdocs/compta/stats/index.php
+ \brief Page reporting CA
+ \version $Revision$
+*/
+
require("./pre.inc.php");
-/*
- *
- */
+$year_start=isset($_GET["year_start"])?$_GET["year_start"]:$_POST["year_start"];
+$year_current = strftime("%Y",time());
+if (! $year_start) {
+ $year_start = $year_current - 2;
+ $year_end = $year_current;
+}
+else {
+ $year_end=$year_start+2;
+}
+
llxHeader();
@@ -40,7 +54,10 @@ $mode='recettes';
if ($conf->compta->mode == 'CREANCES-DETTES') { $mode='creances'; }
-print_titre("Chiffre d'affaire (".$conf->monnaie." HT, ".$mode.")");
+$title="Chiffre d'affaire (".$conf->monnaie." HT, ".$mode.")";
+$lien=($year_start?"".img_previous()." ".img_next()."":"");
+print_fiche_titre($title,$lien);
+
print '
';
$sql = "SELECT sum(f.total) as amount , date_format(f.datef,'%Y-%m') as dm";
@@ -71,20 +88,6 @@ if ($result)
print '
| '.$langs->trans("Month").' | '; -$year_current = strftime("%Y",time()); -$nbyears = 3; - -if ($year_current < (MAIN_START_YEAR + $nbyears)) -{ - $year_start = MAIN_START_YEAR; - $year_end = (MAIN_START_YEAR + $nbyears - 1); -} -else -{ - $year_start = $year_current - ($nbyears + 1); - $year_end = $year_current ; -} - for ($annee = $year_start ; $annee <= $year_end ; $annee++) { print ''.$annee.' | ';|