[ 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/stats/ -> lib.inc.php (source)

   1  <?php
   2  /* Copyright (C) 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: lib.inc.php,v 1.6 2004/10/19 20:35:37 opensides Exp $
  20   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/compta/stats/lib.inc.php,v $
  21   *
  22   */
  23  
  24  function get_ca_propal ($db, $year, $socidp)
  25  {
  26  
  27    $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year ";
  28    if ($socidp)
  29      {
  30        $sql .= " AND f.fk_soc = $socidp";
  31      }
  32    
  33    $result = $db->query($sql);
  34  
  35    if ($result)
  36      {
  37        return  $db->result (0, 0);
  38      }
  39    else
  40      {
  41        return 0;
  42      } 
  43  
  44  }
  45  
  46  function get_ca ($db, $year, $socidp)
  47  {
  48    
  49    $sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f";
  50    $sql .= " WHERE f.fk_statut = 1";
  51    if ($conf->compta->mode != 'CREANCES-DETTES') { 
  52      $sql .= " AND f.paye = 1";
  53    }
  54    $sql .= " AND date_format(f.datef , '%Y') = $year ";
  55    if ($socidp)
  56      {
  57        $sql .= " AND f.fk_soc = $socidp";
  58      }
  59    
  60    $result = $db->query($sql);
  61  
  62    if ($result)
  63      {
  64        return  $db->result ( 0, 0);
  65      }
  66    else
  67      {
  68        return 0;
  69      }   
  70  }


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