[ 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/fichinter/ -> rapport.php (source)

   1  <?php
   2  /* Copyright (C) 2003 Xavier DUTOIT        <doli@sydesy.com>
   3   * Copyright (C) 2004 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   *
   5   * This program is free software; you can redistribute it and/or modify
   6   * it under the terms of the GNU General Public License as published by
   7   * the Free Software Foundation; either version 2 of the License, or
   8   * (at your option) any later version.
   9   *
  10   * This program is distributed in the hope that it will be useful,
  11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13   * GNU General Public License for more details.
  14   *
  15   * You should have received a copy of the GNU General Public License
  16   * along with this program; if not, write to the Free Software
  17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18   *
  19   * $Id: rapport.php,v 1.10 2005/09/07 21:47:16 eldy Exp $ 
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/fichinter/rapport.php,v $ 
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  require_once (DOL_DOCUMENT_ROOT."/contact.class.php");
  26  
  27  if ($user->societe_id > 0)
  28  {
  29    $socid = $user->societe_id ;
  30  }
  31  
  32  llxHeader();
  33  
  34  /*
  35   * Liste
  36   *
  37   */
  38  
  39  if ($sortorder == "")
  40  {
  41    $sortorder="ASC";
  42  }
  43  if ($sortfield == "")
  44  {
  45    $sortfield="f.datei";
  46  }
  47  
  48  if ($page == -1) { $page = 0 ; }
  49  
  50  $limit = $conf->liste_limit;
  51  $offset = $limit * $page ;
  52  $pageprev = $page - 1;
  53  $pagenext = $page + 1;
  54  
  55  $sql = "SELECT s.nom,s.idp, f.note, f.ref,".$db->pdate("f.datei")." as dp, f.rowid as fichid, f.fk_statut, f.duree";
  56  $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as f ";
  57  $sql .= " WHERE f.fk_soc = s.idp";
  58  
  59  
  60  if ($socid > 0)
  61  {
  62    $sql .= " AND s.idp = " . $socid;
  63  }
  64  
  65  if (empty ($MM))
  66    $MM=strftime("%m",time());
  67  if (empty($YY))
  68    $YY=strftime("%Y",time());;
  69  echo "<div class='noprint'>";
  70  echo "\n<form action='rapport.php'>";
  71  echo "<input type='hidden' name='socid' value='$socid'>";
  72  echo $langs->trans("Month")." <input name='MM' size='2' value='$MM'>";
  73  echo " Ann&eacute;e <input size='4' name='YY' value='$YY'>";
  74  echo "<input type='submit' name='g' value='Genérer le rapport'>";
  75  echo "<form>";
  76  echo "</div>";
  77  
  78  $start="$YY-$MM-01 00:00:00";
  79  if ($MM ==12)
  80  {
  81    $y = $YY+1;
  82    $end="$y-01-01 00:00:00";
  83  }
  84  else
  85  {
  86    $m = $MM+1;
  87    $end="$YY-$m-01 00:00:00";
  88  }
  89  $sql .= " AND datei >= '$start' AND datei < '$end'" ;
  90  
  91  $sql .= " ORDER BY $sortfield $sortorder ";
  92  
  93  if ( $db->query($sql) )
  94  {
  95    $num = $db->num_rows();
  96    $title = "Rapport d'activité de " . strftime("%B %Y",strtotime ($start));
  97    print_barre_liste($title, $page, "rapport.php","&socid=$socid",$sortfield,$sortorder,'',$num);
  98  
  99    $i = 0;
 100    print '<table class="noborder" width="100%" cellspacing="0" cellpadding="3">';
 101    print "<tr class=\"liste_titre\">";
 102    print '<td>Num</td>';
 103    if (empty($socid))
 104      print '<td>Société</td>';
 105    print '<td align="center">'.$langs->trans("Description").'</td>';
 106      
 107    print '<td align="center">Date</td>';
 108    print '<td align="center">'.$langs->trans("Duration").'</td>';
 109    print "</tr>\n";
 110    $var=True;
 111    $DureeTotal = 0;
 112    while ($i < $num)
 113      {
 114        $objp = $db->fetch_object();
 115        $var=!$var;
 116        print "<tr $bc[$var]>";
 117        print "<td><a href=\"fiche.php?id=$objp->fichid\">$objp->ref</a></td>\n";
 118  
 119        if (empty($socid))
 120        {
 121      if (!empty($MM))
 122        $filter="&MM=$MM&YY=$YY";
 123          print '<td><a href="rapport.php?socid='.$objp->idp.$filter.'"><img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/filter.png" border="0"></a>&nbsp;';
 124          print "<a href=\"../comm/fiche.php?socid=$objp->idp$filter\">$objp->nom</a></TD>\n";
 125        }
 126        print '<td>'.nl2br($objp->note).'</td>';
 127        print "<td>".strftime("%d %B %Y",$objp->dp)."</td>\n";
 128        print '<td align="center">'.sprintf("%.1f",$objp->duree).'</td>';
 129        $DureeTotal += $objp->duree;
 130        print "</tr>\n";
 131        
 132        $i++;
 133      }
 134    print "</table>";
 135    $db->free();
 136    print "<br />".$langs->trans("Total")." $DureeTotal jour[s]";
 137  }
 138  else
 139  {
 140    dolibarr_print_error($db);
 141  }
 142  $db->close();
 143  
 144  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/07 21:47:16 $ r&eacute;vision $Revision: 1.10 $</em>");
 145  ?>


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