/[dolibarr]/dolibarr/htdocs/telephonie/script/facturation-details-tableur.php
ViewVC logotype

Diff of /dolibarr/htdocs/telephonie/script/facturation-details-tableur.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by rodolphe, Wed Mar 30 15:53:21 2005 UTC revision 1.3 by rodolphe, Wed Sep 7 10:15:10 2005 UTC
# Line 66  dolibarr_syslog("Mois $month Année $year Line 66  dolibarr_syslog("Mois $month Année $year
66  if (!$error)  if (!$error)
67  {  {
68        
69    $sql = "SELECT distinct(ligne) as client";    $sql = "SELECT fk_contrat as contrat";
70    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_communications_details";    $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_contrat_service";
71    $sql .= " ORDER BY ligne ASC";    $sql .= " WHERE fk_service = 3";
72        
73    $clients = array();    $contrats = array();
74        
75    if ( $db->query($sql) )    if ( $db->query($sql) )
76      {      {
# Line 82  if (!$error) Line 82  if (!$error)
82          {          {
83            $objp = $db->fetch_object( $i);            $objp = $db->fetch_object( $i);
84                        
85            $clients[$i] = $objp->client;            $contrats[$i] = $objp->contrat;
86                        
87            $i++;            $i++;
88          }                      }            
# Line 102  if (!$error) Line 102  if (!$error)
102    
103  if (!$error)  if (!$error)
104  {  {
105     foreach ($clients as $client)    foreach ($contrats as $contrat)
106      {      {
107    
108        $facdet = new FactureDetailTableurOne($db);        $sql = "SELECT rowid as ligne";
109        $resg = $facdet->GenerateFile ($client, $year, $month);        $sql .= " FROM ".MAIN_DB_PREFIX."telephonie_societe_ligne";
110          $sql .= " WHERE fk_contrat = ".$contrat;
111                
112        if ($resg <> 0)        $resql=  $db->query($sql) ;
113    
114          if ($resql)
115          {          {
116            dolibarr_syslog("ERREUR lors de Génération du détail tableur");            $num = $db->num_rows($resql);
117            $error = 19;            
118              $i = 0;
119              
120              while ($i < $num)
121                {
122                  $obj = $db->fetch_object($resql);
123                  
124                  $contrats[$i] = $objp->contrat;
125    
126                  $facdet = new FactureDetailTableurOne($db);
127                  $resg = $facdet->GenerateFile ($obj->ligne, $year, $month);
128                  
129                  if ($resg <> 0)
130                    {
131                      dolibarr_syslog("ERREUR lors de Génération du détail tableur");
132                      $error = 19;
133                    }
134                  
135                  $i++;
136                }            
137              $db->free();
138          }          }
139          else
140            {
141              $error = 1;
142              dolibarr_syslog($db->error());
143            }          
144      }      }
145  }  }
146    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26