[ 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/comm/action/ -> index.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2003      Éric Seigne          <erics@rycks.com>
   4   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   5   *
   6   * This program is free software; you can redistribute it and/or modify
   7   * it under the terms of the GNU General Public License as published by
   8   * the Free Software Foundation; either version 2 of the License, or
   9   * (at your option) any later version.
  10   *
  11   * This program is distributed in the hope that it will be useful,
  12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14   * GNU General Public License for more details.
  15   *
  16   * You should have received a copy of the GNU General Public License
  17   * along with this program; if not, write to the Free Software
  18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19   *
  20   * $Id: index.php,v 1.34 2005/09/24 22:28:19 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/action/index.php,v $
  22   *
  23   */
  24  
  25  /**
  26          \file       htdocs/comm/action/index.php
  27          \ingroup    commercial
  28          \brief      Page accueil des actions commerciales
  29          \version    $Revision: 1.34 $
  30  */
  31   
  32  require_once ("./pre.inc.php");
  33  require_once (DOL_DOCUMENT_ROOT."/contact.class.php");
  34  require_once (DOL_DOCUMENT_ROOT."/actioncomm.class.php");
  35  
  36  $langs->load("companies");
  37  
  38  
  39  // Sécurité accés client
  40  if ($user->societe_id > 0) 
  41  {
  42    $action = '';
  43    $socid = $user->societe_id;
  44  }
  45  
  46  
  47  $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"];
  48  $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"];
  49  $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"];
  50  
  51  if ($page == -1) { $page = 0 ; }
  52  $limit = $conf->liste_limit;
  53  $offset = $limit * $page ;
  54  if (! $sortorder) $sortorder="DESC";
  55  if (! $sortfield) $sortfield="a.datea";
  56  
  57  $status=isset($_GET["status"])?$_GET["status"]:$_POST["status"];
  58  
  59  
  60  llxHeader();
  61  
  62  /*
  63   *  Affichage liste des actions
  64   *
  65   */
  66  
  67  $sql = "SELECT s.nom as societe, s.idp as socidp, s.client,";
  68  $sql.= " a.id,".$db->pdate("a.datea")." as da, a.fk_contact, a.note, a.percent as percent,";
  69  $sql.= " c.code as acode, c.libelle, u.code, u.rowid as userid";
  70  $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u";
  71  $sql.= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid";
  72  if ($_GET["type"])
  73  {
  74    $sql .= " AND c.id = ".$_GET["type"];
  75  }
  76  if ($_GET["time"] == "today")
  77  {
  78    $sql .= " AND date_format(a.datea, '%d%m%Y') = ".strftime("%d%m%Y",time());
  79  }
  80  if ($socid) 
  81  {
  82    $sql .= " AND s.idp = $socid";
  83  }
  84  if ($status == 'done') { $sql.= " AND a.percent = 100"; }
  85  if ($status == 'todo') { $sql.= " AND a.percent < 100"; }
  86  $sql .= " ORDER BY $sortfield $sortorder";
  87  $sql .= $db->plimit( $limit + 1, $offset);
  88    
  89  $resql=$db->query($sql);
  90  if ($resql)
  91  {
  92      $num = $db->num_rows($resql);
  93      $title="DoneAndToDoActions";
  94      if ($status == 'done') $title="DoneActions";
  95      if ($status == 'todo') $title="ToDoActions";
  96  
  97      if ($socid)
  98      {
  99          $societe = new Societe($db);
 100          $societe->fetch($socid);
 101  
 102          print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",'',$sortfield,$sortorder,'',$num);
 103      }
 104      else
 105      {
 106          print_barre_liste($langs->trans($title), $page, "index.php",'',$sortfield,$sortorder,'',$num);
 107      }
 108      $i = 0;
 109      print "<table class=\"noborder\" width=\"100%\">";
 110      print '<tr class="liste_titre">';
 111      print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"a.datea","&status=$status",'','colspan="4"',$sortfield);
 112      print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent","&status=$status","","",$sortfield);
 113      print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"acode","&status=$status","","",$sortfield);
 114      print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","&status=$status","","",$sortfield);
 115      print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact","&status=$status","","",$sortfield);
 116      print '<td>'.$langs->trans("Comments").'</td>';
 117      print_liste_field_titre($langs->trans("Author"),$_SERVER["PHP_SELF"],"u.code","&status=$status","","",$sortfield);
 118      print "</tr>\n";
 119      $var=true;
 120      while ($i < min($num,$limit))
 121      {
 122          $obj = $db->fetch_object($resql);
 123  
 124          $var=!$var;
 125  
 126          print "<tr $bc[$var]>";
 127  
 128          if ($oldyear == strftime("%Y",$obj->da) )
 129          {
 130              print '<td>&nbsp;</td>';
 131          }
 132          else
 133          {
 134              print "<td width=\"30\">" .strftime("%Y",$obj->da)."</td>\n";
 135              $oldyear = strftime("%Y",$obj->da);
 136          }
 137  
 138          if ($oldmonth == strftime("%Y%b",$obj->da) )
 139          {
 140              print '<td width=\"20\">&nbsp;</td>';
 141          }
 142          else
 143          {
 144              print "<td width=\"20\">" .strftime("%b",$obj->da)."</td>\n";
 145              $oldmonth = strftime("%Y%b",$obj->da);
 146          }
 147  
 148          print "<td width=\"20\">" .strftime("%d",$obj->da)."</td>\n";
 149          print "<td width=\"30\">" .strftime("%H:%M",$obj->da)."</td>\n";
 150  
 151          // Status/Percent
 152          if ($obj->percent < 100) {
 153              print "<td align=\"center\">".$obj->percent."%</td>";
 154          }
 155          else {
 156              print "<td align=\"center\">".$langs->trans("Done")."</td>";
 157          }
 158  
 159          // Action
 160          print '<td><a href="'.DOL_URL_ROOT.'/comm/action/fiche.php?id='.$obj->id.'">'.img_object($langs->trans("ShowTask"),"task").' ';
 161          $transcode=$langs->trans("Action".$obj->acode);
 162          $libelle=($transcode!="Action".$obj->acode?$transcode:$obj->libelle);
 163          print dolibarr_trunc($libelle,16);
 164          print '</a></td>';
 165  
 166          // Société
 167          print '<td>';
 168          if ($obj->client == 1) $url=DOL_URL_ROOT.'/comm/fiche.php?socid=';
 169          elseif ($obj->client == 2) $url=DOL_URL_ROOT.'/comm/prospect/fiche.php?id=';
 170          else $url=DOL_URL_ROOT.'/soc.php?socid=';
 171          print '&nbsp;<a href="'.$url.$obj->socidp.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->societe,32).'</a></td>';
 172  
 173          // Contact
 174          print '<td>';
 175          if ($obj->fk_contact)
 176          {
 177              $cont = new Contact($db);
 178              $cont->fetch($obj->fk_contact);
 179              print '<a href="'.DOL_URL_ROOT.'/contact/fiche.php?id='.$cont->id.'">'.img_object($langs->trans("ShowContact"),"contact").' '.dolibarr_trunc($cont->fullname,32).'</a>';
 180          }
 181          else
 182          {
 183              print "&nbsp;";
 184          }
 185          print '</td>';
 186  
 187          // Note
 188          print '<td>'.dolibarr_trunc($obj->note, 16).'</td>';
 189  
 190          // Auteur
 191          print '<td align="center"><a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->userid.'">'.img_object($langs->trans("ShowUser"),'user').' '.$obj->code.'</a></td>';
 192  
 193          print "</tr>\n";
 194          $i++;
 195      }
 196      print "</table>";
 197      $db->free($resql);
 198  
 199  }
 200  else
 201  {
 202      dolibarr_print_error($db);
 203  }
 204  
 205  
 206  $db->close();
 207  
 208  llxFooter('$Date: 2005/09/24 22:28:19 $ - $Revision: 1.34 $');
 209  ?>


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