[ 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/comm/propal/stats/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004 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.10 2005/07/16 14:56:55 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/propal/stats/index.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/comm/propal/stats/index.php
  26          \ingroup    propale
  27          \brief      Page des stats propositions commerciales
  28          \version    $Revision: 1.10 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  require ("./propalestats.class.php");
  33  
  34  $WIDTH=500;
  35  $HEIGHT=250;
  36  
  37  
  38  llxHeader();
  39  
  40  print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
  41  
  42  $stats = new PropaleStats($db);
  43  $year = strftime("%Y", time());
  44  $data = $stats->getNbByMonthWithPrevYear($year);
  45  
  46  if (! is_dir($conf->propal->dir_images)) { mkdir($conf->propal->dir_images); }
  47  
  48  $filename = $conf->propal->dir_images."/nbpropale2year-$year.png";
  49  $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=nbpropale2year-'.$year.'.png';
  50  
  51  $px = new BarGraph();
  52  $mesg = $px->isGraphKo();
  53  if (! $mesg) {
  54      $px->SetData($data);
  55      $px->SetLegend(array($year - 1, $year));
  56      $px->SetMaxValue($px->GetMaxValue());
  57      $px->SetWidth($WIDTH);
  58      $px->SetHeight($HEIGHT);
  59      $px->draw($filename);
  60  }
  61  
  62  $sql = "SELECT count(*), date_format(datep,'%Y') as dm, sum(price)  FROM ".MAIN_DB_PREFIX."propal WHERE fk_statut > 0 GROUP BY dm DESC ";
  63  if ($db->query($sql))
  64  {
  65    $num = $db->num_rows();
  66  
  67    print '<table class="border" width="100%" cellspacing="0" cellpadding="2">';
  68    print '<tr><td align="center">'.$langs->trans("Year").'</td><td width="10%" align="center">'.$langs->trans("NbOfProposals").'</td><td align="center">'.$langs->trans("AmountTotal").'</td>';
  69    print '<td align="center" valign="top" rowspan="'.($num + 1).'">';
  70    if ($mesg) { print "$mesg"; }
  71    else { print '<img src="'.$fileurl.'" alt="Nombre de proposition par mois">'; }
  72    print '</td></tr>';
  73    $i = 0;
  74    while ($i < $num)
  75      {
  76        $row = $db->fetch_row($i);
  77        $nbproduct = $row[0];
  78        $year = $row[1];
  79        print "<tr>";
  80        print '<td align="center"><a href="month.php?year='.$year.'">'.$year.'</a></td><td align="center">'.$nbproduct.'</td><td align="center">'.price($row[2]).'</td></tr>';
  81        $i++;
  82      }
  83  
  84    print '</table>';
  85    $db->free();
  86  }
  87  else
  88  {
  89    dolibarr_print_error($db);
  90  }
  91  
  92  
  93  $db->close();
  94  
  95  llxFooter('$Date: 2005/07/16 14:56:55 $ - $Revision: 1.10 $');
  96  ?>


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