[ 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/ -> history.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: history.php,v 1.9 2005/10/20 14:04:17 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/history.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  $mesg = '';
  26  
  27  llxHeader("","","Historique Ligne");
  28  
  29  /*
  30   * Affichage
  31   *
  32   */
  33  
  34    if ($_GET["id"] or $_GET["numero"])
  35      {
  36        if ($_GET["action"] <> 're-edit')
  37      {
  38        $ligne = new LigneTel($db);
  39        if ($_GET["id"])
  40          {
  41            $result = $ligne->fetch_by_id($_GET["id"]);
  42          }
  43        if ($_GET["numero"])
  44          {
  45            $result = $ligne->fetch($_GET["numero"]);
  46          }
  47      }
  48  
  49  
  50        if ($result == 1)
  51      {
  52        $client_comm = new Societe($db);
  53        $client_comm->fetch($ligne->client_comm_id, $user);
  54      }
  55  
  56        if (!$client_comm->perm_read)
  57      {
  58        print "Lecture non authorisée";
  59      }
  60  
  61  
  62        if ($result == 1 && $client_comm->perm_read)
  63      { 
  64        if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
  65          {
  66  
  67            $h=0;
  68            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/fiche.php?id=".$ligne->id;
  69            $head[$h][1] = $langs->trans("Ligne");
  70            $h++;
  71  
  72            if ($user->rights->telephonie->facture->lire)
  73          {
  74            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/factures.php?id=".$ligne->id;
  75            $head[$h][1] = $langs->trans('Factures');
  76            $h++;
  77          }
  78  
  79            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/infoc.php?id=".$ligne->id;
  80            $head[$h][1] = $langs->trans('Infos');
  81            $h++;
  82  
  83            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/history.php?id=".$ligne->id;
  84            $head[$h][1] = $langs->trans('Historique');
  85            $hselected = $h;
  86            $h++;
  87  
  88            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/conso.php?id=".$ligne->id;
  89            $head[$h][1] = $langs->trans('Conso');
  90            $h++;
  91            
  92            $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/stat.php?id=".$ligne->id;
  93            $head[$h][1] = $langs->trans('Stats');
  94            $h++;
  95  
  96            dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
  97  
  98            print_fiche_titre('Fiche Ligne', $mesg);
  99        
 100            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 101  
 102            print '<tr><td width="20%">Numéro</td><td colspan="3">'.dolibarr_print_phone($ligne->numero).'</td></tr>';
 103                     
 104            $client = new Societe($db, $ligne->client_id);
 105            $client->fetch($ligne->client_id);
 106  
 107            print '<tr><td width="20%">Client</td><td colspan="3">';
 108            print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';
 109            print $client_comm->nom.'</a></td></tr>';
 110  
 111            print '<tr><td width="20%">Statut actuel</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            if ($ligne->user_creat)
 117          {
 118            print '<tr><td width="20%">Créé par</td><td colspan="3">';
 119  
 120            $cuser = new User($db, $ligne->user_creat);
 121            $cuser->fetch();
 122  
 123            print $cuser->fullname;
 124            print '</td></tr>';
 125          }
 126            if ($ligne->user_commande)
 127          {
 128            print '<tr><td width="20%">Commandé par</td><td colspan="3">';
 129  
 130            $couser = new User($db, $ligne->user_commande);
 131            $couser->fetch();
 132            
 133            print $couser->fullname;
 134            print '</td></tr>';
 135          }
 136  
 137            print '<tr class="liste_titre">';
 138            print '<td>Date</td>';
 139            print '<td>Statut</td>';
 140            print '<td>Fournisseur</td>';
 141            print '<td>Rapporteur</td>';
 142            print '</tr>';
 143  
 144            /* historique */
 145            $ff = array();     
 146            $sql = "SELECT rowid, nom FROM ".MAIN_DB_PREFIX."telephonie_fournisseur";
 147            $sql .= "  WHERE commande_active = 1 ORDER BY nom ";
 148  
 149            $resql = $db->query($sql);
 150            if ($resql)
 151          {
 152            $num = $db->num_rows($resql);
 153            if ( $num > 0 )
 154              {
 155                $i = 0;
 156                while ($i < $num)
 157              {
 158                $row = $db->fetch_row($resql);
 159                $ff[$row[0]] = $row[1];
 160                $i++;
 161              }
 162              }
 163            $db->free($resql);
 164          }
 165  
 166            $sql = "SELECT ".$db->pdate("l.tms").", l.statut, l.fk_user";
 167            $sql .= ", u.name, u.firstname, l.comment, l.fk_fournisseur";
 168            $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_statut as l";
 169            $sql .= ",".MAIN_DB_PREFIX."user as u";
 170            $sql .= " WHERE u.rowid = l.fk_user AND l.fk_ligne = ".$ligne->id;
 171            $sql .= " ORDER BY l.tms DESC ";
 172            $resql =  $db->query($sql);
 173            if ($resql)
 174          {
 175            $num = $db->num_rows($resql);
 176            if ( $num > 0 )
 177              {
 178                $i = 0;
 179                while ($i < $num)
 180              {
 181                $row = $db->fetch_row($resql);
 182  
 183                print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>';
 184                print '<td><img src="./graph'.$row[1].'.png">&nbsp;';
 185                print $ligne->statuts[$row[1]];
 186                if ($row[5])
 187                  {
 188                    print '<br />'.$row[5];
 189                  }
 190  
 191                print '</td><td>('.$row[6].') '.$ff[$row[6]];
 192                print '</td><td>'.$row[4] . " " . $row[3] . "</td></tr>";
 193                $i++;
 194              }
 195              }
 196            $db->free($resql);
 197          }
 198            else
 199          {
 200            print $sql;
 201          }
 202        
 203            print "</table>";
 204          }
 205  
 206        /*
 207         *
 208         */
 209        print '<br />';
 210        print_titre("Retours Fournisseurs");
 211        $sql = "SELECT ";
 212        $sql .= " cli,mode,situation,date_mise_service,date_resiliation,motif_resiliation,commentaire,fichier, traite ";
 213        $sql .= ",".$db->pdate("date_traitement")." as dt, fk_fournisseur";
 214        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_commande_retour";
 215        $sql .= " WHERE cli = ".$ligne->numero;
 216        $sql .= " ORDER BY rowid DESC " . $db->plimit($conf->liste_limit+1, $offset);
 217        
 218        $resql = $db->query($sql);
 219        if ($resql)
 220          {
 221            print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
 222            print '<tr class="liste_titre"><td>Mode</td><td>Resultat</td>';
 223            print '<td align="center">Date MeS</td><td>Résil</td></td><td>Commentaire</td><td align="center">D.T. / Fichier</td>';
 224            print "</tr>\n";
 225            $var=True;
 226            
 227            while ($obj = $db->fetch_object($resql))
 228          {
 229            $var=!$var;
 230            
 231            print "<tr $bc[$var]>";
 232            print '<td>('.$obj->fk_fournisseur.") ".$obj->mode."</td>\n";
 233            print '<td>'.$obj->situation."</td>\n";
 234            print '<td align="center">'.$obj->date_mise_service."</td>\n";
 235            print '<td align="center">'.$obj->date_resiliation."</td>\n";
 236            print '<td>'.$obj->commentaire."</td>\n";
 237            if ($obj->fichier)
 238              {
 239                print '<td align="center">'.$obj->fichier."</td>\n";
 240              }
 241            else
 242              {
 243                print '<td align="center">'.strftime("%d/%m/%y %H:%M",$obj->dt)."</td>\n";
 244              }
 245            print "</tr>\n";
 246          }
 247            print "</table>";
 248            $db->free($resql);
 249          }
 250        else 
 251          {
 252            print $db->error() . ' ' . $sql;
 253          }
 254        
 255        /*
 256         *
 257         *
 258         *
 259         */
 260      }
 261      }
 262  else
 263  {
 264    print "Error";
 265  }
 266  
 267  
 268  $db->close();
 269  
 270  llxFooter("<em>Derni&egrave;re modification $Date: 2005/10/20 14:04:17 $ r&eacute;vision $Revision: 1.9 $</em>");
 271  ?>


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