[ 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/ligne/ -> conso.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: conso.php,v 1.6 2005/12/08 11:47:20 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/conso.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  $mesg = '';
  26  
  27  llxHeader("","","Fiche Ligne");
  28  
  29  if ($_GET["id"] or $_GET["numero"])
  30  {
  31  
  32    $ligne = new LigneTel($db);
  33    if ($_GET["id"])
  34      {
  35        $result = $ligne->fetch_by_id($_GET["id"]);
  36      }
  37    if ($_GET["numero"])
  38      {
  39        $result = $ligne->fetch($_GET["numero"]);
  40      }
  41    
  42    if ($result == 1)
  43      {
  44        $client_comm = new Societe($db);
  45        $client_comm->fetch($ligne->client_comm_id, $user);
  46      }
  47    
  48    if (!$client_comm->perm_read)
  49      {
  50        print "Lecture non authorisée";
  51      }
  52    
  53    
  54    if ($result == 1 && $client_comm->perm_read)
  55      { 
  56        if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
  57      {
  58        
  59        $h=0;
  60        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id;
  61        $head[$h][1] = $langs->trans("Ligne");
  62        $h++;
  63  
  64        if ($user->rights->telephonie->facture->lire)
  65          {
  66            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id;
  67            $head[$h][1] = $langs->trans('Factures');
  68            $h++;
  69          }
  70        
  71        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id;
  72        $head[$h][1] = $langs->trans('Infos');
  73        $h++;
  74            
  75        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id;
  76        $head[$h][1] = $langs->trans('Historique');
  77        $h++;
  78  
  79        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id;
  80        $head[$h][1] = $langs->trans('Conso');
  81        $hselected = $h;
  82        $h++;
  83  
  84        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id;
  85        $head[$h][1] = $langs->trans('Stats');
  86        $h++;
  87            
  88        dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
  89  
  90        print_fiche_titre('Fiche Ligne', $mesg);
  91        
  92        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  93  
  94        print '<tr><td width="25%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
  95        print '<td>Facturée : '.$ligne->facturable.'</td><td>&nbsp;</td></tr>';
  96                     
  97        $client = new Societe($db, $ligne->client_id);
  98        $client->fetch($ligne->client_id);
  99  
 100        print '<tr><td width="25%">Client</td><td>';
 101  
 102        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$ligne->client_id.'">';
 103        print $client->nom.'</a></td>';
 104  
 105        $client_facture = new Societe($db);
 106        $client_facture->fetch($ligne->client_facture_id);
 107  
 108        print '<td width="25%">Client Facturé</td><td>'.$client_facture->nom.'</td></tr>';
 109  
 110  
 111        print '<tr><td width="25%">Statut</td><td colspan="3">';
 112        print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
 113        print $ligne->statuts[$ligne->statut];
 114        print '</td></tr>';
 115  
 116        $sql = "SELECT max(".$db->pdate("date").")";
 117        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";
 118        $sql .= " WHERE fk_ligne = ".$ligne->id;
 119  
 120        $resql = $db->query( $sql);
 121  
 122        if ( $resql )
 123          {
 124            $num = $db->num_rows($resql);
 125            if ( $num > 0 )
 126          {
 127            $i = 0;
 128            while ($i < $num)
 129              {
 130                $row = $db->fetch_row($resql);
 131                
 132                print '<tr><td colspan="2">Date de la dernière communication</td>';
 133                print '<td colspan="2">'.strftime("%A %d %B %Y",$row[0]).'</td>';
 134                print '</tr>';
 135                $i++;
 136              }
 137          }
 138            $db->free();
 139          }
 140        else
 141          {
 142            //print $sql;
 143          }
 144        
 145        print '<tr><td colspan="2" align="center">';
 146  
 147        print '<a href="'.DOL_URL_ROOT.'/telephonie/facture/liste.php?search_ligne='.$ligne->numero.'">liste</a><br />';
 148        print '</td><td colspan="2" align="center">';
 149  
 150        print "</td></tr></table>";
 151  
 152  
 153        $img_root = DOL_DATA_ROOT."/graph/".substr($ligne->id,-1)."/telephonie/ligne/";
 154  
 155        $file = $img_root.$ligne->id."/conso.png";
 156  
 157        if (file_exists($file)) 
 158          {
 159            print '<br><img src="'.DOL_URL_ROOT.'/telephonie/showgraph.php?graph='.$file.'" alt="Conso">';
 160          }
 161        else
 162          {
 163            print $mesg_no_graph;
 164          }
 165  
 166  
 167  
 168      }
 169      }
 170  }
 171  else
 172  {
 173    print "Error";
 174  }
 175  
 176  
 177  /* ************************************************************************** */
 178  /*                                                                            */ 
 179  /* Barre d'action                                                             */ 
 180  /*                                                                            */ 
 181  /* ************************************************************************** */
 182  
 183  
 184  $db->close();
 185  
 186  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/08 11:47:20 $ r&eacute;vision $Revision: 1.6 $</em>");
 187  ?>


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