[ 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/telephonie/script/tools/ -> verif-contrat-contact-services.php (source)

   1  <?PHP
   2  /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   *
   4   * This program is free software; you can redistribute it and/or modify
   5   * it under the terms of the GNU General Public License as published by
   6   * the Free Software Foundation; either version 2 of the License, or
   7   * (at your option) any later version.
   8   *
   9   * This program is distributed in the hope that it will be useful,
  10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12   * GNU General Public License for more details.
  13   *
  14   * You should have received a copy of the GNU General Public License
  15   * along with this program; if not, write to the Free Software
  16   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17   *
  18   * $Id: verif-contrat-contact-services.php,v 1.2 2005/12/06 15:34:04 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/tools/verif-contrat-contact-services.php,v $
  20   *
  21   * Vérifie que les contrats qui n'ont pas de contact facture correct
  22   * ont au moins un services d'envoi courrier.
  23   *
  24   */
  25  require  ("../../../master.inc.php");
  26  /*
  27   *
  28   */
  29  
  30  $sql  = "SELECT rowid";
  31  $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat";
  32  
  33  $resql = $db->query($sql) ;
  34  
  35  if ( $resql )
  36  {
  37    while ($row = $db->fetch_row($resql))
  38      {
  39        $sqlc  = "SELECT count(*)";
  40        $sqlc .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_contact_facture";
  41        $sqlc .= " WHERE fk_contrat =".$row[0];
  42  
  43        $resqlc = $db->query($sqlc) ;
  44        if ( $resqlc )
  45      {
  46        $rowc = $db->fetch_row($resqlc);
  47        if ($rowc[0] == 0)
  48          {
  49            $sqls  = "SELECT count(*)";
  50            $sqls .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service";
  51            $sqls .= " WHERE fk_contrat =".$row[0];
  52            $sqls .= " AND fk_service in (1,2);";
  53  
  54            $resqls = $db->query($sqls) ;
  55            if ( $resqls )
  56          {
  57            $rows = $db->fetch_row($resqls);
  58            if ($rows[0] == 0)
  59              {
  60                $sqll  = "SELECT count(*)";
  61                $sqll .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
  62                $sqll .= " WHERE fk_contrat =".$row[0];
  63                $sqll .= " AND statut = 3;";
  64                
  65                $resqll = $db->query($sqll) ;
  66                if ( $resqll )
  67              {
  68                $rowl = $db->fetch_row($resqll);
  69                if ($rowl[0] > 0)
  70                  {
  71                    print "Contrat ".$row[0]." sans contact ni envoi courrier\n";
  72                  }
  73              }
  74              }
  75          }
  76          }
  77      }
  78        else
  79      {
  80        print $db->error();
  81      }
  82        
  83      }
  84  }
  85  else
  86  {
  87    print $db->error();
  88  }
  89  
  90  $db->close();
  91  ?>


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