[ 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/bank/ -> bilan.php (source)

   1  <?php
   2  /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   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: bilan.php,v 1.12 2005/05/07 21:56:12 eldy Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/bank/bilan.php,v $
  21   *
  22   */
  23  
  24  require ("./pre.inc.php");
  25  
  26  if (!$user->rights->banque->lire)
  27    accessforbidden();
  28  
  29  llxHeader();
  30  
  31  function valeur($sql)
  32  {
  33    global $db;
  34    if ( $db->query($sql) )
  35      {
  36        if ( $db->num_rows() )
  37      {
  38        $valeur = $db->result(0,0);
  39      }
  40        $db->free();
  41      }
  42    return $valeur;
  43  }
  44  
  45  
  46  print_titre("Bilan");
  47  print '<br>';
  48  
  49  print '<table class="noborder" width="100%" cellspacing="0" cellpadding="2">';
  50  print "<tr class=\"liste_titre\">";
  51  echo '<td colspan="2">Résumé</td>';
  52  print "</tr>\n";
  53  
  54  $var=!$var;
  55  $sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."paiement";
  56  $paiem = valeur($sql);
  57  print "<tr $bc[$var]><td>Somme des paiements (associés à une facture)</td><td align=\"right\">".price($paiem)."</td></tr>";
  58  
  59  $var=!$var;
  60  $sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE amount > 0";
  61  $credits = valeur($sql);
  62  print "<tr $bc[$var]><td>Somme des credits</td><td align=\"right\">".price($credits)."</td></tr>";
  63  
  64  $var=!$var;
  65  $sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank WHERE amount < 0";
  66  $debits = valeur($sql);
  67  print "<tr $bc[$var]><td>Somme des debits</td><td align=\"right\">".price($debits)."</td></tr>";
  68  
  69  $var=!$var;
  70  $sql = "SELECT sum(amount) FROM ".MAIN_DB_PREFIX."bank ";
  71  $solde = valeur($sql);
  72  print "<tr $bc[$var]><td>".$langs->trans("BankBalance")."</td><td align=\"right\">".price($solde)."</td></tr>";
  73  
  74  
  75  print "</table>";
  76  
  77  $db->close();
  78  
  79  llxFooter('$Date: 2005/05/07 21:56:12 $ - $Revision: 1.12 $');
  80  ?>


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