[ 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/ -> etude-facturation.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: etude-facturation.php,v 1.1 2005/11/08 16:03:21 rodolphe Exp $
  19   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/telephonie/script/etude-facturation.php,v $
  20   *
  21   *
  22   * Script de facturation
  23   * Verification des factures négatives
  24   *
  25   */
  26  
  27  /**
  28     \file       htdocs/telephonie/script/facturation-analyse.php
  29     \ingroup    telephonie
  30     \brief      Analyse de la facturation
  31     \version    $Revision: 1.1 $
  32  */
  33  
  34  
  35  require  ("../../master.inc.php");
  36  
  37  /*
  38   *
  39   */
  40  
  41  $datetime = time();
  42  $date = strftime("%d%h%Y%Hh%Mm%S",$datetime);
  43  $month = strftime("%m", $datetime);
  44  $year = strftime("%Y", $datetime);
  45  
  46  if ($month == 1)
  47  {
  48    $month = "12";
  49    $year = $year - 1;
  50  }
  51  else
  52  {
  53    $month = substr("00".($month - 1), -2) ;
  54  }
  55  
  56  $sql  = "SELECT fk_tarif, fk_client, temporel, fixe, fk_user, datec ";
  57  $sql .= " FROM llx_telephonie_tarif_client_log";
  58  $sql .= " WHERE date_format(datec,'%m%Y')='".$month.year."'";
  59  $sql .= " ORDER BY datec ASC;";
  60  
  61  $re2sql = $db->query($sql) ;
  62  
  63  if ( $re2sql )
  64  {
  65    $nu2m = $db->num_rows($re2sql);
  66    print "$nu2m tarifs modifiés\n";
  67    $j = 0;
  68    while ($j < $nu2m)
  69      {
  70        $row = $db->fetch_row($re2sql);
  71  
  72        $sqli  = "SELECT fk_tarif, fk_client, temporel, fixe, fk_user, datec ";
  73        $sqli .= " FROM llx_telephonie_tarif_client_log";
  74        $sqli .= " WHERE fk_tarif = ".$row[0];
  75        $sqli .= " AND fk_client = ".$row[1];
  76        $sqli .= " ORDER BY datec ASC";
  77  
  78        $resqli = $db->query($sqli) ;
  79  
  80        if ($resqli )
  81      {
  82        $numi = $db->num_rows($resqli);      
  83        if ($numi > 2)
  84          {
  85            while ( $rowi = $db->fetch_row($resqli))
  86          {
  87            print $rowi[0]." ".$rowi[2]."\n";
  88          }
  89          }
  90      }
  91  
  92        $j++;
  93      }
  94  }
  95  else
  96  {
  97    print $db->error();
  98  }
  99  
 100  
 101  $db->close();
 102  ?>


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