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

   1  <?PHP
   2  /* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: index.php,v 1.12 2005/10/19 13:39:20 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/index.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->lire) accessforbidden();
  25  
  26  llxHeader('','Telephonie');
  27  
  28  /*
  29   *
  30   *
  31   *
  32   */
  33  
  34  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  35  print '<tr><td width="30%" valign="top">';
  36  
  37  print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php">';
  38  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  39  print '<tr class="liste_titre"><td>Recherche ligne</td>';
  40  print "</tr>\n";
  41  print "<tr $bc[1]>";
  42  print '<td>Numéro <input name="search_ligne" size="12"><input type="submit"></td></tr>';
  43  print '</table></form><br />';
  44  
  45  print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/contrat/liste.php">';
  46  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  47  print '<tr class="liste_titre"><td>Recherche contrat</td>';
  48  print "</tr>\n";
  49  print "<tr $bc[1]>";
  50  print '<td>Numéro <input name="search_contrat" size="12"></td></tr>';
  51  print '</table></form><br />';
  52  
  53  print '<form method="GET" action="'.DOL_URL_ROOT.'/telephonie/client/liste.php">';
  54  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  55  print '<tr class="liste_titre"><td>Recherche client</td>';
  56  print "</tr>\n";
  57  print "<tr $bc[1]>";
  58  print '<td>Nom <input name="search_client" size="12"><input type="submit"></td></tr>';
  59  print '</table></form>';
  60  
  61  print '<br />';
  62  
  63  
  64  
  65  
  66  print '</td><td width="30%" valign="top">';
  67  
  68  $sql = "SELECT distinct statut, count(*) as cc";
  69  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  70  $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp";
  71  $sql .= " WHERE l.fk_client_comm = sp.fk_soc";
  72  $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1";
  73  $sql .= " GROUP BY statut";
  74  
  75  $resql = $db->query($sql);
  76  
  77  if ($resql)
  78  {
  79    $num = $db->num_rows($resql);
  80    $i = 0;
  81    $ligne = new LigneTel($db);
  82  
  83    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  84    print '<tr class="liste_titre"><td>Lignes Statuts</td><td align="right">Nb</td>';
  85    print "<td>&nbsp;</td></tr>\n";
  86    $var=True;
  87  
  88    while ($i < $num)
  89      {
  90        $obj = $db->fetch_object($resql);    
  91        $var=!$var;
  92  
  93        print "<tr $bc[$var]>";
  94        print "<td>".$ligne->statuts[$obj->statut]."</td>\n";
  95        print '<td align="right">'.$obj->cc."</td>\n";
  96        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?statut='.$obj->statut.'"><img border="0" src="./ligne/graph'.$obj->statut.'.png"></a></td>';
  97        print "</tr>\n";
  98        $i++;
  99      }
 100    
 101    print "</table>";
 102    $db->free($resql);
 103  }
 104  else 
 105  {
 106    print $db->error() . ' ' . $sql;
 107  }
 108  
 109  print '</td><td width="40%" valign="top">';
 110  
 111  print '</td></tr>';
 112  
 113  print '<tr><td colspan="3">';
 114  
 115  if ($user->rights->telephonie->fournisseur->lire)
 116  {
 117    print '<br />';
 118  
 119    /*
 120     * Fournisseurs
 121     *
 122     */
 123    $statuts = array();
 124    $sql = "SELECT count(*), l.fk_fournisseur, l.statut";
 125    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 126    $sql .= " ,".MAIN_DB_PREFIX."societe_perms as sp";
 127    $sql .= " WHERE l.fk_client_comm = sp.fk_soc";
 128    $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1";
 129    $sql .= " GROUP BY l.fk_fournisseur, l.statut";
 130    $resql = $db->query($sql);
 131  
 132    if ($resql)
 133      {
 134        while ($row = $db->fetch_row($resql))
 135      {
 136        $statuts[$row[1]][$row[2]] = $row[0];
 137      }
 138      }
 139  
 140    $sql = "SELECT distinct f.nom as fournisseur, f.rowid, count(*) as cc";
 141    $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
 142    $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 143    $sql .= " ,".MAIN_DB_PREFIX."telephonie_fournisseur as f";
 144    $sql .= " ,".MAIN_DB_PREFIX."societe_perms as sp";
 145    $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
 146    $sql .= " AND l.fk_client_comm = sp.fk_soc";
 147    $sql .= " AND sp.fk_user = ".$user->id." AND sp.pread = 1";
 148    $sql .= " GROUP BY f.nom";
 149    
 150    $resql = $db->query($sql);
 151    
 152    if ($resql)
 153      {
 154        $num = $db->num_rows($resql);
 155        $i = 0;
 156        
 157        print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 158        print '<tr class="liste_titre"><td>Fournisseur</td><td align="center">Nb lignes</td>';
 159        for ($j = -1 ; $j < 10 ; $j++)
 160      {
 161        print '<td align="center"><img border="0" src="./ligne/graph'.$j.'.png"></td>';
 162      }
 163        print "</tr>\n";
 164        $var=True;
 165        
 166        while ($i < min($num,$conf->liste_limit))
 167      {
 168        $obj = $db->fetch_object($resql);
 169        $var=!$var;
 170        
 171        print "<tr $bc[$var]>";
 172        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/ligne/liste.php?fournisseur='.$obj->rowid.'">';
 173        print $obj->fournisseur.'</a></td>';
 174        print '<td align="center">'.$obj->cc."</td>\n";
 175        
 176        for ($k = -1 ; $k < 10 ; $k++)
 177          {
 178            print '<td align="center">'.$statuts[$obj->rowid][$k].'</td>';
 179          }
 180  
 181        print "</tr>\n";
 182        $i++;
 183      }
 184        print "</table>";
 185        $db->free($resql);
 186      }
 187    else 
 188      {
 189        print $db->error() . ' ' . $sql;
 190      }
 191  }
 192  
 193  print '</td></tr>';
 194  print '</table>';
 195    
 196  $db->close();
 197  
 198  llxFooter("<em>Derni&egrave;re modification $Date: 2005/10/19 13:39:20 $ r&eacute;vision $Revision: 1.12 $</em>");
 199  ?>


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