[ 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/ -> lignes.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: lignes.php,v 1.8 2005/11/22 15:57:03 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/client/lignes.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        if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
  51      {
  52        $h=0;
  53  
  54        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/fiche.php?id=".$soc->id;
  55        $head[$h][1] = $langs->trans("Contrats");
  56        $hselected = $h;
  57        $h++;
  58  
  59        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/lignes.php?id=".$soc->id;
  60        $head[$h][1] = $langs->trans("Lignes");
  61        $hselected = $h;
  62        $h++;
  63  
  64        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/factures.php?id=".$soc->id;
  65        $head[$h][1] = $langs->trans("Factures");
  66        $h++;
  67  
  68        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/stats.php?id=".$soc->id;
  69        $head[$h][1] = $langs->trans("Stats");
  70        $h++;
  71  
  72        $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."telephonie_tarif_client";
  73        $sql .= " WHERE fk_client = '".$soc->id."';";
  74        $resql = $db->query($sql);
  75  
  76        if ($resql)
  77          {
  78            $row = $db->fetch_row($resql);
  79            $db->free($resql);
  80          }
  81  
  82        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/tarifs.php?id=".$soc->id;
  83        $head[$h][1] = $langs->trans("Tarifs (".$row[0].")");           
  84        $h++;
  85  
  86        $head[$h][0] = DOL_URL_ROOT."/telephonie/client/commentaires.php?id=".$soc->id;
  87        $head[$h][1] = $langs->trans("Commentaires");
  88        $num_comments = $soc->count_comment();
  89        if ($num_comments > 0)
  90          {
  91            $head[$h][1] = $langs->trans("Commentaires ($num_comments)");
  92          }
  93        $h++;
  94  
  95  
  96        dolibarr_fiche_head($head, $hselected, 'Client : '.$soc->nom);
  97  
  98        print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
  99        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>';
 100  
 101        
 102        print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($soc->adresse)."<br>".$soc->cp." ".$soc->ville." ".$soc->pays."</td></tr>";
 103        
 104        print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dolibarr_print_phone($soc->tel).'</td>';
 105        print '<td>'.$langs->trans('Fax').'</td><td>'.dolibarr_print_phone($soc->fax).'</td></tr>';
 106                    
 107        print '</table><br />';
 108  
 109        print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 110        
 111        //print '<tr><td width="20%">Numéro</td><td>'.dolibarr_print_phone($ligne->numero).'</td>';
 112        //print '<td>Facturée : '.$ligne->facturable.'</td></tr>';
 113        
 114        /* Lignes */
 115           
 116        $sql = "SELECT s.idp as socidp, f.nom as fournisseur, s.nom";
 117        $sql .= ", ss.nom as agence, ss.ville, ss.code_client";
 118        $sql .= " , l.ligne,  l.statut, l.rowid, l.remise";
 119        $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 120        $sql .= " , ".MAIN_DB_PREFIX."societe as ss";
 121        $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
 122        $sql .= " WHERE l.fk_client_comm = s.idp AND l.fk_fournisseur = f.rowid";
 123        $sql .= " AND l.fk_soc = ss.idp ";
 124        $sql .= " AND s.idp = ".$soc->id;
 125        $sql .= " ORDER BY ss.idp ASC";
 126  
 127        $resql =  $db->query($sql);
 128        
 129        if ($resql)
 130          {
 131            $num = $db->num_rows($resql);
 132            if ( $num > 0 )
 133          {
 134            $i = 0;
 135  
 136            $ligne = new LigneTel($db);
 137  
 138            print '<tr class="liste_titre"><td width="15%" valign="center">Ligne';
 139            print '</td><td colspan="3">Agence/Filiale</td>';
 140            print '<td align="center">Remise LMN</td>';
 141            print '<td>Fournisseur</td>';
 142  
 143            print "</tr>\n";
 144  
 145            while ($i < $num)
 146              {
 147                $obj = $db->fetch_object($resql);
 148                $var=!$var;
 149  
 150                print "<tr $bc[$var]><td>";
 151  
 152                print '<img src="../graph'.$obj->statut.'.png">&nbsp;';
 153        
 154                print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">';
 155                print img_file();
 156        
 157                print '</a>&nbsp;';
 158  
 159                print '<a href="'.DOL_URL_ROOT.'/telephonie/ligne/fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n";
 160  
 161                print '<td>'.$obj->code_client."</td>\n";
 162                print '<td>'.$obj->agence."</td>\n";
 163                print '<td>'.$obj->ville."</td>\n";
 164  
 165                print '<td align="center">'.$obj->remise." %</td>\n";
 166                print "<td>".$obj->fournisseur."</td>\n";
 167                print "</tr>\n";
 168                $i++;
 169              }
 170          }
 171            $db->free($resql);
 172            
 173          }
 174        else
 175          {
 176            print $sql;
 177          }
 178        
 179        print "</table>";
 180      }
 181      }
 182  }
 183  else
 184  {
 185    print "Error";
 186  }
 187  
 188  
 189  print '</div>';
 190  
 191  /* ************************************************************************** */
 192  /*                                                                            */ 
 193  /* Barre d'action                                                             */ 
 194  /*                                                                            */ 
 195  /* ************************************************************************** */
 196  
 197  $db->close();
 198  
 199  llxFooter("<em>Derni&egrave;re modification $Date: 2005/11/22 15:57:03 $ r&eacute;vision $Revision: 1.8 $</em>");
 200  ?>


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