[ 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/compta/prelevement/ -> fiche-stat.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005 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: fiche-stat.php,v 1.4 2005/09/10 14:24:10 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/prelevement/fiche-stat.php,v $
  21   */
  22  
  23  require ("./pre.inc.php");
  24  
  25  // Sécurité accés client
  26  if ($user->societe_id > 0) accessforbidden();
  27  
  28  llxHeader('','Statistique Bon de prélèvement');
  29  
  30  $h = 0;
  31  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche.php?id='.$_GET["id"];
  32  $head[$h][1] = $langs->trans("Card");
  33  $h++;      
  34  
  35  if ($conf->use_preview_tabs)
  36  {
  37      $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/bon.php?id='.$_GET["id"];
  38      $head[$h][1] = $langs->trans("Preview");
  39      $h++;  
  40  }
  41  
  42  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/lignes.php?id='.$_GET["id"];
  43  $head[$h][1] = $langs->trans("Lines");
  44  $h++;
  45  
  46  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/factures.php?id='.$_GET["id"];
  47  $head[$h][1] = $langs->trans("Bills");
  48  $h++;  
  49  
  50  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-rejet.php?id='.$_GET["id"];
  51  $head[$h][1] = $langs->trans("Rejects");
  52  $h++;  
  53  
  54  $head[$h][0] = DOL_URL_ROOT.'/compta/prelevement/fiche-stat.php?id='.$_GET["id"];
  55  $head[$h][1] = $langs->trans("Statistics");
  56  $hselected = $h;
  57  $h++;  
  58  
  59  $prev_id = $_GET["id"];
  60  
  61  if ($prev_id)
  62  {
  63    $bon = new BonPrelevement($db,"");
  64  
  65    if ($bon->fetch($_GET["id"]) == 0)
  66      {
  67        dolibarr_fiche_head($head, $hselected, 'Prélèvement : '. $bon->ref);
  68  
  69        print '<table class="border" width="100%">';
  70  
  71        print '<tr><td width="20%">Référence</td><td>'.$bon->ref.'</td></tr>';
  72  
  73        print '</table><br />';
  74      }
  75    else
  76      {
  77        print "Erreur";
  78      }
  79  
  80    /*
  81     * Stats
  82     *
  83     */
  84    $sql = "SELECT sum(pl.amount), pl.statut";
  85    $sql .= " FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl";
  86  
  87    $sql .= " WHERE pl.fk_prelevement_bons = ".$prev_id;
  88    $sql .= " GROUP BY pl.statut";
  89    
  90    if ($db->query($sql))
  91      {
  92        $num = $db->num_rows();
  93        $i = 0;
  94        
  95        print"\n<!-- debut table -->\n";
  96        print '<table class="noborder" width="100%" cellspacing="0" cellpadding="4">';
  97        print '<tr class="liste_titre">';
  98        print '<td>Statut</td><td align="right">Montant</td><td align="right">%</td></tr>';
  99        
 100        $var=True;
 101        
 102        while ($i < $num)
 103      {
 104        $row = $db->fetch_row();    
 105        
 106        print "<tr $bc[$var]><td>";
 107        
 108        if ($row[1] == 2)
 109          {
 110            print 'Crédité';
 111          }
 112        elseif ($row[1] == 3)
 113          {
 114            print 'Rejeté';
 115          }
 116        elseif ($row[1] == 1)
 117          {
 118            print 'En attente';
 119          }      
 120  
 121        print '</td><td align="right">';      
 122        print price($row[0]);      
 123  
 124        print '</td><td align="right">';      
 125        print round($row[0]/$bon->amount*100,2)." %";      
 126        print '</td>';
 127  
 128        print "</tr>\n";
 129        
 130        $var=!$var;
 131        $i++;
 132      }
 133        
 134        print "</table>";
 135        $db->free();
 136      }
 137    else 
 138      {
 139        print $db->error() . ' ' . $sql;
 140      }  
 141  }
 142  
 143  $db->close();
 144  
 145  llxFooter("<em>Derni&egrave;re modification $Date: 2005/09/10 14:24:10 $ r&eacute;vision $Revision: 1.4 $</em>");
 146  ?>


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