[ 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/comm/ -> commercial.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: commercial.php,v 1.8 2005/09/14 12:26:02 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/distributeurs/comm/commercial.php,v $
  20   *
  21   */
  22  require ("./pre.inc.php");
  23  
  24  if (!$user->rights->telephonie->lire) accessforbidden();
  25  
  26  if ($user->distributeur_id && $user->responsable_distributeur_id == 0)
  27  {
  28    $_GET["id"] = $user->id;
  29  }
  30  
  31  if ($user->responsable_distributeur_id > 0)
  32  {
  33    if (!in_array($_GET["id"], $user->responsable_distributeur_commerciaux))
  34      {
  35        accessforbidden();
  36      }
  37  }
  38  
  39  llxHeader('','Telephonie - Distributeur - Commercial');
  40  
  41  /*
  42   *
  43   */
  44  $h = 0;
  45  $year = strftime("%Y",time());
  46  
  47  if ($_GET["id"] && $_GET["did"])
  48  {
  49    $commercial = new User($db, $_GET["id"]);
  50    $commercial->fetch();
  51  
  52    $distri = new DistributeurTelephonie($db);
  53    $distri->fetch($_GET["did"]);
  54  
  55    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/distributeur.php?id='.$distri->id;
  56    $head[$h][1] = $distri->nom;
  57    $h++;
  58  
  59    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/commercial.php?id='.$_GET["id"].'&amp;did='.$_GET["did"];
  60    $head[$h][1] = $commercial->prenom ." ". $commercial->nom;
  61    $hselected = $h;
  62    $h++;
  63    
  64    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/comm/ca.php?id='.$commercial->id.'&amp;did='.$_GET["did"];
  65    $head[$h][1] = "Chiffre d'affaire";
  66    $h++;
  67    /*
  68    $head[$h][0] = DOL_URL_ROOT.'/telephonie/distributeurs/stats.php?id='.$distri->id;
  69    $head[$h][1] = "Statistiques";
  70    $h++;
  71    */
  72    dolibarr_fiche_head($head, $hselected, "Distributeur");
  73  
  74    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  75  
  76    print '<tr><td width="50%" valign="top">';
  77    
  78    print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
  79  
  80    print '<tr class="liste_titre">';
  81    print '<td>Date</td><td align="right">'."Prise d'ordre mensuelle</td></tr>";
  82  
  83    $sql = "SELECT ".$db->pdate("p.datepo") . " as datepo, sum(p.montant)";
  84    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_priseordre as p";
  85    $sql .= " WHERE p.fk_commercial =".$commercial->id;
  86    $sql .= " GROUP BY date_format(datepo,'%Y%m') DESC";  
  87  
  88    $resql = $db->query($sql);
  89    
  90    if ($resql)
  91      {
  92        $num = $db->num_rows($resql);
  93        $i = 0;
  94        $total = 0;
  95        
  96        while ($i < $num)
  97      {
  98        $row = $db->fetch_row($resql);    
  99        
 100        $var=!$var;
 101        
 102        print "<tr $bc[$var]>";
 103        
 104        print '<td>'.strftime("%m/%Y",$row[0]).'</td>';
 105        print '<td align="right">'.price($row[1]).' HT</td>';
 106        
 107        $i++;
 108      }
 109        $db->free($resql);
 110      }
 111    else 
 112      {
 113        print $db->error() . ' ' . $sql;
 114      }
 115    print '</table><br />';
 116  
 117    print '</td><td width="50%" valign="top">';
 118  
 119    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=commercials/'.$commercial->id.'/po.'.$year.'.mensuel.png" alt="Nouveaux clients (moy)" title="Nouveaux clients (moy)"><br /><br />'."\n";
 120  
 121    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=commercials/'.$commercial->id.'/clients.hebdomadaire.png" alt="Nouveaux clients" title="Nouveaux clients"><br /><br />'."\n";
 122  
 123    print '<img src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=telephoniegraph&file=commercials/'.$commercial->id.'/clientsmoyenne.hebdomadaire.png" alt="Nouveaux clients (moy)" title="Nouveaux clients (moy)"><br /><br />'."\n";
 124  
 125    print '</td></tr>';
 126    print '</table></div>';
 127  
 128    /* ************************************************************************** */
 129    /*                                                                            */ 
 130    /* Barre d'action                                                             */ 
 131    /*                                                                            */ 
 132    /* ************************************************************************** */
 133    print "\n<div class=\"tabsAction\">\n";
 134    
 135    if ($_GET["action"] == '' && $user->admin)
 136      {
 137        print "<a class=\"tabAction\" href=\"fiche.php?action=create_commercial&amp;distri=".$distri->id."\">".$langs->trans("Nouveau commercial")."</a>";
 138      }
 139    
 140    print "</div><br>";
 141   
 142    $db->close();
 143  }
 144  
 145  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/14 12:26:02 $ r&eacute;vision $Revision: 1.8 $</em>");
 146  ?>


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