[ 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/distributeurs/ -> po.php (source)

   1  <?PHP
   2  /* Copyright (C) 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: po.php,v 1.14 2005/12/07 10:51:27 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/distributeurs/po.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if ($user->distributeur_id && $user->responsable_distributeur_id == 0)
  25  {
  26    accessforbidden();
  27  }
  28  
  29  if ($user->distributeur_id)
  30  {
  31    $_GET["id"] = $user->distributeur_id;
  32  }
  33  
  34  llxHeader();
  35  
  36  $page = $_GET["page"];
  37  $sortorder = $_GET["sortorder"];
  38  $sortfield = $_GET["sortfield"];
  39  if ($sortorder == "") $sortorder="DESC";
  40  if ($sortfield == "") $sortfield="p.datepo";
  41  
  42  /*
  43   *
  44   *
  45   */
  46  
  47  if ($_GET["id"])
  48  {
  49    $h = 0;
  50    $distri = new DistributeurTelephonie($db);
  51    $distri->fetch($_GET["id"]);
  52  
  53    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id;
  54    $head[$h][1] = $distri->nom;
  55    $h++;
  56  
  57    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/contrat.php?id='.$distri->id;
  58    $head[$h][1] = "Contrat";
  59    $h++;
  60  
  61    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/remuneration.php?id='.$distri->id;
  62    $head[$h][1] = "Rémunérations";
  63    $h++;
  64  
  65    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/po.php?id='.$distri->id;
  66    $head[$h][1] = "Prises d'ordre";
  67    $hselected = $h;
  68    $h++;
  69    
  70    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id;
  71    $head[$h][1] = "Statistiques";
  72    $h++;
  73  
  74    dolibarr_fiche_head($head, $hselected, "Distributeur");
  75    
  76    if ($page == -1) { $page = 0 ; }
  77  
  78    $offset = $conf->liste_limit * $page ;
  79    $pageprev = $page - 1;
  80    $pagenext = $page + 1;
  81    
  82    /*
  83     * Mode Liste
  84     *
  85     */
  86    
  87    $sql = "SELECT s.idp, s.nom, p.fk_contrat, p.montant, p.avance_duree, p.avance_pourcent";
  88    $sql .= ", p.rem_pour_prev, p.rem_pour_autr, p.mode_paiement";
  89    $sql .= " , ".$db->pdate("p.datepo") . " as datepo";
  90    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";
  91    $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c";
  92    $sql .= " , ".MAIN_DB_PREFIX."societe as s";
  93    
  94    $sql .= " WHERE p.fk_distributeur =".$distri->id;
  95    $sql .= " AND c.fk_soc = s.idp";
  96    $sql .= " AND p.fk_contrat = c.rowid";
  97    $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
  98    
  99    $resql = $db->query($sql);
 100    if ($resql)
 101      {
 102        $num = $db->num_rows($resql);
 103        $i = 0;
 104        
 105        print_barre_liste("Prises d'ordre", $page, "po.php", "", $sortfield, $sortorder, '', $num);
 106        
 107        print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
 108        print '<tr class="liste_titre">';
 109        print_liste_field_titre("Client","po.php","s.nom","","&amp;id=".$_GET["id"]);
 110        print_liste_field_titre("Contrat","po.php","p.fk_contrat","","&amp;id=".$_GET["id"]);
 111        print '<td align="center">Date</td>';
 112        print '<td align="right">Montant</td>';
 113        print '<td align="center">Avance Durée</td><td align="center">Avance %</td>';
 114        print '<td align="center">Rem %</td><td align="center">MdP</td>';
 115        print "</tr>\n";
 116        
 117        $var=True;
 118        
 119        while ($i < min($num,$conf->liste_limit))
 120      {
 121        $obj = $db->fetch_object($resql);
 122        $var=!$var;
 123        
 124        print "<tr $bc[$var]>";
 125        
 126        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">';
 127        print img_file();
 128        print '</a>&nbsp;';
 129        
 130        print '<a href="'.DOL_URL_ROOT.'/telephonie/client/fiche.php?id='.$obj->idp.'">'.$obj->nom."</a></td>\n";
 131        print '<td><a href="'.DOL_URL_ROOT.'/telephonie/contrat/fiche.php?id='.$obj->fk_contrat.'">'.$obj->fk_contrat."</a></td>\n";
 132        print '<td align="center">'.strftime("%e %b %Y",$obj->datepo)."</td>\n";
 133  
 134        print '<td align="right">'.sprintf("%01.2f",$obj->montant)."</td>\n";
 135        
 136        print '<td align="center">'.$obj->avance_duree."</td>\n";
 137        print '<td align="center">'.$obj->avance_pourcent." %</td>\n";
 138        if ($obj->mode_paiement == 'pre')
 139          {
 140            print '<td align="center">'.$obj->rem_pour_prev." %</td>\n";
 141            print '<td align="center">Prelev</td>';
 142          }
 143        else
 144          {
 145            print '<td align="center">'.$obj->rem_pour_autr." %</td>\n";
 146            print '<td align="center">Autre</td>';
 147          }
 148  
 149  
 150        print "</tr>\n";
 151        $i++;
 152      }
 153        print "</table>";
 154        $db->free();
 155      }
 156    else 
 157      {
 158        print $db->error() . ' ' . $sql;
 159      }
 160    
 161  }
 162  
 163  $db->close();
 164  
 165  llxFooter("<em>Derni&egrave;re modification $Date: 2005/12/07 10:51:27 $ r&eacute;vision $Revision: 1.14 $</em>");
 166  ?>


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