[ 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/includes/modules/facture/uranus/ -> uranus.modules.php (source)

   1  <?php
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2005 Regis Houssin        <regis.houssin@cap-networks.com>
   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   * or see http://www.gnu.org/
  19   *
  20   * $Id: uranus.modules.php,v 1.2 2005/11/14 18:00:01 hregis Exp $
  21   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/modules/facture/uranus/uranus.modules.php,v $
  22   *
  23   */
  24  
  25  /*!    
  26    \file htdocs/includes/modules/facture/uranus/uranus.modules.php
  27    \ingroup    facture
  28    \brief      Fichier contenant la classe du modèle de numérotation de référence de facture Uranus
  29    \version    $Revision: 1.2 $
  30  */
  31  
  32  require_once (DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
  33  
  34  /*!
  35    \class mod_facture_uranus
  36    \brief      Classe du modèle de numérotation de référence de facture Uranus
  37  */
  38  
  39  class mod_facture_uranus extends ModeleNumRefFactures
  40  {
  41  
  42      /*!     \brief      Renvoi la description du modele de numérotation
  43       *      \return     string      Texte descripif
  44       */
  45      function info()
  46      {
  47        return "
  48      Renvoie le numéro de facture sous une forme numérique simple, préfixé par l'année sur un seul chiffre";
  49      }
  50  
  51      /*!     \brief      Renvoi un exemple de numérotation
  52       *      \return     string      Example
  53       */
  54      function getExample()
  55      {
  56          return "5000001";
  57      }
  58  
  59      /*!     \brief      Renvoie la référence de facture suivante non utilisée
  60       *      \param      objsoc      Objet société
  61       *      \return     string      Texte descripif
  62       */
  63      function getNumRef($objsoc=0)
  64      { 
  65        global $db;
  66      
  67        $y = substr(strftime("%y",time()), -1);
  68  
  69        $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture";
  70        $sql .= " WHERE fk_statut > 0";
  71        $sql .= " AND facnumber LIKE '$y%'"; 
  72        $sql .= " AND CHAR_LENGTH(facnumber) = 7";
  73  
  74        if ( $db->query($sql) ) 
  75          {
  76            $row = $db->fetch_row(0);
  77            
  78            $num = $row[0] + 1;
  79          }
  80      
  81        return  "$y" . substr("000000".$num, -6 );
  82      
  83      }    
  84  }
  85  ?>


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