[ 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/rapport/ -> 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.11 2005/09/24 22:28:19 eldy Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/comm/action/rapport/index.php,v $
  22   *
  23   */
  24  
  25  /**
  26          \file       htdocs/comm/action/rapport/index.php
  27          \ingroup    commercial
  28          \brief      Page accueil des rapports des actions commerciales
  29          \version    $Revision: 1.11 $
  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  // Sécurité accés client
  37  if ($user->societe_id > 0) 
  38  {
  39    $action = '';
  40    $socid = $user->societe_id;
  41  }
  42  
  43  if ($_GET["action"] == 'pdf')
  44  {
  45    $cat = new CommActionRapport($db, $_GET["month"], $_GET["year"]);
  46    $cat->generate($_GET["id"]);
  47  }
  48  
  49  
  50  /*
  51   * Actions
  52   */
  53  if ($action=='delete_action')
  54  {
  55    $actioncomm = new ActionComm($db);
  56    $actioncomm->delete($actionid);
  57  }
  58  
  59  
  60  
  61  llxHeader();
  62  
  63  /*
  64   *  Liste
  65   */
  66  
  67  if ($page == -1) { $page = 0 ; }
  68  $limit = $conf->liste_limit;
  69  $offset = $limit * $page ;
  70  if ($sortorder == "")
  71  {
  72    $sortorder="DESC";
  73  }
  74  if ($sortfield == "")
  75  {
  76    $sortfield="a.datea";
  77  }
  78  
  79  $sql = "SELECT count(*) as cc, date_format(a.datea, '%m/%Y') as df";
  80  $sql .= ", date_format(a.datea, '%m') as month";
  81  $sql .= ", date_format(a.datea, '%Y') as year";
  82  $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a";
  83  $sql .= " GROUP BY date_format(a.datea, '%m/%Y') ";
  84  $sql .= " ORDER BY date_format(a.datea, '%Y %m') DESC";
  85  
  86  
  87  if ( $db->query($sql) )
  88  {
  89    $num = $db->num_rows();
  90    
  91    print_barre_liste("Liste des actions commerciales réalisées ou à faire", $page, "index.php",'',$sortfield,$sortorder,'',$num);
  92    
  93    $i = 0;
  94    print '<table class="noborder" width="100%">';
  95    print '<tr class="liste_titre">';
  96    print '<td>'.$langs->trans("Date").'</td>';
  97    print '<td align="center">'.$langs->trans("Nb").'</td>';
  98    print '<td>'.$langs->trans("Action").'</td>';
  99    print '<td align="center">'.$langs->trans("PDF").'</td>';
 100    print '<td align="center">'.$langs->trans("Date").'</td>';
 101    print '<td align="center">'.$langs->trans("Size").'</td>';
 102    print "</tr>\n";
 103    $var=true;
 104    while ($i < min($num,$limit))
 105      {
 106        $obj = $db->fetch_object();
 107        
 108        $var=!$var;
 109      
 110        print "<tr $bc[$var]>";
 111  
 112        print "<td>$obj->df</td>\n";
 113        print '<td align="center">'.$obj->cc.'</td>';
 114  
 115        print '<td><a href="index.php?action=pdf&amp;month='.$obj->month.'&amp;year='.$obj->year.'">'.img_file_new().'</a></td>';
 116  
 117        $name = "rapport-action-".$obj->month."-".$obj->year.".pdf";
 118        $relativepath="comm/actions/" .$name;
 119        $file = $conf->commercial->dir_output . "/comm/actions/" .$name;
 120  
 121        if (file_exists($file))
 122      {
 123        print '<td align="center"><a href="'.DOL_URL_ROOT.'/document.php?file='.urlencode($relativepath).'&modulepart=actionscomm">'.img_pdf().'</a></td>';
 124        print '<td align="center">'.strftime("%d %b %Y %H:%M:%S",filemtime($file)).'</td>';
 125        print '<td align="center">'.filesize($file). ' bytes</td>';
 126      }
 127      else {
 128         print '<td>&nbsp;</td>';  
 129         print '<td>&nbsp;</td>';  
 130         print '<td>&nbsp;</td>';  
 131       }
 132  
 133        print "</tr>\n";
 134        $i++;
 135      }
 136    print "</table>";
 137    $db->free();
 138  }
 139  else
 140  {
 141    dolibarr_print_error($db);
 142  }
 143  
 144  
 145  $db->close();
 146  
 147  llxFooter('$Date: 2005/09/24 22:28:19 $ - $Revision: 1.11 $');
 148  ?>


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