[ 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/ -> month.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: month.php,v 1.11 2005/07/16 14:56:55 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/propal/stats/month.php,v $
  21   *
  22   */
  23  
  24  /**
  25          \file       htdocs/comm/propal/stats/month.php
  26          \ingroup    propale
  27          \brief      Page des stats propositions commerciales par mois
  28          \version    $Revision: 1.11 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  require ("./propalestats.class.php");
  33  
  34  llxHeader();
  35  
  36  $year = isset($_GET["year"])?$_GET["year"]:date("Y",time());
  37  
  38  $mesg = '<a href="month.php?year='.($year - 1).'">'.img_previous().'</a> ';
  39  $mesg.= $langs->trans("Year")." $year";
  40  $mesg.= ' <a href="month.php?year='.($year + 1).'">'.img_next().'</a>';
  41  
  42  $WIDTH=500;
  43  $HEIGHT=250;
  44  
  45  /*
  46   *
  47   *
  48   */
  49  
  50  print_fiche_titre($langs->trans("ProposalsStatistics"), $mesg);
  51  
  52  $stats = new PropaleStats($db);
  53  $data = $stats->getNbByMonth($year);
  54  
  55  if (! is_dir($conf->propal->dir_images)) { mkdir($conf->propal->dir_images); }
  56  
  57  $filename = $conf->propal->dir_images."/propale".$year.".png";
  58  $fileurl = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propale'.$year.'.png';
  59  
  60  $px = new BarGraph();
  61  $mesg = $px->isGraphKo();
  62  if (! $mesg) {
  63      $px->SetData($data);
  64      $px->SetMaxValue($px->GetMaxValue());
  65      $px->SetWidth($WIDTH);
  66      $px->SetHeight($HEIGHT);
  67      $px->draw($filename);
  68  }
  69  
  70  $res = $stats->getAmountByMonth($year);
  71  
  72  $data = array();
  73  
  74  for ($i = 1 ; $i < 13 ; $i++)
  75  {
  76    $data[$i-1] = array(ucfirst(substr(strftime("%b",mktime(12,12,12,$i,1,$year)),0,3)), $res[$i]);
  77  }
  78  
  79  $filename_amount = $conf->propal->dir_images."/propaleamount".$year.".png";
  80  $fileurl_amount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleamount'.$year.'.png';
  81  
  82  $px = new BarGraph();
  83  $mesg = $px->isGraphKo();
  84  if (! $mesg) {
  85      $px->SetData($data);
  86      $px->SetYLabel($langs->trans("AmountTotal"));
  87      $px->SetMaxValue($px->GetAmountMaxValue());
  88      $px->SetWidth($WIDTH);
  89      $px->SetHeight($HEIGHT);
  90      $px->draw($filename_amount, $data, $year);
  91  }
  92  $res = $stats->getAverageByMonth($year);
  93  
  94  $data = array();
  95  
  96  for ($i = 1 ; $i < 13 ; $i++)
  97  {
  98    $data[$i-1] = array(ucfirst(substr(strftime("%b",mktime(12,12,12,$i,1,$year)),0,3)), $res[$i]);
  99  }
 100  $filename_avg = $conf->propal->dir_images."/propaleaverage".$year.".png";
 101  $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=propaleaverage'.$year.'.png';
 102  
 103  $px = new BarGraph();
 104  $mesg = $px->isGraphKo();
 105  if (! $mesg) {
 106      $px->SetData($data);
 107      $px->SetYLabel($langs->trans("AmountAverage"));
 108      $px->SetMaxValue($px->GetAmountMaxValue());
 109      $px->SetWidth($WIDTH);
 110      $px->SetHeight($HEIGHT);
 111      $px->draw($filename_avg);
 112  }
 113  
 114  print '<table class="border" width="100%">';
 115  print '<tr><td align="center">'.$langs->trans("NumberOfProposalsByMonth").'</td>';
 116  print '<td align="center">';
 117  if ($mesg) { print $mesg; }
 118  else { print '<img src="'.$fileurl.'">'; }
 119  print '</td></tr>';
 120  print '<tr><td align="center">'.$langs->trans("AmountTotal").'</td>';
 121  print '<td align="center">';
 122  if ($mesg) { print $mesg; }
 123  else { print '<img src="'.$fileurl_amount.'">'; }
 124  print '</td></tr>';
 125  print '<tr><td align="center">'.$langs->trans("AmountAverage").'</td>';
 126  print '<td align="center">';
 127  if ($mesg) { print $mesg; }
 128  else { print '<img src="'.$fileurl_avg.'">'; }
 129  print '</td></tr></table>';
 130  
 131  $db->close();
 132  
 133  llxFooter('$Date: 2005/07/16 14:56:55 $ - $Revision: 1.11 $');
 134  ?>


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