[ 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/commande/ -> 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.5 2005/06/15 14:06:01 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/ligne/commande/fiche.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  $mesg_erreur = "";
  25  
  26  $page = $_GET["page"];
  27  $sortorder = $_GET["sortorder"];
  28  $sortfield = $_GET["sortfield"];
  29  
  30  if ($user->rights->telephonie->ligne_commander)
  31  {
  32    if ($_GET["action"] == "create" && $_GET["fournid"] > 0)
  33      {
  34        $fourn = new FournisseurTelephonie($db);
  35  
  36        $result = $fourn->fetch($_GET["fournid"]);
  37  
  38        if ($result == 0)
  39      {
  40        $result = $fourn->CreateCommande($user);
  41      }      
  42      }
  43  }
  44  
  45  
  46  llxHeader("","Telephonie - Ligne - Commande");
  47  
  48  print $mesg_erreur;
  49  
  50  /*
  51   * Sécurité accés client
  52   */
  53  if ($user->societe_id > 0) 
  54  {
  55    $action = '';
  56    $socidp = $user->societe_id;
  57  }
  58  
  59  /*
  60   * Mode Liste
  61   *
  62   *
  63   *
  64   */
  65  
  66  $sql = "SELECT count(l.ligne), f.rowid, f.nom, f.commande_bloque";
  67  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
  68  $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
  69  $sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f";
  70  $sql .= ",".MAIN_DB_PREFIX."societe as sf";
  71  $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid ";
  72  $sql .= " AND l.statut IN (1,4,8) ";
  73  $sql .= " AND l.fk_soc_facture = sf.idp";
  74  $sql .= " GROUP BY f.rowid, f.nom ASC";
  75  
  76  $result = $db->query($sql);
  77  if ($result)
  78  {
  79    $num = $db->num_rows();
  80    $i = 0;
  81    
  82    print_barre_liste("Commande", $page, "liste.php", "", $sortfield, $sortorder, '', $num);
  83  
  84    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  85    print '<tr class="liste_titre"><td>Fournisseur</td>';
  86    print '<td align="center">Nb Lignes</td><td>&nbsp;</td><td>Email envoyé à</td>';
  87    print "</tr>\n";
  88  
  89    $var=True;
  90  
  91    $ligne = new LigneTel($db);
  92  
  93    while ($i < $num)
  94      {
  95        $row = $db->fetch_row();
  96        $var=!$var;
  97  
  98        $fournisseur = new FournisseurTelephonie($db);  
  99        $fournisseur->fetch($row[1]);
 100  
 101        print "<tr $bc[$var]>";
 102        print '<td>'.$row[2].'</td>';
 103        print '<td align="center">'.$row[0]."</td>\n";
 104        print '<td>';
 105        if ($row[3] == 1)
 106      {
 107        print "Les commandes sont bloquées";
 108      }
 109        else
 110      {
 111        print '<a class="tabAction" href="fiche.php?action=create&amp;fournid='.$row[1].'">Créer la commande</a>';
 112      }
 113        print "</td><td>\n";
 114        print $fournisseur->email_commande;
 115        print "</td></tr>\n";
 116        $i++;
 117      }
 118    print "</table><br />";
 119    $db->free();
 120  }
 121  else 
 122  {
 123    print $db->error() . ' ' . $sql;
 124  }
 125  
 126  /*
 127   *
 128   *
 129   */
 130  
 131  $sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid";
 132  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
 133  $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l";
 134  $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f";
 135  $sql .= " , ".MAIN_DB_PREFIX."societe as sf";
 136  $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid";
 137  $sql .= " AND l.statut IN (1,4,8) ";
 138  $sql .= " AND l.fk_soc_facture = sf.idp";
 139  $sql .= " ORDER BY s.nom ASC ";
 140  
 141  if ($db->query($sql))
 142  {
 143    $num = $db->num_rows();
 144    $i = 0;
 145    
 146    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 147    print '<tr class="liste_titre"><td valign="center">Ligne';
 148    print '</td><td align="center">Statut</td><td>Client';
 149    print '</td><td>Client Facturé</td><td align="center">Rib OK</td><td>Fournisseur</td>';
 150    print "</tr>\n";
 151  
 152    $var=True;
 153  
 154    $ligne = new LigneTel($db);
 155  
 156    while ($i < $num)
 157      {
 158        $obj = $db->fetch_object($i);    
 159        $var=!$var;
 160  
 161        $socf = new Societe($db);
 162        $socf->fetch($obj->sfidp);
 163  
 164        print "<tr $bc[$var]>";
 165        print '<td><a href="../fiche.php?id='.$obj->rowid.'">'.dolibarr_print_phone($obj->ligne)."</a></td>\n";
 166        print '<td align="center">'.$ligne->statuts[$obj->statut]."</td>\n";
 167        print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->socidp.'">'.$obj->nom.'</a></td>';
 168        print '<td><a href="'.DOL_URL_ROOT.'/soc.php?socid='.$obj->sfidp.'">'.$obj->sfnom.'</a></td>';
 169        print '<td align="center">'.$socf->verif_rib().'</a></td>';
 170        print "<td>".$obj->fournisseur."</td>\n";
 171        print "</tr>\n";
 172        $i++;
 173      }
 174    print "</table>";
 175    $db->free();
 176  }
 177  else 
 178  {
 179    print $db->error() . ' ' . $sql;
 180  }
 181  
 182  
 183  $db->close();
 184  
 185  llxFooter("<em>Derni&egrave;re modification $Date: 2005/06/15 14:06:01 $ r&eacute;vision $Revision: 1.5 $</em>");
 186  ?>


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