[ 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/client/ -> fiche.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: fiche.php,v 1.14 2005/11/23 15:53:09 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/fiche.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  $mesg = '';
  26  
  27  llxHeader("","","Fiche client");
  28  
  29  if ($cancel == $langs->trans("Cancel"))
  30  {
  31    $action = '';
  32  }
  33  /*
  34   * Affichage
  35   *
  36   */
  37  
  38  if ($_GET["id"])
  39  {
  40    $soc = new TelephonieClient($db);
  41    $result = $soc->fetch($_GET["id"], $user);
  42  
  43    if (!$soc->perm_read)
  44      {
  45        print "Lecture non authorisée";
  46      }
  47  
  48    if ( $result == 1 && $soc->perm_read)
  49      { 
  50        $soc->log_consult($user,'r');
  51  
  52  
  53        if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
  54      {
  55        /* Commentaires */
  56        $sql = "SELECT c.commentaire, ".$db->pdate("c.datec") ." as datec";
  57        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c";
  58        $sql .= " WHERE fk_soc = ".$soc->id;
  59        $sql .= " ORDER BY c.datec DESC";
  60        $resql = $db->query($sql);
  61        
  62        if ($resql)
  63          {
  64            $num_comments = $db->num_rows($resql);
  65            $db->free($resql);
  66          }
  67        /* Fin Commentaires */
  68  
  69        $h=0;
  70        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id;
  71        $head[$h][1] = $langs->trans("Contrats");
  72        $hselected = $h;
  73        $h++;
  74  
  75        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id;
  76        $head[$h][1] = $langs->trans("Lignes");
  77        $h++;
  78  
  79        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id;
  80        $head[$h][1] = $langs->trans("Factures");
  81        $h++;
  82  
  83        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id;
  84        $head[$h][1] = $langs->trans("Stats");
  85        $h++;
  86  
  87        $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client";
  88        $sql .= " WHERE fk_client = '".$soc->id."';";
  89        $resql = $db->query($sql);
  90  
  91        if ($resql)
  92          {
  93            $row = $db->fetch_row($resql);
  94            $db->free($resql);
  95          }
  96  
  97        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id;
  98        $head[$h][1] = $langs->trans("Tarifs (".$row[0].")");
  99        $h++;
 100  
 101        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id;
 102        $head[$h][1] = $langs->trans("Commentaires");
 103        if ($num_comments > 0)
 104          {
 105            $head[$h][1] = $langs->trans("Commentaires ($num_comments)");
 106          }
 107        $h++;
 108  
 109        if ($soc->perm_perms)
 110          {
 111            $head[$h][0] = DOL_URL_ROOT."/telephonie/client/permissions.php?id=".$soc->id;
 112            $head[$h][1] = $langs->trans("Permissions");
 113            $h++;
 114          }
 115  
 116        dolibarr_fiche_head($head, $hselected, 'Client : '.$soc->nom);
 117  
 118        print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
 119        print '<tr><td width="20%">'.$langs->trans('Name').'</td><td>'.$soc->nom.'</td><td>'.$langs->trans('Code client').'</td><td>'.$soc->code_client.'</td></tr>';
 120        
 121        print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."<br>".$soc->cp." ".$soc->ville." ".$soc->pays."</td></tr>";
 122        
 123        print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel).'</td>';
 124        print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax).'</td></tr>';
 125              
 126        print '<tr><td><a href="'.DOL_URL_ROOT.'/societe/rib.php?socid='.$soc->id.'">'.img_edit() ."</a>&nbsp;";
 127        print $langs->trans('RIB').'</td><td colspan="3">';
 128        print $soc->display_rib();
 129        print '</td></tr>';
 130        
 131        print '</table><br />';
 132  
 133        /* Commentaires */
 134        $sql = "SELECT c.commentaire";
 135        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_commentaire as c";
 136        $sql .= " WHERE c.fk_soc = ".$soc->id;
 137        $sql .= " ORDER BY c.datec DESC LIMIT 2";      
 138        $resql = $db->query($sql);
 139        if ($resql)
 140          {
 141            $num = $db->num_rows($resql);
 142            if ($num > 0)
 143          {
 144            print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 145            print '<tr class="liste_titre"><td>2 Derniers commentaires</td></tr>';          
 146            while ($obj = $db->fetch_object($resql))
 147              {
 148                $var=!$var;
 149                print "<tr $bc[$var]><td>";
 150                print stripslashes($obj->commentaire)."</td>\n";
 151                print "</tr>\n";
 152              }
 153            print "</table><br />";
 154          }
 155            $db->free($resql);
 156          }
 157        else 
 158          {
 159            print $db->error() . ' ' . $sql;
 160          }
 161        
 162        
 163        /* Contrats */
 164        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';         
 165        $sql = "SELECT count(l.rowid) as cc, c.rowid, c.ref, c.statut";
 166        $sql .= ", ss.nom as agence, ss.code_client, ss.ville";
 167        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 168        $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c";
 169        $sql .= " , ".MAIN_DB_PREFIX."societe as ss";
 170        $sql .= " WHERE c.fk_client_comm = ".$soc->id;
 171        $sql .= " AND c.fk_soc = ss.idp ";
 172        $sql .= " AND l.fk_contrat = c.rowid";
 173        $sql .= " GROUP BY c.rowid";
 174        $sql .= " ORDER BY ss.idp ASC";
 175        
 176        $resql = $db->query($sql);
 177  
 178        if ($resql)
 179          {
 180            $num = $db->num_rows($resql);
 181            if ( $num > 0 )
 182          {
 183            $i = 0;
 184  
 185            $ligne = new LigneTel($db);
 186  
 187            print '<tr class="liste_titre"><td width="15%" valign="center">Contrat';
 188            print '</td><td colspan="3">Agence/Filiale</td><td align="center">Nb Lignes</td>';
 189            print "</tr>\n";
 190  
 191            while ($i < $num)
 192              {
 193                $obj = $db->fetch_object($resql);
 194                $var=!$var;
 195  
 196                print "<tr $bc[$var]><td>";
 197  
 198                print '<img src="../contrat/statut'.$obj->statut.'.png">&nbsp;';
 199  
 200                print '<a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$obj->rowid.'">';
 201                print img_file();
 202        
 203                print '</a>&nbsp;';
 204  
 205                print '<a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$obj->rowid.'">'.$obj->ref."</a></td>\n";
 206  
 207                print '<td>'.$obj->code_client."</td>\n";
 208                print '<td>'.$obj->agence."</td>\n";
 209                print '<td>'.$obj->ville."</td>\n";
 210                print '<td align="center">'.$obj->cc."</td>\n";
 211                print "</tr>\n";
 212                $i++;
 213              }
 214          }
 215            $db->free($resql);
 216            
 217          }
 218        else
 219          {
 220            print $sql;
 221          }
 222        
 223        print "</table>";
 224      }
 225      }
 226  }
 227  else
 228  {
 229    print "Error";
 230  }
 231  print '</div>';
 232  print '<div id="version">$Revision: 1.14 $</div>';
 233  /* ************************************************************************** */
 234  /*                                                                            */ 
 235  /* Barre d'action                                                             */ 
 236  /*                                                                            */ 
 237  /* ************************************************************************** */
 238  
 239  $db->close();
 240  
 241  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/23 15:53:09 $ r&eacute;vision $Revision: 1.14 $</em>");
 242  ?>


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