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

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2005      Regis Houssin        <regis.houssin@cap-networks.com>
   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   * or see http://www.gnu.org/
  20   *
  21   * $Id: neptune.modules.php,v 1.11 2005/11/14 18:00:01 hregis Exp $
  22   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/includes/modules/facture/neptune/neptune.modules.php,v $
  23   *
  24   */
  25  
  26  /**
  27      \file       htdocs/includes/modules/facture/neptune/neptune.modules.php
  28      \ingroup    facture
  29      \brief      Fichier contenant la classe du modèle de numérotation de référence de facture Neptune
  30      \version    $Revision: 1.11 $
  31  */
  32  
  33  require_once (DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
  34  
  35  /**
  36      \class      mod_facture_neptune
  37      \brief      Classe du modèle de numérotation de référence de facture Neptune
  38  */
  39  class mod_facture_neptune 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        $texte = "Renvoie le numéro de facture sous une forme du préfix FA suivi de l'année sur 2 chiffres et d'un compteur simple sur 4 chiffres.<br>\n";
  48        $texte.= "Si la constante FACTURE_NEPTUNE_DELTA est définie, un offset est appliqué sur le compteur";
  49        if (defined("FACTURE_NEPTUNE_DELTA"))
  50          {
  51            $texte .= " (Définie et vaut: ".FACTURE_NEPTUNE_DELTA.")";
  52          }
  53        else
  54          {
  55            $texte .= " (N'est pas définie)";
  56          }
  57        return $texte;
  58      }
  59  
  60      /**     \brief      Renvoi un exemple de numérotation
  61       *      \return     string      Example
  62       */
  63      function getExample()
  64      {
  65          if (defined("FACTURE_NEPTUNE_DELTA"))
  66          {
  67              return "FA0400".sprintf("%02d",FACTURE_NEPTUNE_DELTA);
  68          }
  69          else 
  70          {
  71              return "FA040001";
  72          }            
  73      }
  74  
  75      /**     \brief      Renvoie la référence de facture suivante non utilisée
  76       *      \param      objsoc      Objet société
  77       *      \return     string      Texte descripif
  78       */
  79      function getNumRef($objsoc=0)
  80      { 
  81        global $db;
  82      
  83        $sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0";
  84      
  85        if ( $db->query($sql) ) 
  86          {
  87            $row = $db->fetch_row(0);
  88            
  89            $num = $row[0];
  90          }
  91      
  92        if (!defined("FACTURE_NEPTUNE_DELTA"))
  93          {
  94            define("FACTURE_NEPTUNE_DELTA", 0);
  95          }
  96      
  97        $num = $num + FACTURE_NEPTUNE_DELTA;
  98      
  99        $y = strftime("%y",time());
 100      
 101        return  "FA" . "$y" . substr("000".$num, strlen("000".$num)-4,4);
 102      
 103      }
 104      
 105  }    
 106  
 107  ?>


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