[ 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/ -> remises.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: remises.php,v 1.4 2005/09/02 10:18:38 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/remises.php,v $
  20   *
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  $mesg = '';
  26  
  27  llxHeader("","","Historique Remises");
  28  
  29  if ($cancel == $langs->trans("Cancel"))
  30  {
  31    $action = '';
  32  }
  33  /*
  34   * Affichage
  35   *
  36   */
  37  
  38  if ($_GET["id"])
  39  {
  40    $ligne = new LigneTel($db);  
  41    $result = $ligne->fetch_by_id($_GET["id"]);  
  42  }
  43  
  44  if ($result == 1)
  45  {
  46    $client_comm = new Societe($db);
  47    $client_comm->fetch($ligne->client_comm_id, $user);
  48  }
  49  
  50  if (!$client_comm->perm_read)
  51  {
  52    print "Lecture non authorisée";
  53  }
  54  
  55  if ($result == 1 && $client_comm->perm_read)
  56  { 
  57    if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
  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        $head[$h][0] = DOL_URL_ROOT."/telephonie/ligne/remises.php?id=".$ligne->id;
  65        $head[$h][1] = $langs->trans('Discounts');
  66        $hselected=$h;
  67        $h++;
  68        
  69        dolibarr_fiche_head($head, $hselected, 'Ligne : '.$ligne->numero);
  70        
  71        print_fiche_titre('Fiche Ligne', $mesg);
  72        
  73        print '<table class="border" width="100%">';
  74  
  75        print '<tr><td width="20%">Numéro</td><td colspan="2">'.dolibarr_print_phone($ligne->numero).'</td></tr>';
  76                     
  77        $client = new Societe($db, $ligne->client_id);
  78        $client->fetch($ligne->client_id);
  79  
  80        print '<tr><td width="20%">Client</td><td colspan="2">';
  81        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$client_comm->id.'">';
  82        print $client_comm->nom.'</a></td></tr>';
  83  
  84        print '<tr><td width="20%">Statut actuel</td><td colspan="2">';
  85        print '<img src="./graph'.$ligne->statut.'.png">&nbsp;';
  86        print $ligne->statuts[$ligne->statut];
  87        print '</td></tr>';
  88  
  89        if ($ligne->user_creat)
  90      {
  91        print '<tr><td width="20%">Créé par</td><td colspan="2">';
  92  
  93        $cuser = new User($db, $ligne->user_creat);
  94        $cuser->fetch();
  95  
  96        print $cuser->fullname;
  97        print '</td></tr>';
  98      }
  99        if ($ligne->user_commande)
 100      {
 101        print '<tr><td width="20%">Commandé par</td><td colspan="2">';
 102  
 103        $couser = new User($db, $ligne->user_commande);
 104        $couser->fetch();
 105            
 106        print $couser->fullname;
 107        print '</td></tr>';
 108      }
 109  
 110        print '</table><br />';
 111        print '<table class="border" width="100%">';
 112  
 113        print '<tr class="liste_titre">';
 114        print '<td>Date</td>';
 115        print '<td align="center">'.$langs->trans("Discount").'</td>';
 116        print '<td>'.$langs->trans("Comment").'</td>';
 117        print '<td>'.$langs->trans("User").'</td>';
 118        print '</tr>';
 119  
 120        /* historique */
 121           
 122        $sql = "SELECT ".$db->pdate("r.tms").", r.remise, r.fk_user, r.comment, u.name, u.firstname";
 123        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne_remise as r";
 124        $sql .= ",".MAIN_DB_PREFIX."user as u";
 125        $sql .= " WHERE u.rowid = r.fk_user AND r.fk_ligne = ".$ligne->id;
 126        $sql .= " ORDER BY r.tms DESC ";
 127        if ( $db->query( $sql) )
 128      {
 129        $num = $db->num_rows();
 130        if ( $num > 0 )
 131          {
 132            $i = 0;
 133            while ($i < $num)
 134          {
 135            $row = $db->fetch_row($i);
 136  
 137            print '<tr><td valign="top" width="20%">'.strftime("%a %d %B %Y %H:%M:%S",$row[0]).'</td>';
 138  
 139            print '<td align="center">'.$row[1].'&nbsp;%</td>';
 140            print '<td>'.stripslashes($row[3]).'&nbsp;</td>';
 141  
 142            print '<td>'.$row[5] . " " . $row[4] . "</td></tr>";
 143            $i++;
 144          }
 145          }
 146        $db->free();
 147      }
 148        else
 149      {
 150        print $sql;
 151      }
 152        
 153        print "</table>";
 154      }
 155  }
 156  
 157  $db->close();
 158  
 159  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/02 10:18:38 $ r&eacute;vision $Revision: 1.4 $</em>");
 160  ?>


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