[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/commande/stats/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (c) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: index.php,v 1.16 2005/09/03 14:39:28 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/commande/stats/index.php,v $
  21   */
  22  
  23  /**
  24          \file       htdocs/commande/stats/index.php
  25          \ingroup    commande
  26          \brief      Page des stats commandes
  27          \version    $Revision: 1.16 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  
  32  if (!$user->rights->commande->lire) accessforbidden();
  33  
  34  require (DOL_DOCUMENT_ROOT."/commande/commande.class.php");
  35  require ("./commandestats.class.php");
  36  
  37  $WIDTH=500;
  38  $HEIGHT=250;
  39  
  40  // Sécurité accés client
  41  if ($user->societe_id > 0) 
  42  {
  43    $action = '';
  44    $socidp = $user->societe_id;
  45  }
  46  
  47  
  48  llxHeader();
  49  
  50  print_fiche_titre($langs->trans("OrdersStatistics"), $mesg);
  51  
  52  $stats = new CommandeStats($db, $socidp);
  53  
  54  $year = strftime("%Y", time());
  55  $data = $stats->getNbByMonthWithPrevYear($year);
  56  
  57  // Création répertoire pour images générées
  58  $dir=$conf->commande->dir_images;
  59  if (! file_exists($dir))
  60  {
  61      if (create_exdir($dir) < 0)
  62      {
  63          $mesg = $langs->trans("ErrorCanNotCreateDir",$dir);
  64      }
  65  }
  66  
  67  
  68  $filename = $conf->commande->dir_images."/nbcommande2year-".$year.".png";
  69  $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=nbcommande2year-'.$year.'.png';
  70  
  71  $px = new BarGraph();
  72  $mesg = $px->isGraphKo();
  73  if (! $mesg) {
  74      $px->SetData($data);
  75      $px->SetMaxValue($px->GetMaxValue());
  76      $px->SetLegend(array($year - 1, $year));
  77      $px->SetWidth($WIDTH);
  78      $px->SetHeight($HEIGHT);
  79      $px->SetYLabel("Nombre de commande");
  80      $px->draw($filename);
  81  }      
  82  $rows = $stats->getNbByYear();
  83  $num = sizeof($rows);
  84  
  85  print '<table class="border" width="100%">';
  86  print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NbOfOrders").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>';
  87  print '<td align="center" valign="top" rowspan="'.($num + 1).'">';
  88  if ($px->isGraphKo()) { print '<font class="error">'.$px->isGraphKo().'</div>'; }
  89  else { print '<img src="'.$fileurl.'" alt="Nombre de commande par mois">'; }
  90  print '</td></tr>';
  91  $i = 0;
  92  while (list($key, $value) = each ($rows))
  93  {
  94    $year = $value[0];
  95    $nbproduct = $value[1];
  96    $price = $value[2];
  97    print "<tr>";
  98    print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td align="center">'.$nbproduct.'</td><td align="center">'.price($price).'</td></tr>';
  99    $i++;
 100  }
 101  
 102  print '</table>';
 103  
 104  
 105  $db->close();
 106  
 107  llxFooter('$Date: 2005/09/03 14:39:28 $ - $Revision: 1.16 $');
 108  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics