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

   1  <?php
   2  /* Copyright (C) 2001-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.18 2005/08/25 20:27:18 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/product/stats/index.php,v $
  21   *
  22   */
  23  
  24  /** 
  25          \file       htdocs/product/stats/index.php
  26          \brief      Page accueil statistiques produits
  27          \version    $Revision: 1.18 $
  28  */
  29  
  30  require ("./pre.inc.php");
  31  require_once (DOL_DOCUMENT_ROOT."/propal.class.php");
  32  
  33  
  34  llxHeader();
  35  
  36  $mesg = '';
  37  
  38  /*
  39   *
  40   *
  41   */
  42  $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE fk_product_type = 0";
  43  if ($db->query($sql))
  44  {
  45    $row = $db->fetch_row(0);
  46    $nbproduct = $row[0];
  47  }
  48  $db->free();
  49  $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE envente = 0 AND fk_product_type = 0";
  50  if ($db->query($sql))
  51  {
  52    $row = $db->fetch_row(0);
  53    $nbhv = $row[0];
  54  }
  55  $db->free();
  56  
  57  print_fiche_titre($langs->trans("ProductsAndServicesStatistics"), $mesg);
  58  print '<br>';
  59  
  60  print '<table class="noborder" width="100%">';
  61  
  62  print '<tr class="liste_titre">';
  63  print '<td>'.$langs->trans("Summary").'</td><td>'.$langs->trans("Value").'</td>';
  64  print "</tr>\n";
  65  
  66  $var=True;
  67  print "<tr ".$bc[$var].">";
  68  print '<td width="40%">Nb de produit dans le catalogue</td>';
  69  print '<td>'.$nbproduct.'</td></tr>';
  70  $var=!$var;
  71  print "<tr ".$bc[$var].">";
  72  print '<td width="40%">Nb de produit dans le catalogue qui ne sont pas en vente</td>';
  73  print '<td>'.$nbhv.'</td></tr>';
  74  
  75  $sql = "SELECT count(*) FROM llx_product WHERE fk_product_type = 1";
  76  if ($db->query($sql))
  77  {
  78    $row = $db->fetch_row(0);
  79    $nbproduct = $row[0];
  80  }
  81  $db->free();
  82  $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE envente = 0 AND fk_product_type = 1";
  83  if ($db->query($sql))
  84  {
  85    $row = $db->fetch_row(0);
  86    $nbhv = $row[0];
  87  }
  88  $db->free();
  89  
  90  $var=!$var;
  91  print "<tr ".$bc[$var].">";
  92  print '<td width="40%">Nb de service dans le catalogue</td>';
  93  print '<td>'.$nbproduct.'</td></tr>';
  94  
  95  $var=!$var;
  96  print "<tr ".$bc[$var].">";
  97  print '<td width="40%">Nb de service dans le catalogue qui ne sont pas en vente</td>';
  98  print '<td>'.$nbhv.'</td></tr>';
  99  
 100  print '</table>';
 101  
 102  
 103  // Stats des produits en factures, propale, ...
 104  /*
 105  print '<br>';
 106  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 107  print "<tr class=\"liste_titre\">";
 108  print "<td>Produit/Service</td>";
 109  print "<td>Qté en facture</td>";
 110  print "<td>Qté en propale</td>";
 111  print "</tr>\n";
 112  $sql = "SELECT p.label, sum(f.qty) as sumf, sum(pr.qty) as sumpr FROM ".MAIN_DB_PREFIX."product as p";
 113  $sql.=" left join ".MAIN_DB_PREFIX."facturedet as f on p.rowid = f.fk_product";
 114  $sql.=" left join ".MAIN_DB_PREFIX."propaldet as pr on p.rowid = pr.fk_product";
 115  $sql.=" group by p.label";
 116  if ($db->query($sql))
 117  {
 118    $num = $db->num_rows();
 119    $i = 0;
 120        while ($i < $num)
 121      {
 122          $obj = $db->fetch_object( $i);
 123          print "<tr ".$bc[$var].">";
 124          print "<td>".$obj->label."</td>";
 125          print "<td>".$obj->sumf."</td>";
 126          print "<td>".$obj->sumpr."</td>";
 127          print '</tr>';
 128          $i++;
 129      }
 130  }
 131  else {
 132      dolibarr_print_error($db);    
 133  }
 134  print "</table>\n";
 135  $db->free();
 136  */
 137  
 138         
 139  $db->close();
 140  
 141  llxFooter("<em>Derni&egrave;re modification $Date: 2005/08/25 20:27:18 $ r&eacute;vision $Revision: 1.18 $</em>");
 142  ?>


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